]> xenbits.xensource.com Git - libvirt.git/commitdiff
Fix persistent migration config save
authorKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Fri, 26 Aug 2011 03:08:11 +0000 (12:08 +0900)
committerEric Blake <eblake@redhat.com>
Fri, 26 Aug 2011 15:45:57 +0000 (09:45 -0600)
When a user migrates a domain by command as

libvirt saves vm's domain XML config in destination host after migration.
But it saves vm->def. Then, the saved XML contains some garbage.

  <domain type='kvm' id='50'>
                     ^^^^^^^^
  ...
   <console type='pty' tty='/dev/pts/5'>
                       ^^^^^^^^^^^^^^^^^

Avoid saving unnecessary things by saving persistent vm definition.

src/qemu/qemu_migration.c

index 3818d71c5ff40d06c5776808bd8cedba6b45f71a..a2dc97cc379162c2211aa8c830ab3608cc352ddf 100644 (file)
@@ -2487,11 +2487,12 @@ qemuMigrationFinish(struct qemud_driver *driver,
         qemuMigrationVPAssociatePortProfiles(vm->def);
 
         if (flags & VIR_MIGRATE_PERSIST_DEST) {
+            virDomainDefPtr vmdef;
             if (vm->persistent)
                 newVM = 0;
             vm->persistent = 1;
-
-            if (virDomainSaveConfig(driver->configDir, vm->def) < 0) {
+            vmdef = virDomainObjGetPersistentDef(driver->caps, vm);
+            if (virDomainSaveConfig(driver->configDir, vmdef) < 0) {
                 /* Hmpf.  Migration was successful, but making it persistent
                  * was not.  If we report successful, then when this domain
                  * shuts down, management tools are in for a surprise.  On the