mirror of https://gitee.com/openkylin/libvirt.git
qemuDomainMigrateGraphicsRelocate: Use then new virSocketAddrIsWildcard
Since we have the new internal API to check for wildcard address, we can use it instead of parsing and formatting.
This commit is contained in:
parent
688994364f
commit
b72ba1da36
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue