Francesco Romani has uploaded a new change for review.
Change subject: virt: dev: implement from_xml for ControllerDevice ......................................................................
virt: dev: implement from_xml for ControllerDevice
Change-Id: I4cf7df0495a58c81207e680732fe0e72b8b5b04c Signed-off-by: Francesco Romani fromani@redhat.com --- M vdsm/virt/vm.py 1 file changed, 27 insertions(+), 20 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/54/33754/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py index a6e68ae..05f0a2f 100644 --- a/vdsm/virt/vm.py +++ b/vdsm/virt/vm.py @@ -709,6 +709,17 @@
return ctrl
+ @classmethod + def from_xml(cls, conf, log, dev_xml): + alias = dev_xml.getElementsByTagName('alias')[0].getAttribute('name') + return cls( + conf, log, + alias=alias, + device=dev_xml.getAttribute('type'), + model=dev_xml.getAttribute('model'), + index=dev_xml.getAttribute('index'), + address=vmxml.device_address(dev_xml)) +
class SoundDevice(vmdevices.Base): __slots__ = ('address', 'alias') @@ -4726,41 +4737,37 @@ # Ignore controller devices without address if not x.getElementsByTagName('address'): continue - alias = x.getElementsByTagName('alias')[0].getAttribute('name') - device = x.getAttribute('type') - # Get model and index. Relevant for USB controllers. - model = x.getAttribute('model') - index = x.getAttribute('index')
- # Get controller address - address = vmxml.device_address(x) + dev = ControllerDevice.from_xml(x)
# In case the controller has index and/or model, they # are compared. Currently relevant for USB controllers. for ctrl in self._devices[CONTROLLER_DEVICES]: - if ((ctrl.device == device) and - (not hasattr(ctrl, 'index') or ctrl.index == index) and - (not hasattr(ctrl, 'model') or ctrl.model == model)): - ctrl.alias = alias - ctrl.address = address + if ((ctrl.device == dev.device) and + (not hasattr(ctrl, 'index') + or ctrl.index == dev.index) and + (not hasattr(ctrl, 'model') + or ctrl.model == dev.model)): + ctrl.alias = dev.alias + ctrl.address = dev.address # Update vm's conf with address for known controller devices # In case the controller has index and/or model, they # are compared. Currently relevant for USB controllers. knownDev = False for dev in self.conf['devices']: if ((dev['type'] == CONTROLLER_DEVICES) and - (dev['device'] == device) and - ('index' not in dev or dev['index'] == index) and - ('model' not in dev or dev['model'] == model)): - dev['address'] = address - dev['alias'] = alias + (dev['device'] == dev.device) and + ('index' not in dev or dev['index'] == dev.index) and + ('model' not in dev or dev['model'] == dev.model)): + dev['address'] = dev.address + dev['alias'] = dev.alias knownDev = True # Add unknown controller device to vm's conf if not knownDev: self.conf['devices'].append({'type': CONTROLLER_DEVICES, - 'device': device, - 'address': address, - 'alias': alias}) + 'device': dev.device, + 'address': dev.address, + 'alias': dev.alias})
def _getUnderlyingBalloonDeviceInfo(self): """
oVirt Jenkins CI Server has posted comments on this change.
Change subject: virt: dev: implement from_xml for ControllerDevice ......................................................................
Patch Set 1:
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/11801/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/12747/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_virt_functional_tests_gerrit/1720/ : There was an infra issue, please contact infra@ovirt.org
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/12590/ : SUCCESS
Francesco Romani has abandoned this change.
Change subject: virt: dev: implement from_xml for ControllerDevice ......................................................................
Abandoned
automation@ovirt.org has posted comments on this change.
Change subject: virt: dev: implement from_xml for ControllerDevice ......................................................................
Patch Set 1:
* Update tracker::IGNORE, no Bug-Url found
vdsm-patches@lists.fedorahosted.org