Adam Litke has uploaded a new change for review.

Change subject: virt: Lookup conf and device by path
......................................................................

virt: Lookup conf and device by path

Live merge requires the ability to lookup a VmDevice and its associated
conf entry given a disk path.  Provide these helper methods.

Change-Id: Ib5f63715cd5142ffaf21ae9ba8d451175ae09be0
Signed-off-by: Adam Litke <ali...@redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 17 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/51/27951/1

diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index de27a53..326d70a 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -3075,6 +3075,23 @@
         raise LookupError('Configuration of device identified by alias %s not'
                           'found' % alias)
 
+    def _lookupDeviceByPath(self, path):
+        for dev in self._devices[DISK_DEVICES][:]:
+            try:
+                if dev.path == path:
+                    return dev
+            except AttributeError:
+                continue
+        raise LookupError('Device instance for device with path %s not found' %
+                          path)
+
+    def _lookupConfByPath(self, path):
+        for devConf in self.conf['devices'][:]:
+            if devConf.get('path') == path:
+                return devConf
+        raise LookupError('Configuration of device with path %s not found' %
+                          path)
+
     def _updateInterfaceDevice(self, params):
         try:
             netDev = self._lookupDeviceByAlias(NIC_DEVICES, params['alias'])


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib5f63715cd5142ffaf21ae9ba8d451175ae09be0
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <ali...@redhat.com>
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to