[libvirt] [PATCH] esx: Make the domain part of the hostname optional

Daniel P. Berrange berrange at redhat.com
Sun Jan 17 13:02:54 UTC 2010


On Sat, Jan 16, 2010 at 03:22:01PM +0100, Matthias Bolte wrote:
> Before the driver assumed that there is always a domain part. That's
> not true. Now the domain part is handled as optional.
> ---
>  src/esx/esx_driver.c |   17 ++++++++++-------
>  1 files changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
> index 4ed4533..aeb3d07 100644
> --- a/src/esx/esx_driver.c
> +++ b/src/esx/esx_driver.c
> @@ -773,14 +773,17 @@ esxGetHostname(virConnectPtr conn)
>      }
>  
>      if (domainName == NULL || strlen(domainName) < 1) {
> -        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
> -                  "Missing or empty 'domainName' property");
> -        goto failure;
> -    }
> +        complete = strdup(hostName);
>  
> -    if (virAsprintf(&complete, "%s.%s", hostName, domainName) < 0) {
> -        virReportOOMError(NULL);
> -        goto failure;
> +        if (complete == NULL) {
> +            virReportOOMError(NULL);
> +            goto failure;
> +        }
> +    } else {
> +        if (virAsprintf(&complete, "%s.%s", hostName, domainName) < 0) {
> +            virReportOOMError(NULL);
> +            goto failure;
> +        }
>      }
>  
>    cleanup:
> -- 

ACK


Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list