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

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



On Thu, Jun 06, 2013 at 06:11:40PM +0200, Michal Privoznik wrote:
> 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);

ACK


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|


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