[libvirt] [PATCH 1/5] Add virGetHostname

Eric Blake eblake at redhat.com
Tue Jul 10 20:54:59 UTC 2012


In the subject: s/virGetHostname/virDomainGetHostname/

On 07/10/2012 02:46 PM, Guido Günther wrote:
> to query a guests's hostname. Containers like LXC and OpenVZ allow to
> set a hostname different from the hosts name and QEMU's guest agent
> could provide similar functionality.
> ---
>  include/libvirt/libvirt.h.in |    2 ++
>  src/driver.h                 |    6 ++++++
>  src/libvirt.c                |   42 ++++++++++++++++++++++++++++++++++++++++++
>  src/libvirt_public.syms      |    5 +++++
>  4 files changed, 55 insertions(+)
> 
> diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
> index 6e8d5dd..496a478 100644
> --- a/include/libvirt/libvirt.h.in
> +++ b/include/libvirt/libvirt.h.in
> @@ -1540,6 +1540,8 @@ int                     virDomainSetMemoryFlags (virDomainPtr domain,
>  int                     virDomainGetMaxVcpus    (virDomainPtr domain);
>  int                     virDomainGetSecurityLabel (virDomainPtr domain,
>                                                     virSecurityLabelPtr seclabel);
> +char *                  virDomainGetHostname    (virDomainPtr domain,
> +                                                 unsigned int flags);

Seems like it might be useful.


> +
> +/**
> + * virDomainGetHostname:
> + * @domain: a domain object
> + * @flags: extra flags; not used yet, so callers should always pass 0
> + *
> + * Get the hostname for that domain

Missing an ending '.'.  Maybe also mention that for some hypervisors,
the guest may need to be running a guest agent.

> + *
> + *

Extra blank line.

> + * Returns a pointer to the name or NULL.

Mention that caller must free the result.

> + */
> +char *
> +virDomainGetHostname(virDomainPtr domain, unsigned int flags)
> +{
> +    virConnectPtr conn;
> +
> +    VIR_DEBUG("domain=%p", domain);

Better to use:

VIR_DOMAIN_DEBUG(domain)

> +++ b/src/libvirt_public.syms
> @@ -544,4 +544,9 @@ LIBVIRT_0.9.13 {
>          virDomainSnapshotRef;
>  } LIBVIRT_0.9.11;
>  
> +LIBVIRT_0.9.14 {

We are considering naming the next release 0.10.0; but this can be fixed
up globally when we solidify the naming decision.

> +    global:
> +        virDomainGetHostname;
> +} LIBVIRT_0.9.13;
> +
>  # .... define new API here using predicted next version number ....
> 

-- 
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/78fac51f/attachment-0001.sig>


More information about the libvir-list mailing list