Change in vdsm[master]: virt: Move Vm._getUnderlyingSmartcardDeviceInfo() out of Vm
mzamazal at redhat.com
mzamazal at redhat.com
Fri Feb 26 16:24:31 UTC 2016
Milan Zamazal has uploaded a new change for review.
Change subject: virt: Move Vm._getUnderlyingSmartcardDeviceInfo() out of Vm
......................................................................
virt: Move Vm._getUnderlyingSmartcardDeviceInfo() out of Vm
This is just a simple move of code, following the Sound device example.
Change-Id: Ib3658e0ddc79721fb9f52b7d03464fcc3b74e540
Signed-off-by: Milan Zamazal <mzamazal at redhat.com>
---
M vdsm/virt/vm.py
M vdsm/virt/vmdevices/core.py
2 files changed, 21 insertions(+), 23 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/95/54095/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index c85d72a..527aa5b 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -1726,12 +1726,12 @@
vmdevices.core.Sound.update_device_info(self)
vmdevices.core.Video.update_device_info(self)
self._getUnderlyingGraphicsDeviceInfo()
- self._getUnderlyingSmartcardDeviceInfo()
self._getUnderlyingRngDeviceInfo()
self._getUnderlyingConsoleDeviceInfo()
vmdevices.core.Controller.update_device_info(self)
vmdevices.core.Balloon.update_device_info(self)
vmdevices.core.Watchdog.update_device_info(self)
+ vmdevices.core.Smartcard.update_device_info(self)
self._getUnderlyingHostDeviceInfo()
self._getUnderlyingMemoryDeviceInfo()
# Obtain info of all unknown devices. Must be last!
@@ -4056,28 +4056,6 @@
for dev in self.conf['devices']:
if dev['device'] == hwclass.CONSOLE and \
not dev.get('alias'):
- dev['alias'] = alias
-
- def _getUnderlyingSmartcardDeviceInfo(self):
- """
- Obtain smartcard device info from libvirt.
- """
- for x in self._domain.get_device_elements('smartcard'):
- if not x.getElementsByTagName('address'):
- continue
-
- address = vmxml.device_address(x)
- alias = x.getElementsByTagName('alias')[0].getAttribute('name')
-
- for dev in self._devices[hwclass.SMARTCARD]:
- if not hasattr(dev, 'address'):
- dev.address = address
- dev.alias = alias
-
- for dev in self.conf['devices']:
- if dev['type'] == hwclass.SMARTCARD and \
- not dev.get('address'):
- dev['address'] = address
dev['alias'] = alias
def _getUnderlyingRngDeviceInfo(self):
diff --git a/vdsm/virt/vmdevices/core.py b/vdsm/virt/vmdevices/core.py
index 21b45f4..e6e19aa 100644
--- a/vdsm/virt/vmdevices/core.py
+++ b/vdsm/virt/vmdevices/core.py
@@ -287,6 +287,26 @@
card.setAttrs(**sourceAttrs)
return card
+ @classmethod
+ def update_device_info(cls, vm):
+ for x in vm.domain.get_device_elements('smartcard'):
+ if not x.getElementsByTagName('address'):
+ continue
+
+ address = vmxml.device_address(x)
+ alias = x.getElementsByTagName('alias')[0].getAttribute('name')
+
+ for dev in vm.get_devices(hwclass.SMARTCARD):
+ if not hasattr(dev, 'address'):
+ dev.address = address
+ dev.alias = alias
+
+ for dev in vm.conf['devices']:
+ if dev['type'] == hwclass.SMARTCARD and \
+ not dev.get('address'):
+ dev['address'] = address
+ dev['alias'] = alias
+
class Sound(Base):
__slots__ = ('address',)
--
To view, visit https://gerrit.ovirt.org/54095
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib3658e0ddc79721fb9f52b7d03464fcc3b74e540
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