Change in vdsm[master]: vm: add a method to update the devices config

fromani at redhat.com fromani at redhat.com
Wed May 7 08:11:38 UTC 2014


Francesco Romani has uploaded a new change for review.

Change subject: vm: add a method to update the devices config
......................................................................

vm: add a method to update the devices config

As part of all creation flows except the recovery one,
a Vm needs to amend the configuration of the devices
and update its own configuration accordingly.

This patch extracts the code which updates the
Vm.conf devices data and puts it into a separate
method to make the code a bit more clear.

Change-Id: I04dab67c60c51a381b61410bac8c87f5e29809d1
Signed-off-by: Francesco Romani <fromani at redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 13 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/43/27443/1

diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 605a8a3..428eb4f 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -2801,14 +2801,7 @@
         if not self.recovering:
             self.preparePaths(devices[DISK_DEVICES])
             self._prepareTransientDisks(devices[DISK_DEVICES])
-            # Update self.conf with updated devices
-            # For old type vmParams, new 'devices' key will be
-            # created with all devices info
-            newDevices = []
-            for dev in devices.values():
-                newDevices.extend(dev)
-
-            self.conf['devices'] = newDevices
+            self._updateDevices(devices)
             # We need to save conf here before we actually run VM.
             # It's not enough to save conf only on status changes as we did
             # before, because if vdsm will restarted between VM run and conf
@@ -2879,6 +2872,18 @@
             return
         self._domDependentInit()
 
+    def _updateDevices(self, devices):
+        """
+        Update self.conf with updated devices
+        For old type vmParams, new 'devices' key will be
+        created with all devices info
+        """
+        newDevices = []
+        for dev in devices.values():
+            newDevices.extend(dev)
+
+        self.conf['devices'] = newDevices
+
     def _correctDiskVolumes(self, srcDomXML):
         """
         Replace each volume in the given XML with the latest volume


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I04dab67c60c51a381b61410bac8c87f5e29809d1
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>


More information about the vdsm-patches mailing list