[libvirt] [PATCH 2/5] virsh: Add domhostname

Eric Blake eblake at redhat.com
Tue Jul 10 20:57:11 UTC 2012


On 07/10/2012 02:46 PM, Guido Günther wrote:
> to query the guest's hostname.
> ---
>  tools/virsh.c   |   44 ++++++++++++++++++++++++++++++++++++++++++++
>  tools/virsh.pod |    4 ++++
>  2 files changed, 48 insertions(+)

> +
> +static bool
> +cmdDomHostname (vshControl *ctl, const vshCmd *cmd)

Style: no space before function (), here...

> +{
> +    char *hostname;
> +    virDomainPtr dom;
> +    bool ret = false;
> +
> +    if (!vshConnectionUsability(ctl, ctl->conn))
> +        return false;
> +
> +    if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
> +        return false;
> +
> +    hostname = virDomainGetHostname (dom, 0);

here...

> +    if (hostname == NULL) {
> +        vshError(ctl, "%s", _("failed to get hostname"));
> +        goto error;
> +    }
> +
> +    vshPrint (ctl, "%s\n", hostname);

and here.

Other than that, looks reasonable.

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120710/1a397c3c/attachment-0001.sig>


More information about the libvir-list mailing list