Omer Frenkel has uploaded a new change for review.

Change subject: Add support for specifying vm maximum memory
......................................................................

Add support for specifying vm maximum memory

Added new parameter 'maxMemSize' to VM
this parameter is sent from engine backend and passed to libvirt xml
with the mandatory 'slots' attribute.

this parameter is mandatory for memory hotplug.
if this parameter is not passed, then it is not set in the libvirt xml,
and hotplug for this vm will not work.

Change-Id: I54a698fbd45d6605f24b3641c541ff10a332d9f8
Signed-off-by: Omer Frenkel <ofren...@redhat.com>
---
M vdsm/rpc/vdsmapi-schema.json
M vdsm/virt/vmxml.py
2 files changed, 8 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/47/40547/1

diff --git a/vdsm/rpc/vdsmapi-schema.json b/vdsm/rpc/vdsmapi-schema.json
index 0c73078..fa8f336 100644
--- a/vdsm/rpc/vdsmapi-schema.json
+++ b/vdsm/rpc/vdsmapi-schema.json
@@ -3583,6 +3583,9 @@
 #
 # @numOfIoThreads:        #optional The num of iothreads qemu allocates
 #
+# @maxMemSize:            The maximum amount of memory that can be assigned
+#                         to the VM in MB
+#
 # Since: 4.10.0
 ##
 {'type': 'VmDefinition',
@@ -3599,7 +3602,7 @@
           'status': 'VmStatus', 'timeOffset': 'uint',
           'transparentHugePages': 'bool', 'vmId': 'UUID', 'vmName': 'str',
           'vmType': 'VmType', '*exitCode': 'int', '*exitMessage': 'str',
-          '*serial': 'str', '*numOfIoThreads': 'uint'}}
+          '*serial': 'str', '*numOfIoThreads': 'uint', 'maxMemSize': 'uint'}}
 
 ##
 # @VmParameters:
diff --git a/vdsm/virt/vmxml.py b/vdsm/virt/vmxml.py
index 02bbb52..ea5b34e 100644
--- a/vdsm/virt/vmxml.py
+++ b/vdsm/virt/vmxml.py
@@ -167,6 +167,10 @@
         memSizeKB = str(int(self.conf.get('memSize', '256')) * 1024)
         self.dom.appendChildWithArgs('memory', text=memSizeKB)
         self.dom.appendChildWithArgs('currentMemory', text=memSizeKB)
+        if 'maxMemSize' in self.conf:
+            maxMemSizeKB = str(int(self.conf['maxMemSize']) * 1024)
+            self.dom.appendChildWithArgs('maxMemory', text=maxMemSizeKB,
+                                         slots=self._getMaxVCpus())
         vcpu = self.dom.appendChildWithArgs('vcpu', text=self._getMaxVCpus())
         vcpu.setAttrs(**{'current': self._getSmp()})
 


-- 
To view, visit https://gerrit.ovirt.org/40547
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I54a698fbd45d6605f24b3641c541ff10a332d9f8
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Omer Frenkel <ofren...@redhat.com>
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to