Martin Polednik has uploaded a new change for review.

Change subject: machinetype: update naming
......................................................................

machinetype: update naming

The old names of machinetype public functions were outdated,
non-pep8-compilant. New names work nice with module name and are pep8
compilant!

Change-Id: I5ce7596a1dbf0a565ba3665eda6e9b3a6fc3d56d
Signed-off-by: Martin Polednik <[email protected]>
---
M lib/vdsm/machinetype.py
M tests/capsTests.py
M vdsm/caps.py
3 files changed, 17 insertions(+), 17 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/98/54298/1

diff --git a/lib/vdsm/machinetype.py b/lib/vdsm/machinetype.py
index da33a96..7e31466 100644
--- a/lib/vdsm/machinetype.py
+++ b/lib/vdsm/machinetype.py
@@ -69,7 +69,7 @@
 
 
 @utils.memoized
-def getEmulatedMachines(arch, capabilities=None):
+def emulated_machines(arch, capabilities=None):
     if capabilities is None:
         capabilities = _get_libvirt_caps()
     caps = ET.fromstring(capabilities)
@@ -81,7 +81,7 @@
             _get_emulated_machines_from_arch(arch, caps))
 
 
-def getAllCpuModels(capfile=CPU_MAP_FILE, arch=None):
+def cpu_models(capfile=CPU_MAP_FILE, arch=None):
 
     with open(capfile) as xml:
         cpu_map = ET.fromstring(xml.read())
@@ -131,9 +131,9 @@
 
 
 @utils.memoized
-def getCompatibleCpuModels():
+def compatible_cpu_models():
     c = libvirtconnection.get()
-    allModels = getAllCpuModels()
+    allModels = cpu_models()
 
     def compatible(model, vendor):
         if not vendor:
diff --git a/tests/capsTests.py b/tests/capsTests.py
index 08667e2..1f43d34 100644
--- a/tests/capsTests.py
+++ b/tests/capsTests.py
@@ -106,8 +106,8 @@
 
     def testEmulatedMachines(self):
         capsData = self._readCaps("caps_libvirt_amd_6274.out")
-        machines = machinetype.getEmulatedMachines(cpuarch.X86_64,
-                                                   capsData)
+        machines = machinetype.emulated_machines(cpuarch.X86_64,
+                                                 capsData)
         expectedMachines = ['pc-1.0', 'pc', 'isapc', 'pc-0.12', 'pc-0.13',
                             'pc-0.10', 'pc-0.11', 'pc-0.14', 'pc-0.15']
         self.assertEqual(machines, expectedMachines)
@@ -227,8 +227,8 @@
         self.assertTrue(result)
 
     def test_getAllCpuModels(self):
-        result = machinetype.getAllCpuModels(capfile=self.CPU_MAP_FILE,
-                                             arch=cpuarch.X86_64)
+        result = machinetype.cpu_models(capfile=self.CPU_MAP_FILE,
+                                        arch=cpuarch.X86_64)
         expected = {
             'qemu32': None,
             'Haswell': 'Intel',
@@ -262,21 +262,21 @@
         self.assertEqual(expected, result)
 
     def test_getAllCpuModels_noArch(self):
-        result = machinetype.getAllCpuModels(capfile=self.CPU_MAP_FILE,
-                                             arch='non_existent_arch')
+        result = machinetype.cpu_models(capfile=self.CPU_MAP_FILE,
+                                        arch='non_existent_arch')
         self.assertEqual(dict(), result)
 
-    def test_getEmulatedMachines(self):
+    def test_get_emulated_machines(self):
         capsData = self._readCaps("caps_libvirt_intel_i73770_nosnap.out")
-        result = machinetype.getEmulatedMachines('x86_64', capsData)
+        result = machinetype.emulated_machines('x86_64', capsData)
         expected = ['rhel6.3.0', 'rhel6.1.0', 'rhel6.2.0', 'pc', 'rhel5.4.0',
                     'rhel5.4.4', 'rhel6.4.0', 'rhel6.0.0', 'rhel6.5.0',
                     'rhel5.5.0']
         self.assertEqual(expected, result)
 
-    def test_getEmulatedMachinesCanonical(self):
+    def test_get_emulated_machinesCanonical(self):
         capsData = self._readCaps("caps_libvirt_intel_E5606.out")
-        result = machinetype.getEmulatedMachines('x86_64', capsData)
+        result = machinetype.emulated_machines('x86_64', capsData)
         expected = ['pc-i440fx-rhel7.1.0',
                     'rhel6.3.0',
                     'pc-q35-rhel7.0.0',
@@ -292,9 +292,9 @@
                     'pc-i440fx-rhel7.0.0']
         self.assertEqual(expected, result)
 
-    def test_getEmulatedMachinesWithTwoQEMUInstalled(self):
+    def test_get_emulated_machinesWithTwoQEMUInstalled(self):
         capsData = self._readCaps("caps_libvirt_multiqemu.out")
-        result = machinetype.getEmulatedMachines('x86_64', capsData)
+        result = machinetype.emulated_machines('x86_64', capsData)
         expected = ['pc-i440fx-rhel7.1.0',
                     'rhel6.3.0',
                     'pc-q35-rhel7.0.0',
diff --git a/vdsm/caps.py b/vdsm/caps.py
index a5313c1..757d4b8 100644
--- a/vdsm/caps.py
+++ b/vdsm/caps.py
@@ -304,7 +304,7 @@
     caps['operatingSystem'] = osversion()
     caps['uuid'] = host.uuid()
     caps['packages2'] = _getKeyPackages()
-    caps['emulatedMachines'] = machinetype.getEmulatedMachines(
+    caps['emulatedMachines'] = machinetype.get_emulated_machines(
         cpuarch.effective())
     caps['ISCSIInitiatorName'] = _getIscsiIniName()
     caps['HBAInventory'] = storage.hba.HBAInventory()


-- 
To view, visit https://gerrit.ovirt.org/54298
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5ce7596a1dbf0a565ba3665eda6e9b3a6fc3d56d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to