[libvirt] [PATCH v3] Add host UUID (to libvirt capabilities)

Stefan Berger stefanb at linux.vnet.ibm.com
Tue May 25 15:06:49 UTC 2010


On Tue, 2010-05-25 at 15:26 +0100, Daniel P. Berrange wrote:

> >  
> >      virBufferAddLit(&xml, "<capabilities>\n\n");
> >      virBufferAddLit(&xml, "  <host>\n");
> > +    virBufferVSprintf(&xml,"    <uuid>%s</uuid>\n", host_uuid);
> >      virBufferAddLit(&xml, "    <cpu>\n");
> >      virBufferVSprintf(&xml, "      <arch>%s</arch>\n",
> >                        caps->host.arch);
> > Index: libvirt-acl/docs/schemas/capability.rng
> > ===================================================================
> > --- libvirt-acl.orig/docs/schemas/capability.rng
> > +++ libvirt-acl/docs/schemas/capability.rng
> > @@ -18,6 +18,9 @@
> >  
> >    <define name='hostcaps'>
> >      <element name='host'>
> > +      <element name='uuid'>
> > +          <ref name='UUID'/>
> > +      </element>
> 
> I've wrapped this in <optional>

OK, yes, this was too strict for the other platforms.

> 
> > Index: libvirt-acl/src/qemu/qemu_driver.c
> > ===================================================================
> > --- libvirt-acl.orig/src/qemu/qemu_driver.c
> > +++ libvirt-acl/src/qemu/qemu_driver.c
> > @@ -1334,6 +1334,11 @@ qemuCreateCapabilities(virCapsPtr oldcap
> >      caps->privateDataXMLFormat = qemuDomainObjPrivateXMLFormat;
> >      caps->privateDataXMLParse = qemuDomainObjPrivateXMLParse;
> >  
> > +    if (virGetHostUUID(caps->host.host_uuid)) {
> > +        qemuReportError(VIR_ERR_INTERNAL_ERROR,
> > +                         "%s", _("cannot get the host uuid"));
> > +        goto err_exit;
> > +    }
> >  
> >      /* Security driver data */
> >      if (driver->securityPrimaryDriver) {
> 
> I've added this same code to the UML and LXC drivers.
> 
> We'll need a different solution for things like VMWare/VirtualBox/Phyp/etc,
> so for now they don't get any host UUID in XML.
> 
> I don't think my new patch should cause any merge problems with
> the VEPA patches, since my changes touched different code.
> 

I tried it and there are no problems.

> Daniel
> 
> 

[...]
>  #
>  # By default, no Username's are checked
>  sasl_allowed_username_list = [ "joe at EXAMPLE.COM", "fred at EXAMPLE.COM" ]
> +# UUID of the host:
> +# Provide the UUID of the host here in case the command
> +# 'dmidecode -s system-uuid' does not provide a valid uuid. In case
> +# 'dmidecode' does not provide a valid UUID and none is provided here, a
> +# temporary UUID will be generated.
> +# Keep the format of the example UUID below.
> +host_uuid = "8510b1a1-1afa-4da6-8111-785fae202c1e"
> 
> 
ACK - I couldn't have done it better :-)

   Stefan





More information about the libvir-list mailing list