Description of problem:
Using "virsh migrate --live --copy-storage-all ... --xml dest-domain.xml" persists the source-specific domain XML rather than the destination-specific XML.
This happens even though the correct destination-specific XML is used to write the storage copy and create the live-migrated VM at the destination. The VM will fail later when it tries to use the persisted XML which doesn't match the host storage.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. create a VM on a source host
2. create an appropriate empty disk image on destination host, e.g. with different backing storage name
3. perform virsh live migration with destination-specific domain XML file and the --persistent flag
The persistent domain XML at the destination matches the source XML rather than the XML of the running domain after migration, which came from the --xml argument to the migrate command.
The persistent domain XML at the destination should match the XML of the running domain after migration.
I observe this on a plain CentOS 6.2 install but thought you might like to know about the bug...
I first came accross this issue with --copy-storage-all, too. But after some further migrations at our site I can add that storage copy has nothing to do with this. The same issue applies with shared storage when modifying just anything in the XML for migration - network attachments, direct kernel boot paths, etc.
So basically, what's passed via virsh migrate's --xml option is applied to the running VM at the destination while the persistent definition will be a copy of the source's persistent definition without the modifications.
And it still happens with 1.2.1
Workaround: virsh edit on the destination will then show the persistent version. Replacing that with the live one commits the correct XML to disk.
As it is, this bug is still present in 1.2.8 and I can confirm Malte's analysis: the XML provided during the migration is only used for starting the VM, the inactive XML is directly copied from the source host if the VIR_MIGRATE_PERSIST_DEST is present.
Note this seems to have just been fixed with an extra migration flag:
Author: Dmitry Andreev <email@example.com>
Date: Thu Mar 17 19:31:45 2016 +0300
qemu: migration: new migration param for persistent destination XML
Migration API allows to specify a destination domain configuration.
Offline domain has only inactive XML and it is replaced by configuration
specified using VIR_MIGRATE_PARAM_DEST_XML param. In case of live
migration VIR_MIGRATE_PARAM_DEST_XML param is applied for active XML.
This commit introduces the new VIR_MIGRATE_PARAM_PERSIST_XML param
that can be used within live migration to replace persistent/inactive
Required for: https://bugzilla.redhat.com/show_bug.cgi?id=835300
It should probably be wired up in virsh too though...
Finally fixed by
Author: Jiri Denemark <firstname.lastname@example.org>
AuthorDate: Tue Nov 22 14:06:43 2016 +0100
Commit: Jiri Denemark <email@example.com>
CommitDate: Tue Nov 22 21:24:55 2016 +0100
virsh: Add support for VIR_MIGRATE_PARAM_PERSIST_XML
Commit v1.3.3-181-gb028e9d7c implmented support for
VIR_MIGRATE_PARAM_PERSIST_XML migration parameter, but forgot to update
Signed-off-by: Jiri Denemark <firstname.lastname@example.org>