Inconsistent use of xml libraries

Bug #953449 reported by Vish Ishaya
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Chuck Short

Bug Description

Most of the code base is using lxml.etree but there are a few places using xml.etree.ElementTree. We should be using a single library for xml processing:

vishvananda@firefly-2:~/cache/stack/nova (master)$ ack ElementTree
nova/image/s3.py
27:from xml.etree import ElementTree
191: manifest = ElementTree.fromstring(manifest)

nova/tests/api/ec2/test_middleware.py
30:from xml.etree import ElementTree
111: tree = ElementTree.fromstring(result.body)

nova/tests/fakelibvirt.py
17:from xml.etree import ElementTree
19: ParseError = ElementTree.ParseError
144: tree = ElementTree.fromstring(xml)
166: tree = ElementTree.fromstring(xml)
304: disk_info = _parse_disk_info(ElementTree.fromstring(xml))
310: disk_info = _parse_disk_info(ElementTree.fromstring(xml))
407: tree = ElementTree.fromstring(xml)
744: tree = ElementTree.fromstring(xml)

nova/tests/test_fakelibvirt.py
19:from xml.etree import ElementTree
255: ElementTree.fromstring(xml)
263: tree = ElementTree.fromstring(xml)
285: tree = ElementTree.fromstring(xml)
301: ElementTree.fromstring(conn.getCapabilities())

nova/tests/test_libvirt.py
26:from xml.etree import ElementTree
154: tree = ElementTree.fromstring(xml)
193: tree = ElementTree.fromstring(xml)
216: tree = ElementTree.fromstring(xml)
231: tree = ElementTree.fromstring(xml)
253: tree = ElementTree.fromstring(xml)
725: tree = ElementTree.fromstring(xml)
747: tree = ElementTree.fromstring(xml)
788: tree = ElementTree.fromstring(xml)
804: tree = ElementTree.fromstring(xml)
817: tree = ElementTree.fromstring(xml)
830: tree = ElementTree.fromstring(xml)
929: tree = ElementTree.fromstring(xml)
1387: tree = ElementTree.fromstring(xml)

nova/tests/test_libvirt_vif.py
17:from xml.etree import ElementTree
103: doc = ElementTree.fromstring(xml)
119: doc = ElementTree.fromstring(xml)
137: doc = ElementTree.fromstring(xml)
163: doc = ElementTree.fromstring(xml)

nova/tests/test_vsa.py
18:from xml.etree import ElementTree
163: elem = ElementTree.fromstring(user_data)

nova/virt/libvirt/connection.py
53:from xml.etree import ElementTree
492: doc = ElementTree.fromstring(xml)
500: return ElementTree.tostring(node)
550: doc = ElementTree.fromstring(xml)
630: domain = ElementTree.fromstring(xml_desc)
908: tree = ElementTree.fromstring(xml)
1463: doc = ElementTree.fromstring(domain.XMLDesc(0))
1486: doc = ElementTree.fromstring(xml)
1519: doc = ElementTree.fromstring(xml)
1677: xml = ElementTree.fromstring(xml)
2073: doc = ElementTree.fromstring(xml)

nova/volume/driver.py
25:from xml.etree import ElementTree
955: result_xml = ElementTree.fromstring(out)
981: result_xml = ElementTree.fromstring(out)

nova/volume/san.py
33:from xml.etree import ElementTree
454: result_xml = ElementTree.fromstring(out)
495: _xml = ElementTree.tostring(cluster_xml)

nova/vsa/utils.py
19:from xml.etree import ElementTree
27: SubElement = ElementTree.SubElement
29: e_vsa = ElementTree.Element("vsa")
79: _xml = ElementTree.tostring(e_vsa)

Changed in nova:
status: New → Triaged
importance: Undecided → Low
tags: added: low-hanging-fruit
Changed in nova:
assignee: nobody → Mark McClain (markmcclain)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/5422

Changed in nova:
status: Triaged → In Progress
Chuck Short (zulcss)
Changed in nova:
assignee: Mark McClain (markmcclain) → Chuck Short (zulcss)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: master
Review: https://review.openstack.org/6931

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/6931
Committed: http://github.com/openstack/nova/commit/7a5c505a3bc22a1542791b6f32ceaf0f0ec17a63
Submitter: Jenkins
Branch: master

commit 7a5c505a3bc22a1542791b6f32ceaf0f0ec17a63
Author: Chuck Short <email address hidden>
Date: Mon Apr 30 13:52:37 2012 -0400

    Clean up ElementTree usage

    Use lxml in favor of ElementTree to
    make things more consistent.

    Fixes LP: #953449

    Change-Id: I7f48528d7df47fe7207ca88bce196dea7535df0e
    Signed-off-by: Chuck Short <email address hidden>

Changed in nova:
status: In Progress → Fix Committed
Devin Carlen (devcamcar)
Changed in nova:
milestone: none → folsom-1
Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: folsom-1 → 2012.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.