Dan Kenigsberg has posted comments on this change.
Change subject: set the # of vcpus for a VM (hot plug/unplug)
......................................................................
Patch Set 20:
(5 comments)
....................................................
File vdsm/vm.py
Line 896: memSizeKB = str(int(self.conf.get('memSize', '256')) * 1024)
Line 897: self.dom.appendChildWithArgs('memory', text=memSizeKB)
Line 898: self.dom.appendChildWithArgs('currentMemory', text=memSizeKB)
Line 899: smp = self._getSmp()
Line 900: vcpu = self.dom.appendChildWithArgs(
nit: lines could be joined
Line 901: 'vcpu', text=self._getMaxVCpus())
Line 902: vcpu.setAttrs(**{'current': smp})
Line 903:
Line 904: memSizeGuaranteedKB = str(1024 * int(
Line 898: self.dom.appendChildWithArgs('currentMemory', text=memSizeKB)
Line 899: smp = self._getSmp()
Line 900: vcpu = self.dom.appendChildWithArgs(
Line 901: 'vcpu', text=self._getMaxVCpus())
Line 902: vcpu.setAttrs(**{'current': smp})
so now there's no real need of the "smp" variable.
Line 903:
Line 904: memSizeGuaranteedKB = str(1024 * int(
Line 905: self.conf.get('memGuaranteedSize', '0')
Line 906: ))
Line 1150: def toxml(self):
Line 1151: return self.doc.toprettyxml(encoding='utf-8')
Line 1152:
Line 1153: def _getSmp(self):
Line 1154: return self.conf.get('smp', 1)
make sure the type of the return value is int. Currently, _getMaxVCpus() can be
either int or str, which can get you into troubles.
Line 1155:
Line 1156: def _getMaxVCpus(self):
Line 1157: return self.conf.get('maxVCpus', self._getSmp())
Line 1158:
....................................................
File vdsm_api/vdsmapi-schema.json
Line 2809: # @kvmEnable: Indicates if KVM hardware acceleration is
enabled
Line 2810: #
Line 2811: # @memSize: The amount of memory assigned to the VM in
MB
Line 2812: #
Line 2813: # @maxVCpus Maximum number of CPU available for the
guest
mark as #optional, keep in alphabetic order.
Line 2814: # It is the upper boundry for hot plug CPU
action
Line 2815: #
Line 2816: # @memGuaranteedSize: The amount of memory guaranteed to the VM
in MB
Line 2817: #
Line 2856: 'displayPort': 'int', 'displaySecurePort': 'int',
Line 2857: '*emulatedMachine': 'str', '*keyboardLayout': 'str',
Line 2858: 'kvmEnable': 'bool', 'memSize': 'uint',
'memGuaranteedSize': 'uint',
Line 2859: 'nicModel': 'str', 'nice': 'int', '*pauseCode': 'str',
Line 2860: 'pid': 'uint', 'smp': 'uint', '*smpCoresPerSocket': 'uint',
Add *maxVCpus to this dict, too.
Line 2861: '*smpThreadsPerCore': 'uint', 'status': 'VmStatus',
Line 2862: 'timeOffset': 'uint', 'transparentHugePages': 'bool',
Line 2863: 'vmId': 'UUID', 'vmName': 'str', 'vmType': 'VmType',
Line 2864: '*exitCode': 'int', '*exitMessage': 'str'}}
--
To view, visit http://gerrit.ovirt.org/21789
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ief35e1d335737cd98d21a5413ac9f8ab9d824c3e
Gerrit-PatchSet: 20
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Roy Golan <[email protected]>
Gerrit-Reviewer: Dan Kenigsberg <[email protected]>
Gerrit-Reviewer: Eduardo <[email protected]>
Gerrit-Reviewer: Francesco Romani <[email protected]>
Gerrit-Reviewer: Michal Skrivanek <[email protected]>
Gerrit-Reviewer: Roy Golan <[email protected]>
Gerrit-Reviewer: Saggi Mizrahi <[email protected]>
Gerrit-Reviewer: Vinzenz Feenstra <[email protected]>
Gerrit-Reviewer: Yaniv Bronhaim <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches