Change in vdsm[master]: virt: Make Vm.devSpecMapFromConf() private

mzamazal at redhat.com mzamazal at redhat.com
Fri Feb 19 13:36:08 UTC 2016


Milan Zamazal has uploaded a new change for review.

Change subject: virt: Make Vm.devSpecMapFromConf() private
......................................................................

virt: Make Vm.devSpecMapFromConf() private

There is currently no reason to expose the method outside Vm.
Actually we are going to move device processing out of Vm and thus
isolating the use of this method is a preparation step for that.

Change-Id: I6dffb82bde715453ff4ae3eae3b82b4890f04f8b
Signed-off-by: Milan Zamazal <mzamazal at redhat.com>
---
M tests/deviceTests.py
M tests/vmTests.py
M tests/vmfakelib.py
M vdsm/virt/vm.py
4 files changed, 11 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/83/53483/4

diff --git a/tests/deviceTests.py b/tests/deviceTests.py
index 8f0bac9..1cb2b3c 100644
--- a/tests/deviceTests.py
+++ b/tests/deviceTests.py
@@ -125,18 +125,18 @@
         for conf in self.confDisplay:
             conf.update(self.conf)
             with fake.VM(conf) as testvm:
-                devs = testvm.devSpecMapFromConf()
+                devs = testvm._devSpecMapFromConf()
                 self.assertTrue(devs['graphics'])
 
     def testGraphicsDevice(self):
         for dev in self.confDeviceGraphics:
             with fake.VM(self.conf, dev) as testvm:
-                devs = testvm.devSpecMapFromConf()
+                devs = testvm._devSpecMapFromConf()
                 self.assertTrue(devs['graphics'])
 
     def testGraphicDeviceHeadless(self):
         with fake.VM(self.conf) as testvm:
-            devs = testvm.devSpecMapFromConf()
+            devs = testvm._devSpecMapFromConf()
             self.assertFalse(devs['graphics'])
 
     def testGraphicsDeviceMixed(self):
@@ -148,7 +148,7 @@
             conf.update(self.conf)
             for dev in self.confDeviceGraphics:
                 with fake.VM(self.conf, dev) as testvm:
-                    devs = testvm.devSpecMapFromConf()
+                    devs = testvm._devSpecMapFromConf()
                     self.assertEqual(len(devs['graphics']), 1)
                     self.assertEqual(devs['graphics'][0]['device'],
                                      dev[0]['device'])
@@ -199,7 +199,7 @@
         devices = [{'type': 'graphics', 'device': primary},
                    {'type': 'graphics', 'device': secondary}]
         with fake.VM(self.conf, devices) as testvm:
-            devs = testvm.devSpecMapFromConf()
+            devs = testvm._devSpecMapFromConf()
             self.assertTrue(len(devs['graphics']) == 2)
 
     @permutations([['vnc'], ['spice']])
@@ -207,7 +207,7 @@
         devices = [{'type': 'graphics', 'device': devType},
                    {'type': 'graphics', 'device': devType}]
         with fake.VM(self.conf, devices) as testvm:
-            self.assertRaises(ValueError, testvm.devSpecMapFromConf)
+            self.assertRaises(ValueError, testvm._devSpecMapFromConf)
 
     def testSmartcardXML(self):
         smartcardXML = '<smartcard mode="passthrough" type="spicevmc"/>'
diff --git a/tests/vmTests.py b/tests/vmTests.py
index fd582b6..f7100be 100644
--- a/tests/vmTests.py
+++ b/tests/vmTests.py
@@ -1227,7 +1227,7 @@
                    {'type': 'graphics', 'device': 'vnc', 'port': '-1'}]
 
         with fake.VM(_VM_PARAMS, devices) as testvm:
-            testvm._updateDevices(testvm.devSpecMapFromConf())
+            testvm._updateDevices(testvm._devSpecMapFromConf())
             res = testvm.getStats()
             self.assertIn('displayPort', res)
             self.assertEqual(res['displayType'],
diff --git a/tests/vmfakelib.py b/tests/vmfakelib.py
index 046012a..35a96c0 100644
--- a/tests/vmfakelib.py
+++ b/tests/vmfakelib.py
@@ -342,7 +342,7 @@
             fake.conf['devices'] = [] if devices is None else devices
             if create_device_objects:
                 fake._devices = fake.devMapFromDevSpecMap(
-                    fake.devSpecMapFromConf())
+                    fake._devSpecMapFromConf())
             fake._guestCpuRunning = runCpu
             if status is not None:
                 fake._lastStatus = status
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 7b0c168..5c77007 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -417,7 +417,7 @@
 
         return dev_map
 
-    def devSpecMapFromConf(self):
+    def _devSpecMapFromConf(self):
         """
         Return the "devices" section of this Vm's conf.
         If missing, create it according to old API.
@@ -745,7 +745,7 @@
         return self._volumesPrepared
 
     def preparePaths(self):
-        drives = self.devSpecMapFromConf()[hwclass.DISK]
+        drives = self._devSpecMapFromConf()[hwclass.DISK]
         self._preparePathsForDrives(drives)
 
     def _preparePathsForDrives(self, drives):
@@ -1821,7 +1821,7 @@
 
     def _run(self):
         self.log.info("VM wrapper has started")
-        dev_spec_map = self.devSpecMapFromConf()
+        dev_spec_map = self._devSpecMapFromConf()
 
         # recovery flow note:
         # we do not start disk stats collection here since


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6dffb82bde715453ff4ae3eae3b82b4890f04f8b
Gerrit-PatchSet: 4
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Milan Zamazal <mzamazal at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>


More information about the vdsm-patches mailing list