Bug 835300 - virsh migrate --live --copy-storage-all --persistent ... --xml dest-domain.xml saves wrong XML at destination
virsh migrate --live --copy-storage-all --persistent ... --xml dest-domain.xm...
Status: CLOSED NEXTRELEASE
Product: Virtualization Tools
Classification: Community
Component: libvirt (Show other bugs)
unspecified
x86_64 Linux
unspecified Severity unspecified
: ---
: ---
Assigned To: Jiri Denemark
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-06-25 17:43 EDT by Need Real Name
Modified: 2016-11-22 15:36 EST (History)
12 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-11-22 15:36:40 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Need Real Name 2012-06-25 17:43:20 EDT
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):

libvirt-0.9.4-23.el6_2.9.x86_64
libvirt-client-0.9.4-23.el6_2.9.x86_64

How reproducible:

Always.

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
  
Actual results:

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.

Expected results:

The persistent domain XML at the destination should match the XML of the running domain after migration.

Additional info:

I observe this on a plain CentOS 6.2 install but thought you might like to know about the bug...
Comment 2 Malte Starostik 2014-02-19 05:10:48 EST
Me Too™
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.
Comment 3 Tiziano Müller 2014-11-21 04:58:25 EST
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.
Comment 4 Cole Robinson 2016-04-20 09:29:17 EDT
Note this seems to have just been fixed with an extra migration flag:

commit b028e9d7c2f0f7713ba102d01aece13ee72136a1
Author: Dmitry Andreev <dandreev@virtuozzo.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
    configuration.
    
    Required for: https://bugzilla.redhat.com/show_bug.cgi?id=835300


It should probably be wired up in virsh too though...
Comment 5 Jiri Denemark 2016-11-22 15:36:40 EST
Finally fixed by

commit 38f7f297c84dc41cf3e7d2ae5a8f25273f674f13
Refs: v2.4.0-184-g38f7f297c
Author:     Jiri Denemark <jdenemar@redhat.com>
AuthorDate: Tue Nov 22 14:06:43 2016 +0100
Commit:     Jiri Denemark <jdenemar@redhat.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
    virsh.

    https://bugzilla.redhat.com/show_bug.cgi?id=835300

    Signed-off-by: Jiri Denemark <jdenemar@redhat.com>

Note You need to log in before you can comment on or make changes to this bug.