]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
qemu: Properly rename persistent def after migration
authorJiri Denemark <jdenemar@redhat.com>
Mon, 4 May 2015 20:21:23 +0000 (22:21 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Mon, 4 May 2015 20:59:51 +0000 (22:59 +0200)
When migrating a domain while changing its name and using
VIR_MIGRATE_PERSIST_DEST flag, libvirt would fail to properly change the
name in the persistent definition. The inconsistency results in weird
behavior when dumping domain XML, destroying the domain, restarting
libvirtd and likely in several other situations.

Since the new name is already stored in vm->def->name, we just need to
make sure the persistent definition uses this new name too.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
src/qemu/qemu_migration.c

index 20c21938caa14bf34fbc7cddb94b2f3b9f333b28..c1af704b8c7e43fe6b8d9351b42988ac9a66a331 100644 (file)
@@ -1392,6 +1392,14 @@ qemuMigrationEatCookie(virQEMUDriverPtr driver,
                                        flags) < 0)
         goto error;
 
+    if (flags & QEMU_MIGRATION_COOKIE_PERSISTENT &&
+        mig->persistent &&
+        STRNEQ(dom->def->name, mig->persistent->name)) {
+        VIR_FREE(mig->persistent->name);
+        if (VIR_STRDUP(mig->persistent->name, dom->def->name) < 0)
+            goto error;
+    }
+
     if (mig->flags & QEMU_MIGRATION_COOKIE_LOCKSTATE) {
         if (!mig->lockDriver) {
             if (virLockManagerPluginUsesState(driver->lockManager)) {