Francesco Romani has uploaded a new change for review.

Change subject: virt: devices: watchdog: use 'continue'
......................................................................

virt: devices: watchdog: use 'continue'

Use 'continue' in getUnderlyingWatchdogDeviceInfo
to skip devices with no address, in order to make
it alike other getUnderlying*Info methods.

This patch enables a future patch to factor out
some getUnderlying*Info in one helper function.

Change-Id: Id305def96d141d000d342b13b98d4b35ec1c0b72
Signed-off-by: Francesco Romani <from...@redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 14 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/88/50188/1

diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 07981b1..68fda12 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -4195,22 +4195,22 @@
         Obtain watchdog device info from libvirt.
         """
         for x in self._domain.get_device_elements('watchdog'):
+            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')
 
-            # PCI watchdog has "address" different from ISA watchdog
-            if x.getElementsByTagName('address'):
-                address = self._getUnderlyingDeviceAddress(x)
-                alias = x.getElementsByTagName('alias')[0].getAttribute('name')
+            for wd in self._devices[hwclass.WATCHDOG]:
+                if not hasattr(wd, 'address') or not hasattr(wd, 'alias'):
+                    wd.address = address
+                    wd.alias = alias
 
-                for wd in self._devices[hwclass.WATCHDOG]:
-                    if not hasattr(wd, 'address') or not hasattr(wd, 'alias'):
-                        wd.address = address
-                        wd.alias = alias
-
-                for dev in self.conf['devices']:
-                    if ((dev['type'] == hwclass.WATCHDOG) and
-                            (not dev.get('address') or not dev.get('alias'))):
-                        dev['address'] = address
-                        dev['alias'] = alias
+            for dev in self.conf['devices']:
+                if ((dev['type'] == hwclass.WATCHDOG) and
+                        (not dev.get('address') or not dev.get('alias'))):
+                    dev['address'] = address
+                    dev['alias'] = alias
 
     def _getUnderlyingVideoDeviceInfo(self):
         """


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id305def96d141d000d342b13b98d4b35ec1c0b72
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <from...@redhat.com>
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to