[libvirt] [PATCH 1/3] bhyve: add domain metadata support
Roman Bogorodskiy
bogorodskiy at gmail.com
Tue Apr 8 17:06:23 UTC 2014
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140408/60f8ed92/attachment-0001.sig>
More information about the libvir-list
mailing list