[libvirt] [PATCH 2/2] qemu: adding domainGetHostname support for QEMU.

Daniel P. Berrangé berrange at redhat.com
Mon Aug 20 08:59:37 UTC 2018


On Sat, Aug 18, 2018 at 02:18:17PM +0200, Peter Krempa wrote:
> On Fri, Aug 17, 2018 at 23:25:19 -0300, Julio Faracco wrote:
> > This commit add the support to use the function qemuAgentGetHostname() for
> > obtain the domain hostname using QEMU-GA command.
> > 
> > Signed-off-by: Julio Faracco <jcfaracco at gmail.com>
> > ---
> >  src/qemu/qemu_driver.c | 41 +++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 41 insertions(+)
> > 
> > diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> > index d4a2379e48..9a6614fbc2 100644
> > --- a/src/qemu/qemu_driver.c
> > +++ b/src/qemu/qemu_driver.c
> > @@ -19309,6 +19309,46 @@ qemuConnectGetCPUModelNames(virConnectPtr conn,
> >      return virCPUGetModels(arch, models);
> >  }
> >  
> > +static char *
> > +qemuDomainGetHostname(virDomainPtr dom,
> > +                      unsigned int flags)
> > +{
> > +    int rv = -1;
> > +    virQEMUDriverPtr driver = dom->conn->privateData;
> > +    virDomainObjPtr vm = NULL;
> > +    qemuAgentPtr agent;
> > +    char *hostname = NULL;
> > +
> > +    virCheckFlags(0, hostname);
> 
> Please return NULL directly.
> 
> > +
> > +    if (!(vm = qemuDomObjFromDomain(dom)))
> > +        return NULL;
> > +
> > +    if (virDomainGetTimeEnsureACL(dom->conn, vm->def) < 0)
> 
> ACL checking functions are per-API, so this should use virDomainGetHostnameACL.
> 
> I presume it's a copy-paste error.
> 
> This is the wrong ACL checking function.

'make check' should have reported this, so make sure to run that.


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list