Martin Sivák has uploaded a new change for review.
Change subject: Improve the _validateIoTuneParams so the params are passed as argument
......................................................................
Improve the _validateIoTuneParams so the params are passed as argument
Change-Id: I08e8bd5a25320f45501b35bb0c9cae507200eb8b
Signed-off-by: Martin Sivak <msivak(a)redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 7 insertions(+), 8 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/13/28713/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index a1b034f..b4d142e 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -1375,9 +1375,8 @@
return devname.get(self.iface, 'hd') + (devindex or 'a')
- def _checkIoTuneCategories(self):
+ def _checkIoTuneCategories(self, ioTuneParamsInfo):
categories = ("bytes", "iops")
- ioTuneParamsInfo = self.specParams['ioTune']
for category in categories:
if ioTuneParamsInfo.get('total_' + category + '_sec', 0) and
\
(ioTuneParamsInfo.get('read_' + category + '_sec', 0)
or
@@ -1386,15 +1385,15 @@
' read/write value for %s_sec can not be'
' set at the same time' % category)
- def _validateIoTuneParams(self):
+ def _validateIoTuneParams(self, params):
ioTuneParams = ('total_bytes_sec', 'read_bytes_sec',
'write_bytes_sec', 'total_iops_sec',
'write_iops_sec', 'read_iops_sec')
- for key, value in self.specParams['ioTune'].iteritems():
+ for key, value in params.iteritems():
try:
if key in ioTuneParams:
- self.specParams['ioTune'][key] = int(value)
- if self.specParams['ioTune'][key] >= 0:
+ params[key] = int(value)
+ if params[key] >= 0:
continue
else:
raise Exception('parameter %s name is invalid' % key)
@@ -1406,7 +1405,7 @@
raise ValueError('parameter %s value should be'
' equal or greater than zero' % key)
- self._checkIoTuneCategories()
+ self._checkIoTuneCategories(params)
def getLeasesXML(self):
"""
@@ -1514,7 +1513,7 @@
diskelem.appendChildWithArgs('driver', **driverAttrs)
if hasattr(self, 'specParams') and 'ioTune' in self.specParams:
- self._validateIoTuneParams()
+ self._validateIoTuneParams(self.specParams['ioTune'])
iotune = XMLElement('iotune')
for key, value in self.specParams['ioTune'].iteritems():
iotune.appendChildWithArgs(key, text=str(value))
--
To view, visit
http://gerrit.ovirt.org/28713
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I08e8bd5a25320f45501b35bb0c9cae507200eb8b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Sivák <msivak(a)redhat.com>