Bug 835300 - virsh migrate --live --copy-storage-all --persistent ... --xml dest-domain.xml saves wrong XML at destination
Summary: virsh migrate --live --copy-storage-all --persistent ... --xml dest-domain.xm...
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Jiri Denemark
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-06-25 21:43 UTC by Need Real Name
Modified: 2016-11-22 20:36 UTC (History)
12 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-22 20:36:40 UTC
Embargoed:


Attachments (Terms of Use)

Description Need Real Name 2012-06-25 21:43:20 UTC
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 10:10:48 UTC
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 09:58:25 UTC
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 13:29:17 UTC
Note this seems to have just been fixed with an extra migration flag:

commit b028e9d7c2f0f7713ba102d01aece13ee72136a1
Author: Dmitry Andreev <dandreev>
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 20:36:40 UTC
Finally fixed by

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


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