Royce Lv has uploaded a new change for review. Change subject: [WIP]add createVm support of cputune ......................................................................
[WIP]add createVm support of cputune allow engine to pass other cputune params through vm create, createVm now uses nice to config vm share value, this patch uses 'shares' in vmdef directly (1024 by default) Change-Id: I76e9b9d291d4801965163774ba45d15b39a77471 Signed-off-by: Royce Lv<[email protected]> --- M vdsm/libvirtvm.py 1 file changed, 13 insertions(+), 11 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/45/8445/1 diff --git a/vdsm/libvirtvm.py b/vdsm/libvirtvm.py index fd80c69..9b38a36 100644 --- a/vdsm/libvirtvm.py +++ b/vdsm/libvirtvm.py @@ -737,10 +737,13 @@ self.dom.appendChild(cpu) def appendTunable(self): - #CPU-pinning support - # see http://www.ovirt.org/wiki/Features/Design/cpu-pinning + cputune = self.doc.createElement('cputune') + cputuneParams = {'shares':1024} + if 'cputune' in self.conf: + cputuneParam = self.conf['cputune'] if 'cpuPinning' in self.conf: - cputune = self.doc.createElement('cputune') + #CPU-pinning support + # see http://www.ovirt.org/wiki/Features/Design/cpu-pinning cpuPinning = self.conf.get('cpuPinning') try: emulatorset = cpuPinning.pop('emulator') @@ -754,7 +757,13 @@ vcpupin.setAttribute('vcpu', cpuPin) vcpupin.setAttribute('cpuset', cpuPinning[cpuPin]) cputune.appendChild(vcpupin) - self.dom.appendChild(cputune) + + for item in cputuneParams.keys(): + m = self.doc.createElement(item) + m.appendChild(self.doc.createTextNode(cputuneParams[item])) + cputune.appendChild(m) + + self.dom.appendChild(cputune) def _appendAgentDevice(self, path, name): """ @@ -1338,13 +1347,6 @@ 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) def _run(self): self.log.info("VM wrapper has started") -- To view, visit http://gerrit.ovirt.org/8445 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I76e9b9d291d4801965163774ba45d15b39a77471 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
