Browse Source

Remove lxml deprecated methods

All our supported runtimes [1] are compatible with the recommended
alternatives.

The `getchildren` method is deprecated [2] since lxml 2.0 and will be removed
in future versions, these changes switch usages to `list(elem)` as
recommended in the official documentation [2].

[1] https://governance.openstack.org/tc/reference/runtimes/victoria.html#python-runtimes-for-train
[2] https://lxml.de/api/lxml.etree._Element-class.html#getchildren

Change-Id: Ibdc54cdc62d84ea98d4f21bb3698e6726e56365a
changes/72/737472/2
Hervé Beraud 1 month ago
parent
commit
385df41b70
1 changed files with 5 additions and 5 deletions
  1. +5
    -5
      nova/virt/libvirt/config.py

+ 5
- 5
nova/virt/libvirt/config.py View File

@@ -213,7 +213,7 @@ class LibvirtConfigDomainCapsDevices(LibvirtConfigObject):
def parse_dom(self, xmldoc):
super().parse_dom(xmldoc)

for c in xmldoc.getchildren():
for c in list(xmldoc):
device = self.DEVICE_PARSERS.get(c.tag)
if device:
device = device()
@@ -281,7 +281,7 @@ class LibvirtConfigDomainCapsFeatureSev(LibvirtConfigObject):
if xmldoc.get('supported') == 'yes':
self.supported = True

for c in xmldoc.getchildren():
for c in list(xmldoc):
if c.tag == 'reducedPhysBits':
self.reduced_phys_bits = int(c.text)
elif c.tag == 'cbitpos':
@@ -3326,14 +3326,14 @@ class LibvirtConfigGuestVPMEM(LibvirtConfigGuestDevice):
self.model = xmldoc.get("model")
self.access = xmldoc.get("access")

for c in xmldoc.getchildren():
for c in list(xmldoc):
if c.tag == "source":
for sub in c.getchildren():
for sub in list(c):
if sub.tag == "path":
self.source_path = sub.text
if sub.tag == "alignsize":
self.align_size = sub.text
elif c.tag == "target":
for sub in c.getchildren():
for sub in list(c):
if sub.tag == "size":
self.target_size = sub.text

Loading…
Cancel
Save