Change in vdsm[master]: vm: add generic getUnderlyingDeviceInfo

fromani at redhat.com fromani at redhat.com
Wed Dec 9 15:39:01 UTC 2015


Francesco Romani has uploaded a new change for review.

Change subject: vm: add generic getUnderlyingDeviceInfo
......................................................................

vm: add generic getUnderlyingDeviceInfo

add generic method to replace redundant code.

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


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/92/50192/1

diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 3adc690..cf4012f 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -4101,6 +4101,28 @@
                     dev['address'] = address
                     dev['alias'] = alias
 
+    def _getUnderlyingDeviceInfo(self, dev_class):
+        """
+        Obtain up-to-date device info from libvirt.
+        """
+        for x in self._domain.get_device_elements(dev_class):
+            if not x.getElementsByTagName('address'):
+                self.log.debug('device without address: %s', x)
+                continue
+            address = self._getUnderlyingDeviceAddress(x)
+            alias = x.getElementsByTagName('alias')[0].getAttribute('name')
+
+            for dev in self._devices[dev_class]:
+                if not hasattr(dev, 'address'):
+                    dev.address = address
+                    dev.alias = alias
+
+            for dev in self.conf['devices']:
+                if dev['type'] == dev_class and \
+                        not dev.get('address'):
+                    dev['address'] = address
+                    dev['alias'] = alias
+
     def _getUnderlyingRngDeviceInfo(self):
         """
         Obtain rng device info from libvirt.


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I10405b03bdb4b64075b7a273740f73b19b095002
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