]> xenbits.xensource.com Git - libvirt.git/commitdiff
hyperv: Map Limit to max_memory and VirtualQuantity to cur_balloon
authorLadi Prosek <lprosek@redhat.com>
Fri, 6 Oct 2017 06:47:35 +0000 (08:47 +0200)
committerJohn Ferlan <jferlan@redhat.com>
Mon, 16 Oct 2017 14:29:32 +0000 (10:29 -0400)
Hyper-V uses its own specific memory management so no mapping is going to
be perfect. However, it is more correct to map Limit to max_memory (it
really is the upper limit of what the VM may potentially use) and keep
cur_balloon equal to total_memory.

The typical value returned from Hyper-V in Limit is 1 TiB, which is not
really going to work if interpreted as "startup memory" to be ballooned
away later.

Signed-off-by: Ladi Prosek <lprosek@redhat.com>
src/hyperv/hyperv_driver.c

index 8ae87743da788e1631faf3bfe005f5f8d262db07..ee94fd351131d7f416e305426d9d2d395edfcc41 100644 (file)
@@ -919,8 +919,10 @@ hypervDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
         def->description = virBufferContentAndReset(&buf);
     }
 
-    virDomainDefSetMemoryTotal(def, memorySettingData->data.common->Limit * 1024); /* megabyte to kilobyte */
-    def->mem.cur_balloon = memorySettingData->data.common->VirtualQuantity * 1024; /* megabyte to kilobyte */
+    /* mebibytes to kibibytes */
+    def->mem.max_memory = memorySettingData->data.common->Limit * 1024;
+    def->mem.cur_balloon = memorySettingData->data.common->VirtualQuantity * 1024;
+    virDomainDefSetMemoryTotal(def, memorySettingData->data.common->VirtualQuantity * 1024);
 
     if (virDomainDefSetVcpusMax(def,
                                 processorSettingData->data.common->VirtualQuantity,