[PATCH] esx: Implement esxDomainGetMetadata for VIR_DOMAIN_METADATA_DESCRIPTION

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

 



---
 src/esx/esx_driver.c |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index b23e7f6..f53b9c4 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -5211,6 +5211,52 @@ no_memory:
 #undef MATCH
 
 
+
+static char *
+esxDomainGetMetadata(virDomainPtr domain, int type,
+                     const char *uri ATTRIBUTE_UNUSED,
+                     unsigned int flags)
+{
+    char *result = NULL;
+    esxPrivate *priv = domain->conn->privateData;
+    esxVI_String *propertyNameList = NULL;
+    esxVI_ObjectContent *virtualMachine = NULL;
+
+    if (flags != VIR_DOMAIN_AFFECT_LIVE) {
+        virReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
+        return NULL;
+    }
+
+    if (type != VIR_DOMAIN_METADATA_DESCRIPTION) {
+        virReportError(VIR_ERR_NO_DOMAIN_METADATA, "%s",
+                       _("Requested metadata element is not supported"));
+        return NULL;
+    }
+
+    if (esxVI_EnsureSession(priv->primary) < 0) {
+        return NULL;
+    }
+
+    if (esxVI_String_AppendValueToList(&propertyNameList,
+                                       "summary.config.annotation") < 0 ||
+        esxVI_LookupVirtualMachineByUuid(priv->primary, domain->uuid,
+                                         propertyNameList, &virtualMachine,
+                                         esxVI_Occurrence_RequiredItem) < 0 ||
+        esxVI_GetStringValue(virtualMachine, "summary.config.annotation",
+                             &result, esxVI_Occurrence_RequiredItem) < 0 ||
+        VIR_STRDUP(result, result) < 0) {
+        goto cleanup;
+    }
+
+  cleanup:
+    esxVI_String_Free(&propertyNameList);
+    esxVI_ObjectContent_Free(&virtualMachine);
+
+    return result;
+}
+
+
+
 static virDriver esxDriver = {
     .no = VIR_DRV_ESX,
     .name = "ESX",
@@ -5288,6 +5334,7 @@ static virDriver esxDriver = {
     .domainSnapshotHasMetadata = esxDomainSnapshotHasMetadata, /* 0.9.13 */
     .domainSnapshotDelete = esxDomainSnapshotDelete, /* 0.8.0 */
     .connectIsAlive = esxConnectIsAlive, /* 0.9.8 */
+    .domainGetMetadata = esxDomainGetMetadata, /* 1.0.6 */
 };
 
 
-- 
1.7.9.5

--
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]