On Tue, Aug 31, 2021 at 16:09:50 +0800, Guozhonghua
wrote:>
> Hello,
>
> When we test snapshot features and review the code of libvirt, there is one
question, not an issue.
>
> /* do the memory snapshot if necessary */
> if (memory) {
> /* check if migration is possible */
> if (!qemuMigrationSrcIsAllowed(driver, vm, false, 0))
> goto cleanup;
>
> While making one snapshot with memory on one vm, but it is not allowed
while the vm which has some src devices, such as pci devs, with which the vm is
not allowed to be migrated.
> I want to known the reason, why should it check this conditions?
The reason for this check is that the state of host devices namely PCI
devices can't be serialized by qemu and saved in the snapshot. That
means that when reverting the devices would not be configured properly
and would not work.
Internally qemu and libvirt use the migration code to serialize the
state of the VM and that is the reason why 'qemuMigrationSrcIsAllowed'
is called here, because it uses the same implementation.