Milan Zamazal has uploaded a new change for review. Change subject: virt: Move Vm._getUnderlyingBalloonDeviceInfo() out of Vm ......................................................................
virt: Move Vm._getUnderlyingBalloonDeviceInfo() out of Vm This is just a simple move of code, following the Sound device example. Change-Id: I08d8e96657299f9730741fb5e97d4cfb9dfce28a Signed-off-by: Milan Zamazal <[email protected]> --- M vdsm/virt/vm.py M vdsm/virt/vmdevices/core.py 2 files changed, 24 insertions(+), 26 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/93/54093/1 diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py index 24e51b2..d5d34ce 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._getUnderlyingBalloonDeviceInfo() self._getUnderlyingWatchdogDeviceInfo() self._getUnderlyingSmartcardDeviceInfo() self._getUnderlyingRngDeviceInfo() self._getUnderlyingConsoleDeviceInfo() vmdevices.core.Controller.update_device_info(self) + vmdevices.core.Balloon.update_device_info(self) self._getUnderlyingHostDeviceInfo() self._getUnderlyingMemoryDeviceInfo() # Obtain info of all unknown devices. Must be last! @@ -4041,31 +4041,6 @@ 'device': device, 'address': address} self.conf['devices'].append(newDev) - - def _getUnderlyingBalloonDeviceInfo(self): - """ - Obtain balloon device info from libvirt. - """ - for x in self._domain.get_device_elements('memballoon'): - # Ignore balloon devices without address. - if not x.getElementsByTagName('address'): - address = None - else: - address = vmxml.device_address(x) - alias = x.getElementsByTagName('alias')[0].getAttribute('name') - - for dev in self._devices[hwclass.BALLOON]: - 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'] == hwclass.BALLOON: - if address and not dev.get('address'): - dev['address'] = address - if not dev.get('alias'): - dev['alias'] = alias def _getUnderlyingConsoleDeviceInfo(self): """ diff --git a/vdsm/virt/vmdevices/core.py b/vdsm/virt/vmdevices/core.py index dd1404b..07b2559 100644 --- a/vdsm/virt/vmdevices/core.py +++ b/vdsm/virt/vmdevices/core.py @@ -99,6 +99,29 @@ m.setAttrs(model=self.specParams['model']) return m + @classmethod + def update_device_info(cls, vm): + for x in vm.domain.get_device_elements('memballoon'): + # Ignore balloon devices without address. + if not x.getElementsByTagName('address'): + address = None + else: + address = vmxml.device_address(x) + alias = x.getElementsByTagName('alias')[0].getAttribute('name') + + for dev in vm.get_devices(hwclass.BALLOON): + if address and not hasattr(dev, 'address'): + dev.address = address + if not hasattr(dev, 'alias'): + dev.alias = alias + + for dev in vm.conf['devices']: + if dev['type'] == hwclass.BALLOON: + if address and not dev.get('address'): + dev['address'] = address + if not dev.get('alias'): + dev['alias'] = alias + class Console(Base): __slots__ = ('_path',) -- To view, visit https://gerrit.ovirt.org/54093 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I08d8e96657299f9730741fb5e97d4cfb9dfce28a Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Milan Zamazal <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
