Zhou Zheng Sheng has uploaded a new change for review.
Change subject: extract a method for appending a child node with a text node to self.dom in libvirtvm.py ......................................................................
extract a method for appending a child node with a text node to self.dom in libvirtvm.py
In vdsm/libvirtvm.py, there are some duplicated code. It creates an xml element node, then creates a text node and appends it to the element, at last appends the element to self.dom. This can be done in a function.
Change-Id: Ie05d8f0f9869080b34d5cafb5c672d4034f09934 Signed-off-by: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com --- M vdsm/libvirtvm.py 1 file changed, 12 insertions(+), 12 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/46/6846/1 -- To view, visit http://gerrit.ovirt.org/6846 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange Gerrit-Change-Id: Ie05d8f0f9869080b34d5cafb5c672d4034f09934 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com
Zhou Zheng Sheng has posted comments on this change.
Change subject: extract a method for appending a child node with a text node to self.dom in libvirtvm.py ......................................................................
Patch Set 1: Verified
Run through autobuild.sh, but I disable two tests, testAddNetworkValidation and test_mkFloppyFs. These two tests will fail on my machine when I checkout the latest master and build.
And I further verify it by importing the module in the interpreter and examine the generated XML string. I just changed the way of generating name, uuid, memory, currentMemory, vcpu, and acpi, so I only check the related configurations and output XML string. The detailed conversation with Python interpreter is as follow.
[edward@zhshzhouf17 builder]$ PYTHONPATH=$(pwd)/share/vdsm:$(pwd)/lib64/python2.7/site-packages:/usr/lib64/python2.7/site-packages python Python 2.7.3 (default, Apr 30 2012, 21:18:11) [GCC 4.7.0 20120416 (Red Hat 4.7.0-2)] on linux2 Type "help", "copyright", "credits" or "license" for more information.
from libvirtvm import _DomXML as DomXML d = {'acpiEnable': 'True',
... 'smp': '2', ... 'vmId': '209b27e4-aed3-11e1-a547-00247edb4743', ... 'memSize': 128, ... 'vmName': 'rhel6vdsm'}
domxml = DomXML(d, None)
{'vmName': 'rhel6vdsm', 'memSize': 128, 'vmId': '209b27e4-aed3-11e1-a547-00247edb4743', 'acpiEnable': 'True', 'smp': '2'}
print domxml.toxml()
<?xml version="1.0" encoding="utf-8"?> <domain type="kvm"> <name>rhel6vdsm</name> <uuid>209b27e4-aed3-11e1-a547-00247edb4743</uuid> <memory>131072</memory> <currentMemory>131072</currentMemory> <vcpu>2</vcpu> <devices/> </domain>
The generated XML string looks OK.
-- To view, visit http://gerrit.ovirt.org/6846 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ie05d8f0f9869080b34d5cafb5c672d4034f09934 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com
Dan Kenigsberg has submitted this change and it was merged.
Change subject: extract a method for appending a child node with a text node to self.dom in libvirtvm.py ......................................................................
extract a method for appending a child node with a text node to self.dom in libvirtvm.py
In vdsm/libvirtvm.py, there are some duplicated code. It creates an xml element node, then creates a text node and appends it to the element, at last appends the element to self.dom. This can be done in a function.
Change-Id: Ie05d8f0f9869080b34d5cafb5c672d4034f09934 Signed-off-by: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com --- M vdsm/libvirtvm.py 1 file changed, 12 insertions(+), 12 deletions(-)
Approvals: oVirt Jenkins CI Server: Verified Dan Kenigsberg: Looks good to me, approved Zhou Zheng Sheng: Verified
-- To view, visit http://gerrit.ovirt.org/6846 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: merged Gerrit-Change-Id: Ie05d8f0f9869080b34d5cafb5c672d4034f09934 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Dan Kenigsberg has posted comments on this change.
Change subject: extract a method for appending a child node with a text node to self.dom in libvirtvm.py ......................................................................
Patch Set 1: Looks good to me, approved
-- To view, visit http://gerrit.ovirt.org/6846 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ie05d8f0f9869080b34d5cafb5c672d4034f09934 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
vdsm-patches@lists.fedorahosted.org