]> xenbits.xensource.com Git - libvirt.git/commitdiff
hyperv: add hypervMsvmVSMSAddResourceSettings
authorMatt Coleman <mcoleman@datto.com>
Thu, 14 Jan 2021 13:03:35 +0000 (08:03 -0500)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 21 Jan 2021 09:18:21 +0000 (10:18 +0100)
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/hyperv/hyperv_wmi.c
src/hyperv/hyperv_wmi.h

index 466296fe2a8db76d8f5f11b0ff7a0983e06325fa..4bace10874367e777cf60b758002c25a5379407e 100644 (file)
@@ -1585,6 +1585,58 @@ hypervGetStorageAllocationSD(hypervPrivate *priv,
  * Msvm_VirtualSystemManagementService
  */
 
+int
+hypervMsvmVSMSAddResourceSettings(virDomainPtr domain,
+                                  GHashTable **resourceSettingsPtr,
+                                  hypervWmiClassInfoPtr wmiInfo,
+                                  WsXmlDocH *response)
+{
+    int result = -1;
+    hypervPrivate *priv = domain->conn->privateData;
+    char uuid_string[VIR_UUID_STRING_BUFLEN];
+    Msvm_VirtualSystemSettingData *vssd = NULL;
+    GHashTable *resourceSettings = *resourceSettingsPtr;
+    g_autoptr(hypervInvokeParamsList) params = NULL;
+    g_auto(virBuffer) eprQuery = VIR_BUFFER_INITIALIZER;
+
+    virUUIDFormat(domain->uuid, uuid_string);
+
+    if (hypervGetMsvmVirtualSystemSettingDataFromUUID(priv, uuid_string, &vssd) < 0)
+        goto cleanup;
+
+    virBufferEscapeSQL(&eprQuery,
+                       MSVM_VIRTUALSYSTEMSETTINGDATA_WQL_SELECT "WHERE InstanceID='%s'",
+                       vssd->data->InstanceID);
+
+    params = hypervCreateInvokeParamsList("AddResourceSettings",
+                                          MSVM_VIRTUALSYSTEMMANAGEMENTSERVICE_SELECTOR,
+                                          Msvm_VirtualSystemManagementService_WmiInfo);
+
+    if (!params)
+        goto cleanup;
+
+    if (hypervAddEprParam(params, "AffectedConfiguration",
+                          &eprQuery, Msvm_VirtualSystemSettingData_WmiInfo) < 0)
+        goto cleanup;
+
+    if (hypervAddEmbeddedParam(params, "ResourceSettings", &resourceSettings, wmiInfo) < 0) {
+        hypervFreeEmbeddedParam(resourceSettings);
+        goto cleanup;
+    }
+
+    if (hypervInvokeMethod(priv, &params, response) < 0)
+        goto cleanup;
+
+    result = 0;
+
+ cleanup:
+    hypervFreeObject(priv, (hypervObject *)vssd);
+    *resourceSettingsPtr = NULL;
+
+    return result;
+}
+
+
 int
 hypervMsvmVSMSModifyResourceSettings(hypervPrivate *priv,
                                      GHashTable **resourceSettingsPtr,
index 31f7e2e3bad1b9cea93e069dc1bf2be8dddec574..ff96b8063d68057243cb74a0df5e9629893595f4 100644 (file)
@@ -256,6 +256,11 @@ int hypervGetStorageAllocationSD(hypervPrivate *priv,
  * Msvm_VirtualSystemManagementService
  */
 
+int hypervMsvmVSMSAddResourceSettings(virDomainPtr domain,
+                                      GHashTable **resourceSettingsPtr,
+                                      hypervWmiClassInfoPtr wmiInfo,
+                                      WsXmlDocH *response);
+
 int hypervMsvmVSMSModifyResourceSettings(hypervPrivate *priv,
                                          GHashTable **resourceSettingsPtr,
                                          hypervWmiClassInfoPtr wmiInfo);