Change in vdsm[master]: virt: devices: initial support for device updates with etree's

fromani at redhat.com fromani at redhat.com
Tue Sep 29 14:59:51 UTC 2015


Francesco Romani has posted comments on this change.

Change subject: virt: devices: initial support for device updates with etree's
......................................................................


Patch Set 3:

(5 comments)

thanks for the updates, we are on a good track.

https://gerrit.ovirt.org/#/c/46525/3/tests/deviceTests.py
File tests/deviceTests.py:

Line 291:         dev = {'device': 'ac97', 'deviceType': 'sound'}
Line 292:         domainFile = os.path.join('devices', 'data', 'testComplexVm.xml')
Line 293:         domainElement = etree.parse(domainFile).getroot()
Line 294:         # We must remove extra <sound> elements since Sound.update() requires
Line 295:         # presence of exactly one <sound> element.
this is nice and works, but can't we just require an xml with just one sound device, and happily apply the "Garbage In, Garbage Out" principle?
Line 296:         sound = None
Line 297:         queue = [domainElement]
Line 298:         while queue:
Line 299:             node = queue.pop()


https://gerrit.ovirt.org/#/c/46525/3/vdsm/virt/vm.py
File vdsm/virt/vm.py:

Line 1: #
Line 2: # Copyright 2008-2015 Red Hat, Inc.
unrelated, but I don't mind :)
Line 3: #
Line 4: # This program is free software; you can redistribute it and/or modify
Line 5: # it under the terms of the GNU General Public License as published by
Line 6: # the Free Software Foundation; either version 2 of the License, or


Line 4217:                     break
Line 4218:             else:
Line 4219:                 # Nothing found?  It's suspicious and no parsed info is
Line 4220:                 # available for vm's conf in such a case, so let's give up.
Line 4221:                 self.log.warning("Too many sound devices in XML from libvirt")
I'd just say 'no match' in this log here.
Line 4222:                 return
Line 4223:             # Update vm's conf with address
Line 4224:             for dev in self.conf['devices']:
Line 4225:                 if ((dev['type'] == hwclass.SOUND) and


https://gerrit.ovirt.org/#/c/46525/3/vdsm/virt/vmdevices/core.py
File vdsm/virt/vmdevices/core.py:

Line 33: class SkipDevice(Exception):
Line 34:     pass
Line 35: 
Line 36: 
Line 37: def _getUnderlyingDeviceAddress(etreeElement, index=0):
this can now have a_pep8_compliant_name :)
Line 38:     """
Line 39:     Get and return device address dictionary from 'etreeElement'.
Line 40: 
Line 41:     :param etreeElement: element containing <address> element(s) describing


Line 257:         return card
Line 258: 
Line 259: 
Line 260: class Sound(Base):
Line 261:     __slots__ = ('address',)
good catch, but unrelated: please post a separate patch
Line 262: 
Line 263:     def getXML(self):
Line 264:         """
Line 265:         Create domxml for sound device


-- 
To view, visit https://gerrit.ovirt.org/46525
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I7afe81af334ab9d8e7da6626cb902b95202cc05c
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Milan Zamazal <pdm at zamazal.org>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Milan Zamazal <pdm at zamazal.org>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list