Re: [PATCH 1/3] bhyve: add domain metadata support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



  Michal Privoznik wrote:

> On 06.04.2014 11:52, Roman Bogorodskiy wrote:
> > Implement domainSetMetadata and domainGetMetadata driver calls.
> > ---
> >   src/bhyve/bhyve_driver.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++
> >   1 file changed, 55 insertions(+)
> >
> > diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
> > index 461a070..f268de4 100644
> > --- a/src/bhyve/bhyve_driver.c
> > +++ b/src/bhyve/bhyve_driver.c
> > @@ -793,6 +793,59 @@ bhyveDomainOpenConsole(virDomainPtr dom,
> >   }
> >
> >   static int
> > +bhyveDomainSetMetadata(virDomainPtr dom,
> > +                       int type,
> > +                       const char *metadata,
> > +                       const char *key,
> > +                       const char *uri,
> > +                       unsigned int flags)
> > +{
> > +    bhyveConnPtr privconn = dom->conn->privateData;
> > +    virDomainObjPtr vm;
> > +    int ret = -1;
> > +
> > +    virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
> > +                  VIR_DOMAIN_AFFECT_CONFIG, -1);
> > +
> > +    if (!(vm = bhyveDomObjFromDomain(dom)))
> > +        return -1;
> > +
> > +    if (virDomainSetMetadataEnsureACL(dom->conn, vm->def, flags) < 0)
> > +        goto cleanup;
> > +
> > +    ret = virDomainObjSetMetadata(vm, type, metadata, key, uri, privconn->caps,
> > +                                  privconn->xmlopt, BHYVE_CONFIG_DIR, flags);
> > +
> > + cleanup:
> > +    virObjectUnlock(vm);
> > +    return ret;
> > +}
> > +
> > +static char *
> > +bhyveDomainGetMetadata(virDomainPtr dom,
> > +                      int type,
> > +                      const char *uri,
> > +                      unsigned int flags)
> > +{
> > +    bhyveConnPtr privconn = dom->conn->privateData;
> > +    virDomainObjPtr vm;
> > +    char *ret = NULL;
> > +
> > +    if (!(vm = bhyveDomObjFromDomain(dom)))
> > +        return NULL;
> > +
> > +    if (virDomainGetMetadataEnsureACL(dom->conn, vm->def) < 0)
> > +        goto cleanup;
> > +
> > +    ret = virDomainObjGetMetadata(vm, type, uri, privconn->caps,
> > +                                  privconn->xmlopt, flags);
> > +
> > + cleanup:
> > +    virObjectUnlock(vm);
> > +    return ret;
> > +}
> > +
> > +static int
> >   bhyveNodeGetCPUStats(virConnectPtr conn,
> >                        int cpuNum,
> >                        virNodeCPUStatsPtr params,
> > @@ -1009,6 +1062,8 @@ static virDriver bhyveDriver = {
> >       .domainGetAutostart = bhyveDomainGetAutostart, /* 1.2.4 */
> >       .domainSetAutostart = bhyveDomainSetAutostart, /* 1.2.4 */
> >       .domainOpenConsole = bhyveDomainOpenConsole, /* 1.2.4 */
> > +    .domainSetMetadata = bhyveDomainSetMetadata, /* 1.2.4 */
> > +    .domainGetMetadata = bhyveDomainGetMetadata, /* 1.2.4 */
> >       .nodeGetCPUStats = bhyveNodeGetCPUStats, /* 1.2.2 */
> >       .nodeGetMemoryStats = bhyveNodeGetMemoryStats, /* 1.2.2 */
> >       .nodeGetInfo = bhyveNodeGetInfo, /* 1.2.3 */
> >
> 
> 
> Now that I've pushed Wojciech's patches, we shouldn't be accessing 
> privconn->caps directly.
> 
> ACK if you do the obvious change.

Pushed with that fix.

Also, dropped 2/2 and pushed 3/3 with using virBhyveCapsBuild().

Thanks for the review!

Roman Bogorodskiy

Attachment: pgp5Y5D1Yr_6A.pgp
Description: PGP signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]