Hello Dan Kenigsberg,

I'd like you to do a code review.  Please visit

    http://gerrit.ovirt.org/30078

to review the following change.

Change subject: Change method names in vmtune.py to the PEP8 style
......................................................................

Change method names in vmtune.py to the PEP8 style

Change-Id: Ib5e9dcaf393ebafe56f6bc78cc9cb02d37a257ae
Signed-off-by: Martin Sivak <msi...@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/29929
Reviewed-by: Dan Kenigsberg <dan...@redhat.com>
---
M tests/vmTests.py
M vdsm/virt/vm.py
M vdsm/virt/vmtune.py
3 files changed, 25 insertions(+), 25 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/78/30078/1

diff --git a/tests/vmTests.py b/tests/vmTests.py
index 498aeac..999de1b 100644
--- a/tests/vmTests.py
+++ b/tests/vmTests.py
@@ -30,7 +30,7 @@
 
 from virt import vm
 from virt import vmexitreason
-from virt.vmtune import ioTuneMerge, ioTuneDomToValues, ioTuneToDom
+from virt.vmtune import io_tune_merge, io_tune_dom_to_values, io_tune_to_dom
 from vdsm import constants
 from vdsm import define
 from testrunner import VdsmTestCase as TestCaseBase
@@ -984,8 +984,8 @@
                 }
             }
 
-            dom = ioTuneToDom(ioTuneValues)
-            parsed = ioTuneDomToValues(dom)
+            dom = io_tune_to_dom(ioTuneValues)
+            parsed = io_tune_dom_to_values(dom)
 
             self.assertEqual(ioTuneValues, parsed)
 
@@ -1037,7 +1037,7 @@
                 }
             }
 
-            ioTuneMerged = ioTuneMerge(ioTuneValues1, ioTuneValues2)
+            ioTuneMerged = io_tune_merge(ioTuneValues1, ioTuneValues2)
 
             self.assertEqual(ioTuneMerged, ioTuneExpectedValues)
 
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 536c146..9581357 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -64,8 +64,8 @@
 from . import sampling
 from . import vmexitreason
 from . import vmstatus
-from .vmtune import updateIoTuneDom, collectInnerElements
-from .vmtune import ioTuneValuesToDom, ioTuneDomToValues
+from .vmtune import update_io_tune_dom, collect_inner_elements
+from .vmtune import io_tune_values_to_dom, io_tune_dom_to_values
 
 from .utils import XMLElement
 from vmpowerdown import VmShutdown, VmReboot
@@ -3689,7 +3689,7 @@
                 qos.appendChild(ioTuneElement)
                 metadata_modified = True
 
-            if updateIoTuneDom(ioTuneList[0], params["ioTune"]) > 0:
+            if update_io_tune_dom(ioTuneList[0], params["ioTune"]) > 0:
                 metadata_modified = True
 
             del params['ioTune']
@@ -3761,7 +3761,7 @@
             return []
 
         for device in ioTuneList[0].getElementsByTagName("device"):
-            tunables.append(ioTuneDomToValues(device))
+            tunables.append(io_tune_dom_to_values(device))
 
         return tunables
 
@@ -3784,7 +3784,7 @@
             io_dom_list = dom.getElementsByTagName("iotune")
             old_io_tune = {}
             if io_dom_list:
-                collectInnerElements(io_dom_list[0], old_io_tune)
+                collect_inner_elements(io_dom_list[0], old_io_tune)
                 old_io_tune.update(io_tune)
                 io_tune = old_io_tune
 
@@ -3813,7 +3813,7 @@
             if io_dom_list:
                 dom.removeChild(io_dom_list[0])
             io_dom = XMLElement("iotune")
-            ioTuneValuesToDom(io_tune, io_dom)
+            io_tune_values_to_dom(io_tune, io_dom)
             dom.appendChild(io_dom)
             found_device.specParams['ioTune'] = io_tune
 
diff --git a/vdsm/virt/vmtune.py b/vdsm/virt/vmtune.py
index 06558fe..ed5d575 100644
--- a/vdsm/virt/vmtune.py
+++ b/vdsm/virt/vmtune.py
@@ -27,7 +27,7 @@
 log = logging.getLogger(__name__)
 
 
-def ioTuneValuesToDom(values, dom):
+def io_tune_values_to_dom(values, dom):
     """
     Create a DOM representation of the passed iotune values and
     attach it to the dom object in the form of nodes.
@@ -46,7 +46,7 @@
             dom.appendChild(el)
 
 
-def collectInnerElements(el, d):
+def collect_inner_elements(el, d):
     """
     This helper method collects all nodes in el and adds them
     to dictionary d.
@@ -64,7 +64,7 @@
             log.exception("Invalid value for %s", chel.localName)
 
 
-def ioTuneDomToValues(dom):
+def io_tune_dom_to_values(dom):
     """
     This method converts the VmDiskDeviceTuneLimits structure from its
     XML representation to the dictionary representation.
@@ -83,18 +83,18 @@
     els = dom.getElementsByTagName("guaranteed")
     if els:
         values["guaranteed"] = {}
-        collectInnerElements(els[0], values["guaranteed"])
+        collect_inner_elements(els[0], values["guaranteed"])
 
     els = dom.getElementsByTagName("maximum")
     if els:
         values["maximum"] = {}
         for chel in els[0].childNodes:
-            collectInnerElements(els[0], values["maximum"])
+            collect_inner_elements(els[0], values["maximum"])
 
     return values
 
 
-def ioTuneToDom(tune):
+def io_tune_to_dom(tune):
     """
     This method converts the VmDiskDeviceTuneLimits structure from the
     dictionary representation to the XML representation.
@@ -113,17 +113,17 @@
     if "maximum" in tune:
         maximum = XMLElement("maximum")
         device.appendChild(maximum)
-        ioTuneValuesToDom(tune["maximum"], maximum)
+        io_tune_values_to_dom(tune["maximum"], maximum)
 
     if "guaranteed" in tune:
         guaranteed = XMLElement("guaranteed")
         device.appendChild(guaranteed)
-        ioTuneValuesToDom(tune["guaranteed"], guaranteed)
+        io_tune_values_to_dom(tune["guaranteed"], guaranteed)
 
     return device
 
 
-def ioTuneMerge(old, new):
+def io_tune_merge(old, new):
     """
     Merge two VmDiskDeviceTuneLimits structures in their dictionary form
     and return the new iotune setting.
@@ -152,7 +152,7 @@
     return result
 
 
-def createDeviceIndex(ioTune):
+def create_device_index(ioTune):
     """
     Create by name / by path dictionaries from the XML representation.
     Returns a tuple (by_name, by_path) where the items are the respective
@@ -176,7 +176,7 @@
     return ioTuneByName, ioTuneByPath
 
 
-def updateIoTuneDom(ioTune, tunables):
+def update_io_tune_dom(ioTune, tunables):
     """
     This method takes a list of VmDiskDeviceTuneLimits objects and applies
     the changes to the XML element representing the current iotune settings,
@@ -191,7 +191,7 @@
     count = 0
 
     # Get all existing ioTune records and create name/path index
-    ioTuneByName, ioTuneByPath = createDeviceIndex(ioTune)
+    ioTuneByName, ioTuneByPath = create_device_index(ioTune)
 
     for limit_object in tunables:
         old_tune = None
@@ -205,10 +205,10 @@
             ioTune.removeChild(old_tune)
 
         if old_tune is not None:
-            old_object = ioTuneDomToValues(old_tune)
-            limit_object = ioTuneMerge(old_object, limit_object)
+            old_object = io_tune_dom_to_values(old_tune)
+            limit_object = io_tune_merge(old_object, limit_object)
 
-        new_tune = ioTuneToDom(limit_object)
+        new_tune = io_tune_to_dom(limit_object)
         ioTune.appendChild(new_tune)
         count += 1
 


-- 
To view, visit http://gerrit.ovirt.org/30078
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib5e9dcaf393ebafe56f6bc78cc9cb02d37a257ae
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Martin Sivák <msi...@redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <dan...@redhat.com>
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to