Change in vdsm[master]: virt: Move Vm._getUnderlyingVideoDeviceInfo() out of Vm
mzamazal at redhat.com
mzamazal at redhat.com
Fri Feb 26 16:24:30 UTC 2016
Milan Zamazal has uploaded a new change for review.
Change subject: virt: Move Vm._getUnderlyingVideoDeviceInfo() out of Vm
......................................................................
virt: Move Vm._getUnderlyingVideoDeviceInfo() out of Vm
This is just a simple move of code, following the Sound device example.
Change-Id: I6eca5c6fa4931b81fcde23fe24ac8c94efc8693c
Signed-off-by: Milan Zamazal <mzamazal at redhat.com>
---
M vdsm/virt/vm.py
M vdsm/virt/vmdevices/core.py
2 files changed, 25 insertions(+), 27 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/91/54091/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index ce1d5e9..fc8904f 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -1724,7 +1724,7 @@
self._getUnderlyingNetworkInterfaceInfo()
self._getUnderlyingDriveInfo()
vmdevices.core.Sound.update_device_info(self)
- self._getUnderlyingVideoDeviceInfo()
+ vmdevices.core.Video.update_device_info(self)
self._getUnderlyingGraphicsDeviceInfo()
self._getUnderlyingControllerDeviceInfo()
self._getUnderlyingBalloonDeviceInfo()
@@ -4260,32 +4260,6 @@
(not dev.get('address') or not dev.get('alias'))):
dev['address'] = address
dev['alias'] = alias
-
- def _getUnderlyingVideoDeviceInfo(self):
- """
- Obtain video devices info from libvirt.
- """
- for x in self._domain.get_device_elements('video'):
- alias = x.getElementsByTagName('alias')[0].getAttribute('name')
- # Get video card address
- address = vmxml.device_address(x)
-
- # FIXME. We have an identification problem here.
- # Video card device has not unique identifier, except the alias
- # (but backend not aware to device's aliases). So, for now
- # we can only assign the address according to devices order.
- for vc in self._devices[hwclass.VIDEO]:
- if not hasattr(vc, 'address') or not hasattr(vc, 'alias'):
- vc.alias = alias
- vc.address = address
- break
- # Update vm's conf with address
- for dev in self.conf['devices']:
- if ((dev['type'] == hwclass.VIDEO) and
- (not dev.get('address') or not dev.get('alias'))):
- dev['address'] = address
- dev['alias'] = alias
- break
def _getDriveIdentification(self, dom):
sources = dom.getElementsByTagName('source')
diff --git a/vdsm/virt/vmdevices/core.py b/vdsm/virt/vmdevices/core.py
index 61b6c69..a13eb93 100644
--- a/vdsm/virt/vmdevices/core.py
+++ b/vdsm/virt/vmdevices/core.py
@@ -334,6 +334,30 @@
video.appendChildWithArgs('model', type=self.device, **sourceAttrs)
return video
+ @classmethod
+ def update_device_info(cls, vm):
+ for x in vm.domain.get_device_elements('video'):
+ alias = x.getElementsByTagName('alias')[0].getAttribute('name')
+ # Get video card address
+ address = vmxml.device_address(x)
+
+ # FIXME. We have an identification problem here.
+ # Video card device has not unique identifier, except the alias
+ # (but backend not aware to device's aliases). So, for now
+ # we can only assign the address according to devices order.
+ for vc in vm.get_devices(hwclass.VIDEO):
+ if not hasattr(vc, 'address') or not hasattr(vc, 'alias'):
+ vc.alias = alias
+ vc.address = address
+ break
+ # Update vm's conf with address
+ for dev in vm.conf['devices']:
+ if ((dev['type'] == hwclass.VIDEO) and
+ (not dev.get('address') or not dev.get('alias'))):
+ dev['address'] = address
+ dev['alias'] = alias
+ break
+
class Watchdog(Base):
__slots__ = ('address',)
--
To view, visit https://gerrit.ovirt.org/54091
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6eca5c6fa4931b81fcde23fe24ac8c94efc8693c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Milan Zamazal <mzamazal at redhat.com>
More information about the vdsm-patches
mailing list