Royce Lv has uploaded a new change for review.
Change subject: add verb for vdsm to tuneCpu params ......................................................................
add verb for vdsm to tuneCpu params
Engine and Mom need an interface to cap the max cpu and share. So add this verb to vdsm.
tuneCpu: Dynamically tune cpu absolute max proportion and relative share. Input: vmId: VM to be tuned max_proportion=<value>: absolute max proportion for each vCPU can consume -1:no limit,[0.001,1]:valid proportion relative_share=<value>:relative share of CPU compared with other VMs output: success: return doneCode failure: return errCode tunecpuErr.
Change-Id: I09e02e09ef06ad6de45be75c3f2f913a3025750f Signed-off-by: Royce Lvlvroyce@linux.vnet.ibm.com --- M vdsm/API.py M vdsm/BindingXMLRPC.py M vdsm/define.py M vdsm/libvirtvm.py M vdsm/storage/misc.py M vdsm_cli/vdsClient.py 6 files changed, 97 insertions(+), 8 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/92/7492/1
diff --git a/vdsm/API.py b/vdsm/API.py index 827f73b..f0c47d1 100644 --- a/vdsm/API.py +++ b/vdsm/API.py @@ -26,6 +26,7 @@ import time import threading import logging +import math
from vdsm import utils from clientIF import clientIF @@ -37,6 +38,7 @@ import storage.volume import storage.sd import storage.image +import storage.storage_exception as se from vdsm.define import doneCode, errCode, Kbytes, Mbytes import caps from vdsm.config import config @@ -555,6 +557,33 @@ message = USER_SHUTDOWN_MESSAGE return v.shutdown(delay, message)
+ def tuneCpu(self, tuneParams): + try: + v = self._cif.vmContainer[self._UUID] + if 'relative_share' in tuneParams: + tuneParams['cpu_shares'] = storage.misc.validateN( + tuneParams['relative_share'], 'relative_share') + del(tuneParams['relative_share']) + if 'max_proportion' in tuneParams: + max = storage.misc.validateFloat( + tuneParams['max_proportion'], 'max_proportion') + tuneParams['vcpu_period'] = 1000000 + if max > 1: + raise se.InvalidParameterException('max_proportion', max) + elif max >= 0.001: + tuneParams['vcpu_quota'] = int( + round(tuneParams['vcpu_period'] * max)) + else: + tuneParams['vcpu_quota'] = int(math.floor(max)) + del(tuneParams['max_proportion']) + del(tuneParams['vmId']) + except KeyError: + return errCode['noVM'] + except se.InvalidParameterException: + return errCode['tunecpuErr'] + + return v.tuneCpu(tuneParams) + def _createSysprepFloppyFromInf(self, infFileBinary, floppyImage): try: rc, out, err = utils.execCmd([constants.EXT_MK_SYSPREP_FLOPPY, diff --git a/vdsm/BindingXMLRPC.py b/vdsm/BindingXMLRPC.py index 826c125..37b1f60 100644 --- a/vdsm/BindingXMLRPC.py +++ b/vdsm/BindingXMLRPC.py @@ -265,6 +265,10 @@ vm = API.VM(vmId) return vm.snapshot(snapDrives)
+ def vmTuneCpu(self, params): + vm = API.VM(params['vmId']) + return vm.tuneCpu(params) + def vmMerge(self, vmId, mergeDrives): vm = API.VM(vmId) return vm.merge(mergeDrives) @@ -765,7 +769,8 @@ (self.vmHotplugDisk, 'hotplugDisk'), (self.vmHotunplugDisk, 'hotunplugDisk'), (self.vmHotplugNic, 'hotplugNic'), - (self.vmHotunplugNic, 'hotunplugNic')) + (self.vmHotunplugNic, 'hotunplugNic'), + (self.vmTuneCpu, 'tuneCpu'))
def getIrsMethods(self): return ((self.domainActivate, 'activateStorageDomain'), diff --git a/vdsm/define.py b/vdsm/define.py index 049d36c..d41d467 100644 --- a/vdsm/define.py +++ b/vdsm/define.py @@ -117,6 +117,9 @@ 'momErr': {'status': {'code': 54, 'message': 'Failed to set mom policy'}}, + 'tunecpuErr': {'status': + {'code': 55, + 'message': 'Failed to Tune CPU'}}, 'recovery': {'status': {'code': 99, 'message': diff --git a/vdsm/libvirtvm.py b/vdsm/libvirtvm.py index e95e94b..59c7ec6 100644 --- a/vdsm/libvirtvm.py +++ b/vdsm/libvirtvm.py @@ -1371,13 +1371,17 @@ if self._initTimePauseCode == 'ENOSPC': self.cont() self.conf['pid'] = self._getPid() - - nice = int(self.conf.get('nice', '0')) - nice = max(min(nice, 19), 0) - try: - self._dom.setSchedulerParameters({'cpu_shares': (20 - nice) * 51}) - except: - self.log.warning('failed to set Vm niceness', exc_info=True) + #do not trying to change cpu_shares for recovery and restore flows + if not 'recover' in self.conf and not 'restoreState' in self.conf: + nice = int(self.conf.get('nice', '0')) + nice = max(min(nice, 19), 0) + cpuShare = (20 - nice) * 51 + try: + self._dom.setSchedulerParameters({'cpu_shares': cpuShare}) + except: + self.log.warning('failed to set Vm niceness', exc_info=True) + self.conf['cpu_shares'] = cpuShare + self.saveState()
def _run(self): self.log.info("VM wrapper has started") @@ -1931,6 +1935,23 @@ (snapFlags & libvirt.VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE == libvirt.VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE)}
+ def tuneCpu(self, tuneParams): + try: + self._dom.setSchedulerParameters(tuneParams) + self.conf['cpu_shares'] = tuneParams.get('cpu_shares') + self.conf['vcpu_quota'] = tuneParams.get('vcpu_quota') + self.conf['vcpu_period'] = tuneParams.get('vcpu_period') + self.saveState() + return {'status': doneCode} + except libvirt.libvirtError, e: + self.log.error("TuneCpu failed:%s", + e.message, exc_info=True) + return errCode['tunecpuErr'] + except LookupError: + self.log.error('TuneCpu failed: unrecongnized params', + exc_info=True) + return errCode['tunecpuErr'] + def _runMerge(self): for mergeStatus in self.conf.get('liveMerge', []): if mergeStatus['status'] != MERGESTATUS.NOT_STARTED: diff --git a/vdsm/storage/misc.py b/vdsm/storage/misc.py index 161726b..1f5ed1a 100644 --- a/vdsm/storage/misc.py +++ b/vdsm/storage/misc.py @@ -503,6 +503,13 @@ return n
+def validateFloat(floatNumber, name): + try: + return float(floatNumber) + except: + raise se.InvalidParameterException(floatNumber, name) + + def rotateFiles(directory, prefixName, gen, cp=False, persist=False): log.debug("dir: %s, prefixName: %s, versions: %s" % (directory, prefixName, gen)) diff --git a/vdsm_cli/vdsClient.py b/vdsm_cli/vdsClient.py index a164c20..ab0fa4c 100644 --- a/vdsm_cli/vdsClient.py +++ b/vdsm_cli/vdsClient.py @@ -204,6 +204,18 @@
return self.ExecAndExit(self.s.create(params))
+ def tuneCpu(self, args): + params = {} + confLines = [] + params['vmId'] = args[0] + if len(args) > 1: + confLines.extend(args[1:]) + for line in confLines: + if '=' in line: + param, value = line.split("=", 1) + params[param] = value + return self.ExecAndExit(self.s.tuneCpu(params)) + def hotplugNic(self, args): nic = self._parseDriveSpec(args[1]) nic['type'] = 'interface' @@ -1802,6 +1814,18 @@ 'Optional additional parameters in dictionary format,' ' name:value,name:value' )), + 'tuneCpu': (serv.tuneCpu, + ('<vmId>' + '[max_proportion=value relative_share=value]', + 'Parameters list: r=required, o=optional', + 'r vmId: The vm to be tuned', + 'o max_proportion=<value>: ' + 'max proportion for each vCPU can be consumed, ' + '-1 is no limit,[0.001,1] is valid proportion', + 'o relative_share=<value>:relative share of CPU' + 'compared with other VMs', + 'Dynamically tune cpu absolute max proportion and relative share' + )), 'migrate': (serv.do_migrate, ('vmId=<id> method=<offline|online> src=host:[port] ' 'dst=host:[port]',
-- To view, visit http://gerrit.ovirt.org/7492 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange Gerrit-Change-Id: I09e02e09ef06ad6de45be75c3f2f913a3025750f Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com
oVirt Jenkins CI Server has posted comments on this change.
Change subject: add verb for vdsm to tuneCpu params ......................................................................
Patch Set 2:
Build Successful
http://jenkins.ovirt.info/job/patch_vdsm_unit_tests/681/ : SUCCESS
-- To view, visit http://gerrit.ovirt.org/7492 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I09e02e09ef06ad6de45be75c3f2f913a3025750f Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: add verb for vdsm to tuneCpu params ......................................................................
Patch Set 3:
Build Successful
http://jenkins.ovirt.info/job/patch_vdsm_unit_tests/682/ : SUCCESS
-- To view, visit http://gerrit.ovirt.org/7492 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I09e02e09ef06ad6de45be75c3f2f913a3025750f Gerrit-PatchSet: 3 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Doron Fediuck has posted comments on this change.
Change subject: add verb for vdsm to tuneCpu params ......................................................................
Patch Set 3:
Hi Royce,
Thanks for a very interesting work. However, I'm afraid I'm missing a design, before we rush into the implementation.
ie- why did you choose to implement capping via proportions? I'm not saying it's wrong, but I'm looking for the reasoning as well as interaction with other libvirt settings.
Implementation wise, why did you choose tuneParams['vcpu_period'] = 1000000 ? Which problem does it solve?
I believe we should add emulator_quota and period as well to make sure we can control non-vcpu threads as well.
Please use http://wiki.ovirt.org/wiki/Sla/cpu-and-memory to share your thoughts, so we get the bigger picture.
-- To view, visit http://gerrit.ovirt.org/7492 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I09e02e09ef06ad6de45be75c3f2f913a3025750f Gerrit-PatchSet: 3 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Adam Litke agl@us.ibm.com Gerrit-Reviewer: Doron Fediuck dfediuck@redhat.com Gerrit-Reviewer: Laszlo Hornyak lhornyak@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Zhu Bo bozhu@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: add verb for vdsm to tuneCpu params ......................................................................
Patch Set 4:
Build Successful
http://jenkins.ovirt.info/job/patch_vdsm_unit_tests/712/ : SUCCESS
-- To view, visit http://gerrit.ovirt.org/7492 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I09e02e09ef06ad6de45be75c3f2f913a3025750f Gerrit-PatchSet: 4 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Adam Litke agl@us.ibm.com Gerrit-Reviewer: Doron Fediuck dfediuck@redhat.com Gerrit-Reviewer: Laszlo Hornyak lhornyak@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Zhu Bo bozhu@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Doron Fediuck has posted comments on this change.
Change subject: add verb for vdsm to tuneCpu params ......................................................................
Patch Set 4:
Hi Royce, any comments on my previous remark?
-- To view, visit http://gerrit.ovirt.org/7492 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I09e02e09ef06ad6de45be75c3f2f913a3025750f Gerrit-PatchSet: 4 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Adam Litke agl@us.ibm.com Gerrit-Reviewer: Doron Fediuck dfediuck@redhat.com Gerrit-Reviewer: Laszlo Hornyak lhornyak@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Ryan Harper ryanh@us.ibm.com Gerrit-Reviewer: Zhu Bo bozhu@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Royce Lv has posted comments on this change.
Change subject: add verb for vdsm to tuneCpu params ......................................................................
Patch Set 4:
Doron,Thank you for your review, I just got my wiki account, I will update my consideration immediately
-- To view, visit http://gerrit.ovirt.org/7492 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I09e02e09ef06ad6de45be75c3f2f913a3025750f Gerrit-PatchSet: 4 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Adam Litke agl@us.ibm.com Gerrit-Reviewer: Doron Fediuck dfediuck@redhat.com Gerrit-Reviewer: Laszlo Hornyak lhornyak@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Ryan Harper ryanh@us.ibm.com Gerrit-Reviewer: Zhu Bo bozhu@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Adam Litke has posted comments on this change.
Change subject: add verb for vdsm to tuneCpu params ......................................................................
Patch Set 5: (6 inline comments)
Pretty close! Just a few minor things to change.
.................................................... File vdsm/API.py Line 560: try: Line 561: v = self._cif.vmContainer[self._UUID] Line 562: for key in tuneParams: Line 563: tuneParams[key] = storage.misc.validateInt(tuneParams[key], key) Line 564: except KeyError: This catch of KeyError only applies to the v=self._cif.vmContainer ... call. You should place the for key in tuneParams loop in a separate try block that only catches se.InvalidParameterExeption. Line 565: return errCode['noVM'] Line 566: except se.InvalidParameterException: Line 567: return errCode['tunecpuErr'] Line 568: return v.tuneCpu(tuneParams)
.................................................... File vdsm_api/vdsmapi-schema.json Line 5071: ## Line 5072: ## @vcpu_period: the enforcement period of vcpu_quota Line 5073: ## Line 5074: ## @vcpu_quota: max bandwidth vCPU can consume Line 5075: ## In the next patch series, please align the all descriptions at the same level: Line 5076: ## @emulator_quota: max bandwidth of the emulator thread Line 5077: ## Line 5078: ## @emulator_period: the enforcement period of emulator_period Line 5079: ###
.................................................... File vdsm_cli/vdsClient.py Line 205: return self.ExecAndExit(self.s.create(params)) Line 206: Line 207: def tuneCpu(self, args): Line 208: params = {} Line 209: confLines = [] Why do you need confLines? Line 210: params['vmId'] = args[0] Line 211: if len(args) > 1: Line 212: confLines.extend(args[1:]) Line 213: for line in confLines:
Line 209: confLines = [] Line 210: params['vmId'] = args[0] Line 211: if len(args) > 1: Line 212: confLines.extend(args[1:]) Line 213: for line in confLines: for param in args[1:]: Line 214: if '=' in line: Line 215: param, value = line.split("=", 1) Line 216: params[param] = value Line 217: return self.ExecAndExit(self.s.tuneCpu(params))
Line 210: params['vmId'] = args[0] Line 211: if len(args) > 1: Line 212: confLines.extend(args[1:]) Line 213: for line in confLines: Line 214: if '=' in line: line is not a great name for this variable. We expect it to be a <key>=<val> parameter so how about 'param' ? Line 215: param, value = line.split("=", 1) Line 216: params[param] = value Line 217: return self.ExecAndExit(self.s.tuneCpu(params)) Line 218:
Line 211: if len(args) > 1: Line 212: confLines.extend(args[1:]) Line 213: for line in confLines: Line 214: if '=' in line: Line 215: param, value = line.split("=", 1) var, value = param.split("=", 1) Line 216: params[param] = value Line 217: return self.ExecAndExit(self.s.tuneCpu(params)) Line 218: Line 219: def hotplugNic(self, args):
-- To view, visit http://gerrit.ovirt.org/7492 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I09e02e09ef06ad6de45be75c3f2f913a3025750f Gerrit-PatchSet: 5 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Adam Litke agl@us.ibm.com Gerrit-Reviewer: Doron Fediuck dfediuck@redhat.com Gerrit-Reviewer: Laszlo Hornyak lhornyak@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Ryan Harper ryanh@us.ibm.com Gerrit-Reviewer: Zhu Bo bozhu@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Mark Wu has posted comments on this change.
Change subject: add verb for vdsm to tuneCpu params ......................................................................
Patch Set 6: I would prefer that you didn't submit this
(3 inline comments)
.................................................... File vdsm/libvirtvm.py Line 1322: self.conf['pauseCode'] = self._initTimePauseCode Line 1323: if self._initTimePauseCode == 'ENOSPC': Line 1324: self.cont() Line 1325: self.conf['pid'] = self._getPid() Line 1326: #do not trying to change cpu_shares for recovery and restore flows # do not try to change cpu_shares for recovery and restore flows Line 1327: if not 'recover' in self.conf and not 'restoreState' in self.conf: Line 1328: nice = int(self.conf.get('nice', '0')) Line 1329: nice = max(min(nice, 19), 0) Line 1330: cpuShare = (20 - nice) * 51
Line 1894: def tuneCpu(self, tuneParams): Line 1895: try: Line 1896: self._dom.setSchedulerParameters(tuneParams) Line 1897: for param in tuneParams: Line 1898: self.conf[param] = tuneParams[param] How about putting the parameters into a new dict, not the top-level dict, like this: self.conf['cpuTune'][param] = tuneParams[param] Line 1899: self.saveState() Line 1900: return {'status': doneCode} Line 1901: except libvirt.libvirtError, e: Line 1902: self.log.error("TuneCpu failed:%s",
Line 1901: except libvirt.libvirtError, e: Line 1902: self.log.error("TuneCpu failed:%s", Line 1903: e.message, exc_info=True) Line 1904: return errCode['tunecpuErr'] Line 1905: except LookupError: Which code raise LookupError? Line 1906: self.log.error('TuneCpu failed: unrecongnized params', Line 1907: exc_info=True) Line 1908: return errCode['tunecpuErr'] Line 1909:
-- To view, visit http://gerrit.ovirt.org/7492 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I09e02e09ef06ad6de45be75c3f2f913a3025750f Gerrit-PatchSet: 6 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Adam Litke agl@us.ibm.com Gerrit-Reviewer: Doron Fediuck dfediuck@redhat.com Gerrit-Reviewer: Laszlo Hornyak lhornyak@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Ryan Harper ryanh@us.ibm.com Gerrit-Reviewer: Zhu Bo bozhu@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
ShaoHe Feng has posted comments on this change.
Change subject: add verb for vdsm to tuneCpu params ......................................................................
Patch Set 6: I would prefer that you didn't submit this
(1 inline comment)
.................................................... File vdsm_cli/vdsClient.py Line 210: if len(args) > 1: Line 211: for param in args[1:]: Line 212: if '=' in param: Line 213: key, value = param.split("=", 1) Line 214: params[key] = value what about no "=" in param? can _eqSplit be here? Line 215: return self.ExecAndExit(self.s.tuneCpu(params)) Line 216: Line 217: def hotplugNic(self, args): Line 218: nic = self._parseDriveSpec(args[1])
-- To view, visit http://gerrit.ovirt.org/7492 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I09e02e09ef06ad6de45be75c3f2f913a3025750f Gerrit-PatchSet: 6 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Adam Litke agl@us.ibm.com Gerrit-Reviewer: Doron Fediuck dfediuck@redhat.com Gerrit-Reviewer: Laszlo Hornyak lhornyak@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Ryan Harper ryanh@us.ibm.com Gerrit-Reviewer: ShaoHe Feng shaohef@linux.vnet.ibm.com Gerrit-Reviewer: Zhu Bo bozhu@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Royce Lv has posted comments on this change.
Change subject: add verb for vdsm to tuneCpu params ......................................................................
Patch Set 6: (4 inline comments)
.................................................... File vdsm_cli/vdsClient.py Line 210: if len(args) > 1: Line 211: for param in args[1:]: Line 212: if '=' in param: Line 213: key, value = param.split("=", 1) Line 214: params[key] = value Done Line 215: return self.ExecAndExit(self.s.tuneCpu(params)) Line 216: Line 217: def hotplugNic(self, args): Line 218: nic = self._parseDriveSpec(args[1])
.................................................... File vdsm/libvirtvm.py Line 1322: self.conf['pauseCode'] = self._initTimePauseCode Line 1323: if self._initTimePauseCode == 'ENOSPC': Line 1324: self.cont() Line 1325: self.conf['pid'] = self._getPid() Line 1326: #do not trying to change cpu_shares for recovery and restore flows Done Line 1327: if not 'recover' in self.conf and not 'restoreState' in self.conf: Line 1328: nice = int(self.conf.get('nice', '0')) Line 1329: nice = max(min(nice, 19), 0) Line 1330: cpuShare = (20 - nice) * 51
Line 1894: def tuneCpu(self, tuneParams): Line 1895: try: Line 1896: self._dom.setSchedulerParameters(tuneParams) Line 1897: for param in tuneParams: Line 1898: self.conf[param] = tuneParams[param] That's a good idea, thanks, Mark Line 1899: self.saveState() Line 1900: return {'status': doneCode} Line 1901: except libvirt.libvirtError, e: Line 1902: self.log.error("TuneCpu failed:%s",
Line 1901: except libvirt.libvirtError, e: Line 1902: self.log.error("TuneCpu failed:%s", Line 1903: e.message, exc_info=True) Line 1904: return errCode['tunecpuErr'] Line 1905: except LookupError: A piece of unclean code left by v1, thanks! Line 1906: self.log.error('TuneCpu failed: unrecongnized params', Line 1907: exc_info=True) Line 1908: return errCode['tunecpuErr'] Line 1909:
-- To view, visit http://gerrit.ovirt.org/7492 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I09e02e09ef06ad6de45be75c3f2f913a3025750f Gerrit-PatchSet: 6 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Adam Litke agl@us.ibm.com Gerrit-Reviewer: Doron Fediuck dfediuck@redhat.com Gerrit-Reviewer: Laszlo Hornyak lhornyak@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Ryan Harper ryanh@us.ibm.com Gerrit-Reviewer: ShaoHe Feng shaohef@linux.vnet.ibm.com Gerrit-Reviewer: Zhu Bo bozhu@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Royce Lv has posted comments on this change.
Change subject: add verb for vdsm to tuneCpu params ......................................................................
Patch Set 6: (1 inline comment)
.................................................... File vdsm/libvirtvm.py Line 1894: def tuneCpu(self, tuneParams): Line 1895: try: Line 1896: self._dom.setSchedulerParameters(tuneParams) Line 1897: for param in tuneParams: Line 1898: self.conf[param] = tuneParams[param] Sorry for noise, when libvirt recieve empty parameter in "setSchedulerParameters " it will raise LookupError. Line 1899: self.saveState() Line 1900: return {'status': doneCode} Line 1901: except libvirt.libvirtError, e: Line 1902: self.log.error("TuneCpu failed:%s",
-- To view, visit http://gerrit.ovirt.org/7492 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I09e02e09ef06ad6de45be75c3f2f913a3025750f Gerrit-PatchSet: 6 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Adam Litke agl@us.ibm.com Gerrit-Reviewer: Doron Fediuck dfediuck@redhat.com Gerrit-Reviewer: Laszlo Hornyak lhornyak@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Ryan Harper ryanh@us.ibm.com Gerrit-Reviewer: ShaoHe Feng shaohef@linux.vnet.ibm.com Gerrit-Reviewer: Zhu Bo bozhu@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Mark Wu has posted comments on this change.
Change subject: add verb for vdsm to tuneCpu params ......................................................................
Patch Set 7: I would prefer that you didn't submit this
(5 inline comments)
.................................................... File vdsm_api/vdsmapi-schema.json Line 5111: # @vcpu_quota: Max bandwidth vCPU can consume Line 5112: # Line 5113: # @emulator_quota: Max bandwidth of the emulator thread Line 5114: # Line 5115: # @emulator_period: The enforcement period of emulator_period Should be "The enforcement period of emulator_quota", right? Line 5116: # Line 5117: # Since: 4.10.0 Line 5118: ## Line 5119: {'type': 'TuneCpuParams',
Line 5124: # @VM.tuneCpu: Line 5125: # Line 5126: # Tune cpu absolute max proportion and relative share. Line 5127: # Line 5128: # @TuneCpuParams: Tunning parameters for vCPU I think vCPU is not accurate here, because it also covers emulator thread. So how about just 'Tunning parameters for guest CPU usage' Line 5129: # Line 5130: # Since: 4.10.0 Line 5131: ## Line 5132: {'command': {'class': 'VM', 'name': 'tuneCpu'},
.................................................... File vdsm/libvirtvm.py Line 1331: try: Line 1332: self._dom.setSchedulerParameters({'cpu_shares': cpuShare}) Line 1333: except: Line 1334: self.log.warning('failed to set Vm niceness', exc_info=True) Line 1335: self.conf['cpu_shares'] = cpuShare Since you add a new dict conf['cpuTune'], you should put the value in the dict. And the change on vm.conf will change the return of getVmStats(), so you need update schema for it. Line 1336: self.saveState() Line 1337: Line 1338: def _run(self): Line 1339: self.log.info("VM wrapper has started")
Line 1902: e.message, exc_info=True) Line 1903: return errCode['tunecpuErr'] Line 1904: except LookupError: Line 1905: self.log.error('TuneCpu failed: unrecongnized params', Line 1906: exc_info=True) if the exception is caused by an unknown parameter, it's better to log the parameters together. Line 1907: return errCode['tunecpuErr'] Line 1908: Line 1909: def _runMerge(self): Line 1910: for mergeStatus in self.conf.get('liveMerge', []):
Line 1904: except LookupError: Line 1905: self.log.error('TuneCpu failed: unrecongnized params', Line 1906: exc_info=True) Line 1907: return errCode['tunecpuErr'] Line 1908: Merge this line with line 1903? Line 1909: def _runMerge(self): Line 1910: for mergeStatus in self.conf.get('liveMerge', []): Line 1911: if mergeStatus['status'] != MERGESTATUS.NOT_STARTED: Line 1912: continue
-- To view, visit http://gerrit.ovirt.org/7492 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I09e02e09ef06ad6de45be75c3f2f913a3025750f Gerrit-PatchSet: 7 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Adam Litke agl@us.ibm.com Gerrit-Reviewer: Doron Fediuck dfediuck@redhat.com Gerrit-Reviewer: Laszlo Hornyak lhornyak@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Ryan Harper ryanh@us.ibm.com Gerrit-Reviewer: ShaoHe Feng shaohef@linux.vnet.ibm.com Gerrit-Reviewer: Zhu Bo bozhu@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Royce Lv has posted comments on this change.
Change subject: add verb for vdsm to tuneCpu params ......................................................................
Patch Set 7: (4 inline comments)
.................................................... File vdsm_api/vdsmapi-schema.json Line 5111: # @vcpu_quota: Max bandwidth vCPU can consume Line 5112: # Line 5113: # @emulator_quota: Max bandwidth of the emulator thread Line 5114: # Line 5115: # @emulator_period: The enforcement period of emulator_period Done Line 5116: # Line 5117: # Since: 4.10.0 Line 5118: ## Line 5119: {'type': 'TuneCpuParams',
Line 5124: # @VM.tuneCpu: Line 5125: # Line 5126: # Tune cpu absolute max proportion and relative share. Line 5127: # Line 5128: # @TuneCpuParams: Tunning parameters for vCPU Done Line 5129: # Line 5130: # Since: 4.10.0 Line 5131: ## Line 5132: {'command': {'class': 'VM', 'name': 'tuneCpu'},
.................................................... File vdsm/libvirtvm.py Line 1331: try: Line 1332: self._dom.setSchedulerParameters({'cpu_shares': cpuShare}) Line 1333: except: Line 1334: self.log.warning('failed to set Vm niceness', exc_info=True) Line 1335: self.conf['cpu_shares'] = cpuShare Done Line 1336: self.saveState() Line 1337: Line 1338: def _run(self): Line 1339: self.log.info("VM wrapper has started")
Line 1904: except LookupError: Line 1905: self.log.error('TuneCpu failed: unrecongnized params', Line 1906: exc_info=True) Line 1907: return errCode['tunecpuErr'] Line 1908: Done Line 1909: def _runMerge(self): Line 1910: for mergeStatus in self.conf.get('liveMerge', []): Line 1911: if mergeStatus['status'] != MERGESTATUS.NOT_STARTED: Line 1912: continue
-- To view, visit http://gerrit.ovirt.org/7492 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I09e02e09ef06ad6de45be75c3f2f913a3025750f Gerrit-PatchSet: 7 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Adam Litke agl@us.ibm.com Gerrit-Reviewer: Doron Fediuck dfediuck@redhat.com Gerrit-Reviewer: Laszlo Hornyak lhornyak@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Ryan Harper ryanh@us.ibm.com Gerrit-Reviewer: ShaoHe Feng shaohef@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Adam Litke has posted comments on this change.
Change subject: add verb for vdsm to tuneCpu params ......................................................................
Patch Set 8: Looks good to me, but someone else must approve
-- To view, visit http://gerrit.ovirt.org/7492 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I09e02e09ef06ad6de45be75c3f2f913a3025750f Gerrit-PatchSet: 8 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Adam Litke agl@us.ibm.com Gerrit-Reviewer: Doron Fediuck dfediuck@redhat.com Gerrit-Reviewer: Laszlo Hornyak lhornyak@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Ryan Harper ryanh@us.ibm.com Gerrit-Reviewer: ShaoHe Feng shaohef@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Itamar Heim has posted comments on this change.
Change subject: add verb for vdsm to tuneCpu params ......................................................................
Patch Set 8:
ping?
Itamar Heim has posted comments on this change.
Change subject: add verb for vdsm to tuneCpu params ......................................................................
Patch Set 8:
no comment - should this be abandoned?
Adam Litke has posted comments on this change.
Change subject: add verb for vdsm to tuneCpu params ......................................................................
Patch Set 8: Code-Review-1
Yes, I would say this has been abandoned since the last update from the submitter was over a year ago.
Itamar Heim has abandoned this change.
Change subject: add verb for vdsm to tuneCpu params ......................................................................
Abandoned
feel free to re-open if/when relevant
vdsm-patches@lists.fedorahosted.org