Change in vdsm[master]: virt: Don't use Vm device configuration in clientIF

mzamazal at redhat.com mzamazal at redhat.com
Fri Feb 19 13:35:04 UTC 2016


Milan Zamazal has uploaded a new change for review.

Change subject: virt: Don't use Vm device configuration in clientIF
......................................................................

virt: Don't use Vm device configuration in clientIF

clientIF retrieves device configuration from Vm.devSpecMapFromConf() in
order to pass it to Vm.preparePaths().  This is unnecessary exposition
of device handling configuration to clientIF as Vm can get the
information from itself.  Not only it's not clientIF business to care
about those details, we'd also like to make them isolated in Vm and make
Vm.devSpecMapFromConf() private in a followup patch.

This is a preparation step for moving device configuration processing
from Vm to device classes.

For those reasons we retrieve configuration in Vm.preparePaths() from
its instance directly.

Change-Id: Idd0f7c99b4df18d27dfad36bf2275540bc8b958c
Signed-off-by: Milan Zamazal <mzamazal at redhat.com>
---
M vdsm/clientIF.py
M vdsm/virt/vm.py
2 files changed, 7 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/82/53482/4

diff --git a/vdsm/clientIF.py b/vdsm/clientIF.py
index 0d1e235..9b91d6c 100644
--- a/vdsm/clientIF.py
+++ b/vdsm/clientIF.py
@@ -566,8 +566,7 @@
                     self.log.info(
                         'recovery [%d/%d]: preparing paths for'
                         ' domain %s',  idx+1, num_vm_objects, vm_obj.id)
-                    vm_obj.preparePaths(
-                        vm_obj.devSpecMapFromConf()[hwclass.DISK])
+                    vm_obj.preparePaths()
             except:
                 self.log.exception(
                     "recovery [%d/%d]: failed for vm %s",
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index df58d1b..7b0c168 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -744,7 +744,11 @@
     def isDisksStatsCollectionEnabled(self):
         return self._volumesPrepared
 
-    def preparePaths(self, drives):
+    def preparePaths(self):
+        drives = self.devSpecMapFromConf()[hwclass.DISK]
+        self._preparePathsForDrives(drives)
+
+    def _preparePathsForDrives(self, drives):
         for drive in drives:
             with self._volPrepareLock:
                 if self._destroyed:
@@ -1825,7 +1829,7 @@
         # Disk stats collection is started from clientIF at the end
         # of the recovery process.
         if not self.recovering:
-            self.preparePaths(dev_spec_map[hwclass.DISK])
+            self._preparePathsForDrives(dev_spec_map[hwclass.DISK])
             self._prepareTransientDisks(dev_spec_map[hwclass.DISK])
             self._updateDevices(dev_spec_map)
             # We need to save conf here before we actually run VM.


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idd0f7c99b4df18d27dfad36bf2275540bc8b958c
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: Milan Zamazal <mzamazal at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>


More information about the vdsm-patches mailing list