]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
qemu: Set correct migrate host in client_migrate_info
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 10 Apr 2013 15:16:06 +0000 (17:16 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 11 Apr 2013 10:32:17 +0000 (12:32 +0200)
https://bugzilla.redhat.com/show_bug.cgi?id=920441

Currently, we are discarding listen attribute from qemu cookie even though
we strive to gather it. This result in not so cool bug: if user have
different networks, one for management/migration, and one for VNC/SPICE we
pass incorrect host to the qemu in client_migrate_info. What we actually
pass is remote hostname, while we should be passing remote listen address.
It doesn't matter as long as these two are the same, but they don't need
necessary to be like that.

src/conf/domain_conf.c
src/qemu/qemu_migration.c

index 36a46da36bb736a1293678147c5194fdc78bc141..3d3bec7ea75bf7bdefbf93d30264a622e643a8d5 100644 (file)
@@ -16557,8 +16557,10 @@ virDomainGraphicsListenGetAddress(virDomainGraphicsDefPtr def, size_t ii)
     virDomainGraphicsListenDefPtr listenInfo
         = virDomainGraphicsGetListen(def, ii, false);
 
+    /* even a network can have a listen address */
     if (!listenInfo ||
-        (listenInfo->type != VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS))
+        !(listenInfo->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS ||
+          listenInfo->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK))
         return NULL;
     return listenInfo->address;
 }
index 41ad768050a582405dc078ff5420a399a4b6722f..a263668a8dde0c263883d2d33c12d249c48463fc 100644 (file)
@@ -1720,6 +1720,7 @@ qemuDomainMigrateGraphicsRelocate(virQEMUDriverPtr driver,
 {
     qemuDomainObjPrivatePtr priv = vm->privateData;
     int ret;
+    char *listenAddress = cookie->graphics->listen;
 
     if (!cookie)
         return 0;
@@ -1733,12 +1734,17 @@ qemuDomainMigrateGraphicsRelocate(virQEMUDriverPtr driver,
     if (cookie->graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_SPICE)
         return 0;
 
+    if (!listenAddress ||
+        STREQ(listenAddress, "0.0.0.0") ||
+        STREQ(listenAddress, "::"))
+        listenAddress = cookie->remoteHostname;
+
     ret = qemuDomainObjEnterMonitorAsync(driver, vm,
                                          QEMU_ASYNC_JOB_MIGRATION_OUT);
     if (ret == 0) {
         ret = qemuMonitorGraphicsRelocate(priv->mon,
                                           cookie->graphics->type,
-                                          cookie->remoteHostname,
+                                          listenAddress,
                                           cookie->graphics->port,
                                           cookie->graphics->tlsPort,
                                           cookie->graphics->tlsSubject);