Merge "Add support for parsing the <uuid> from libvirt host capabilities"
This commit is contained in:
commit
62b38931c5
@ -63,6 +63,7 @@ class LibvirtConfigCapsTest(LibvirtConfigBaseTest):
|
||||
xmlin = """
|
||||
<capabilities>
|
||||
<host>
|
||||
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||
<cpu>
|
||||
<arch>x86_64</arch>
|
||||
<model>Opteron_G3</model>
|
||||
@ -86,6 +87,7 @@ class LibvirtConfigCapsTest(LibvirtConfigBaseTest):
|
||||
obj.parse_str(xmlin)
|
||||
|
||||
self.assertEqual(type(obj.host), config.LibvirtConfigCapsHost)
|
||||
self.assertEqual(obj.host.uuid, "c7a5fdbd-edaf-9455-926a-d65c16db1809")
|
||||
|
||||
xmlout = obj.to_xml()
|
||||
|
||||
|
@ -106,6 +106,7 @@ class LibvirtConfigCapsHost(LibvirtConfigObject):
|
||||
**kwargs)
|
||||
|
||||
self.cpu = None
|
||||
self.uuid = None
|
||||
|
||||
def parse_dom(self, xmldoc):
|
||||
super(LibvirtConfigCapsHost, self).parse_dom(xmldoc)
|
||||
@ -115,10 +116,14 @@ class LibvirtConfigCapsHost(LibvirtConfigObject):
|
||||
cpu = LibvirtConfigCPU()
|
||||
cpu.parse_dom(c)
|
||||
self.cpu = cpu
|
||||
elif c.tag == "uuid":
|
||||
self.uuid = c.text
|
||||
|
||||
def format_dom(self):
|
||||
caps = super(LibvirtConfigCapsHost, self).format_dom()
|
||||
|
||||
if self.uuid:
|
||||
caps.append(self._text_node("uuid", self.uuid))
|
||||
if self.cpu:
|
||||
caps.append(self.cpu.format_dom())
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user