[PATCH 1/7] hyperv: implement domainGetMaxMemory

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

 



Co-authored-by: Sri Ramanujam <sramanujam@xxxxxxxxx>
Signed-off-by: Matt Coleman <matt@xxxxxxxxx>
---
 src/hyperv/hyperv_driver.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c
index b789ef58e8..67b8b771d9 100644
--- a/src/hyperv/hyperv_driver.c
+++ b/src/hyperv/hyperv_driver.c
@@ -905,6 +905,33 @@ hypervDomainGetOSType(virDomainPtr domain G_GNUC_UNUSED)
 }
 
 
+static unsigned long long
+hypervDomainGetMaxMemory(virDomainPtr domain)
+{
+    char uuid_string[VIR_UUID_STRING_BUFLEN];
+    hypervPrivate *priv = domain->conn->privateData;
+    Msvm_VirtualSystemSettingData *vssd = NULL;
+    Msvm_MemorySettingData *mem_sd = NULL;
+    int maxMemoryBytes = 0;
+
+    virUUIDFormat(domain->uuid, uuid_string);
+
+    if (hypervGetMsvmVirtualSystemSettingDataFromUUID(priv, uuid_string, &vssd) < 0)
+        goto cleanup;
+
+    if (hypervGetMemorySD(priv, vssd->data->InstanceID, &mem_sd) < 0)
+        goto cleanup;
+
+    maxMemoryBytes = mem_sd->data->Limit * 1024;
+
+ cleanup:
+    hypervFreeObject(priv, (hypervObject *)vssd);
+    hypervFreeObject(priv, (hypervObject *)mem_sd);
+
+    return maxMemoryBytes;
+}
+
+
 static int
 hypervDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
 {
@@ -1765,6 +1792,7 @@ static virHypervisorDriver hypervHypervisorDriver = {
     .domainDestroy = hypervDomainDestroy, /* 0.9.5 */
     .domainDestroyFlags = hypervDomainDestroyFlags, /* 0.9.5 */
     .domainGetOSType = hypervDomainGetOSType, /* 0.9.5 */
+    .domainGetMaxMemory = hypervDomainGetMaxMemory, /* 6.10.0 */
     .domainGetInfo = hypervDomainGetInfo, /* 0.9.5 */
     .domainGetState = hypervDomainGetState, /* 0.9.5 */
     .domainGetXMLDesc = hypervDomainGetXMLDesc, /* 0.9.5 */
-- 
2.27.0





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

  Powered by Linux