Change in vdsm[master]: vdsm: Always retrieve alias for Balloon and Console devices

vfeenstr at redhat.com vfeenstr at redhat.com
Fri Aug 2 13:30:03 UTC 2013


Vinzenz Feenstra has uploaded a new change for review.

Change subject: vdsm: Always retrieve alias for Balloon and Console devices
......................................................................

vdsm: Always retrieve alias for Balloon and Console devices

We haven't been retrieving the alias value for console devices which
now starts to bite us due to the assumption that all VmDevice objects,
have to have an alias attribute during the migration.

Due to a bug in the handling for Balloon devices this also happened.

This commit fixes the problem for the future by retrieving the aliases.

Change-Id: Ic828d13761b26b3ec01b604f431050a611bce01c
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=988065
Signed-off-by: Vinzenz Feenstra <vfeenstr at redhat.com>
---
M vdsm/vm.py
1 file changed, 29 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/02/17602/1

diff --git a/vdsm/vm.py b/vdsm/vm.py
index eefbccd..92b4b91 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -2732,6 +2732,7 @@
         self._getUnderlyingBalloonDeviceInfo()
         self._getUnderlyingWatchdogDeviceInfo()
         self._getUnderlyingSmartcardDeviceInfo()
+        self._getUnderlyingConsoleDeviceInfo()
         # Obtain info of all unknown devices. Must be last!
         self._getUnderlyingUnknownDeviceInfo()
 
@@ -4427,20 +4428,41 @@
         for x in balloonxml:
             # Ignore balloon devices without address.
             if not x.getElementsByTagName('address'):
-                continue
-
-            address = self._getUnderlyingDeviceAddress(x)
+                address = None
+            else:
+                address = self._getUnderlyingDeviceAddress(x)
             alias = x.getElementsByTagName('alias')[0].getAttribute('name')
 
             for dev in self._devices[BALLOON_DEVICES]:
-                if not hasattr(dev, 'address'):
+                if address and not hasattr(dev, 'address'):
                     dev.address = address
+                if not hasattr(dev, 'alias'):
                     dev.alias = alias
 
             for dev in self.conf['devices']:
-                if ((dev['type'] == BALLOON_DEVICES) and
-                        not dev.get('address')):
-                    dev['address'] = address
+                if dev['type'] == BALLOON_DEVICES:
+                    if address and not dev.get('address'):
+                        dev['address'] = address
+                    if not dev.get('alias'):
+                        dev['alias'] = alias
+
+    def _getUnderlyingConsoleDeviceInfo(self):
+        """
+        Obtain the alias for the console device from libvirt
+        """
+        consolexml = _domParseStr(self._lastXMLDesc).childNodes[0].\
+            getElementsByTagName('devices')[0].\
+            getElementsByTagName('console')
+        for x in consolexml:
+            # All we care about is the alias
+            alias = x.getElementsByTagName('alias')[0].getAttribute('name')
+            for dev in self._devices[CONSOLE_DEVICES]:
+                if not hasattr(dev, 'alias'):
+                    dev.alias = alias
+
+            for dev in self.conf['devices']:
+                if dev['device'] == CONSOLE_DEVICES and \
+                        not dev.get('alias'):
                     dev['alias'] = alias
 
     def _getUnderlyingSmartcardDeviceInfo(self):


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic828d13761b26b3ec01b604f431050a611bce01c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Vinzenz Feenstra <vfeenstr at redhat.com>


More information about the vdsm-patches mailing list