Francesco Romani has uploaded a new change for review.
Change subject: virt: dev: bootstrap from_xml method ......................................................................
virt: dev: bootstrap from_xml method
implement from_xml method, do incapsulate device creation from xml description. Use it for Video Devices.
Change-Id: I745909ce65ecb30da299d2d8afb1987a91581ace Signed-off-by: Francesco Romani fromani@redhat.com --- M vdsm/virt/vm.py M vdsm/virt/vmdevices.py 2 files changed, 11 insertions(+), 7 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/50/33750/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py index 5b710a8..d356da8 100644 --- a/vdsm/virt/vm.py +++ b/vdsm/virt/vm.py @@ -4866,9 +4866,7 @@ videosxml = _domParseStr(self._lastXMLDesc).childNodes[0]. \ getElementsByTagName('devices')[0].getElementsByTagName('video') for x in videosxml: - alias = x.getElementsByTagName('alias')[0].getAttribute('name') - # Get video card address - address = vmxml.device_address(x) + dev = vmdevices.VideoDevice.from_xml(x)
# FIXME. We have an identification problem here. # Video card device has not unique identifier, except the alias @@ -4876,15 +4874,15 @@ # we can only assign the address according to devices order. for vc in self._devices[VIDEO_DEVICES]: if not hasattr(vc, 'address') or not hasattr(vc, 'alias'): - vc.alias = alias - vc.address = address + vc.alias = dev.alias + vc.address = dev.address break # Update vm's conf with address for dev in self.conf['devices']: if ((dev['type'] == VIDEO_DEVICES) and (not dev.get('address') or not dev.get('alias'))): - dev['address'] = address - dev['alias'] = alias + dev['address'] = dev.address + dev['alias'] = dev.alias break
def _getUnderlyingSoundDeviceInfo(self): diff --git a/vdsm/virt/vmdevices.py b/vdsm/virt/vmdevices.py index 7b01cc4..14278e1 100644 --- a/vdsm/virt/vmdevices.py +++ b/vdsm/virt/vmdevices.py @@ -44,6 +44,12 @@ if not a.startswith('__')] return ' '.join(attrs)
+ @classmethod + def from_xml(cls, conf, log, dev_xml): + alias = dev_xml.getElementsByTagName('alias')[0].getAttribute('name') + address = vmxml.device_address(dev_xml) + return cls(conf, log, alias=alias, address=address) +
class VideoDevice(Base): __slots__ = ('address',)
oVirt Jenkins CI Server has posted comments on this change.
Change subject: virt: dev: bootstrap from_xml method ......................................................................
Patch Set 1:
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/11797/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/12743/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_virt_functional_tests_gerrit/1716/ : There was an infra issue, please contact infra@ovirt.org
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/12586/ : SUCCESS
oVirt Jenkins CI Server has posted comments on this change.
Change subject: virt: dev: bootstrap from_xml method ......................................................................
Patch Set 2:
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/13584/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/14541/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/14373/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_virt_functional_tests_gerrit/2088/ : There was an infra issue, please contact infra@ovirt.org
Francesco Romani has abandoned this change.
Change subject: virt: dev: bootstrap from_xml method ......................................................................
Abandoned
automation@ovirt.org has posted comments on this change.
Change subject: virt: dev: bootstrap from_xml method ......................................................................
Patch Set 2:
* Update tracker::IGNORE, no Bug-Url found
vdsm-patches@lists.fedorahosted.org