[PATCH v2 2/2] qemuDomainMigrateGraphicsRelocate: Use then new virSocketAddrIsWildcard

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since we have the new internal API to check for wildcard address,
we can use it instead of parsing and formatting.
---
 src/qemu/qemu_migration.c | 18 ++----------------
 1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 3ca3f32..3f02355 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1740,7 +1740,6 @@ qemuDomainMigrateGraphicsRelocate(virQEMUDriverPtr driver,
     int ret;
     char *listenAddress;
     virSocketAddr addr;
-    bool reformatted = false;
 
     if (!cookie)
         return 0;
@@ -1756,23 +1755,10 @@ qemuDomainMigrateGraphicsRelocate(virQEMUDriverPtr driver,
 
     listenAddress = cookie->graphics->listen;
 
-    /* Okay, here's the magic: some mgmt applications set bare '0' as listen
-     * address. On the other hand, it's a valid IPv4 address. This means, we
-     * need to reformat the address so the if statement below can check just
-     * for two ANYCAST addresses and not all their variants. */
-    if (listenAddress &&
-        virSocketAddrParse(&addr, listenAddress, AF_UNSPEC) > 0) {
-        listenAddress = virSocketAddrFormat(&addr);
-        reformatted = true;
-    }
-
     if (!listenAddress ||
-        STREQ(listenAddress, "0.0.0.0") ||
-        STREQ(listenAddress, "::")) {
-        if (reformatted)
-            VIR_FREE(listenAddress);
+        (virSocketAddrParse(&addr, listenAddress, AF_UNSPEC) > 0 &&
+         virSocketAddrIsWildcard(&addr)))
         listenAddress = cookie->remoteHostname;
-    }
 
     ret = qemuDomainObjEnterMonitorAsync(driver, vm,
                                          QEMU_ASYNC_JOB_MIGRATION_OUT);
-- 
1.8.2.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]