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 */
--
1.9.0