Change in vdsm[master]: Improve dom xml gereration

deepakcs at linux.vnet.ibm.com deepakcs at linux.vnet.ibm.com
Wed Jan 9 09:27:30 UTC 2013


Deepak C Shetty has posted comments on this change.

Change subject: Improve dom xml gereration
......................................................................


Patch Set 5: I would prefer that you didn't submit this

(3 inline comments)

....................................................
File vdsm/libvirtvm.py
Line 548:                 raise
Line 549:         return f
Line 550: 
Line 551: 
Line 552: class XMLElem(object):
XMLElement as the classname would be more legible and readable i feel.
Line 553: 
Line 554:     def __init__(self, tagName, text=None, **attrs):
Line 555:         self._elem = xml.dom.minidom.Document().createElement(tagName)
Line 556:         self.setAttrs(**attrs)


Line 567:     def appendTextNode(self, text):
Line 568:         textNode = xml.dom.minidom.Document().createTextNode(text)
Line 569:         self._elem.appendChild(textNode)
Line 570: 
Line 571:     def newChild(self, childName, text=None, **attrs):
maybe then this should be called appendNewChild or addNewChild ?
'newChild' doesnt convey the fact that is being added to the parent as well.
Line 572:         child = XMLElem(childName, text, **attrs)
Line 573:         self._elem.appendChild(child)
Line 574:         return child
Line 575: 


Line 643: 
Line 644:         oselem = XMLElem('os')
Line 645:         self.dom.appendChild(oselem)
Line 646:         oselem.newChild('type', text='hvm', arch='x86_64',
Line 647:                         machine=self.conf.get('emulatedMachine', 'pc'))
+1 to what Pradipta said.
Line 648: 
Line 649:         qemu2libvirtBoot = {'a': 'fd', 'c': 'hd', 'd': 'cdrom', 'n': 'network'}
Line 650:         for c in self.conf.get('boot', ''):
Line 651:             oselem.newChild('boot', dev=qemu2libvirtBoot[c])


--
To view, visit http://gerrit.ovirt.org/10054
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib936740fcbeeee551e13abfed7fd91f2a159e351
Gerrit-PatchSet: 5
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Mark Wu <wudxw at linux.vnet.ibm.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Deepak C Shetty <deepakcs at linux.vnet.ibm.com>
Gerrit-Reviewer: Mark Wu <wudxw at linux.vnet.ibm.com>
Gerrit-Reviewer: Pradipta Banerjee <bpradip at in.ibm.com>
Gerrit-Reviewer: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
Gerrit-Reviewer: Vinzenz Feenstra <vfeenstr at redhat.com>
Gerrit-Reviewer: Zhou Zheng Sheng <zhshzhou at linux.vnet.ibm.com>
Gerrit-Reviewer: oVirt Jenkins CI Server


More information about the vdsm-patches mailing list