Merge "Add support for libvirt domain <smbios> XML config"
This commit is contained in:
commit
5f575d8b9c
@ -301,6 +301,17 @@ class LibvirtConfigGuestCPUTest(LibvirtConfigBaseTest):
|
||||
""")
|
||||
|
||||
|
||||
class LibvirtConfigGuestSMBIOSTest(LibvirtConfigBaseTest):
|
||||
|
||||
def test_config_simple(self):
|
||||
obj = config.LibvirtConfigGuestSMBIOS()
|
||||
|
||||
xml = obj.to_xml()
|
||||
self.assertXmlEqual(xml, """
|
||||
<smbios mode="sysinfo"/>
|
||||
""")
|
||||
|
||||
|
||||
class LibvirtConfigGuestSysinfoTest(LibvirtConfigBaseTest):
|
||||
|
||||
def test_config_simple(self):
|
||||
@ -743,6 +754,7 @@ class LibvirtConfigGuestTest(LibvirtConfigBaseTest):
|
||||
obj.uuid = "b38a3f43-4be2-4046-897f-b67c2f5e0147"
|
||||
obj.os_type = "linux"
|
||||
obj.os_boot_dev = "hd"
|
||||
obj.os_smbios = config.LibvirtConfigGuestSMBIOS()
|
||||
obj.acpi = True
|
||||
obj.apic = True
|
||||
|
||||
@ -776,6 +788,7 @@ class LibvirtConfigGuestTest(LibvirtConfigBaseTest):
|
||||
<os>
|
||||
<type>linux</type>
|
||||
<boot dev="hd"/>
|
||||
<smbios mode="sysinfo"/>
|
||||
</os>
|
||||
<features>
|
||||
<acpi/>
|
||||
|
@ -337,6 +337,21 @@ class LibvirtConfigGuestCPU(LibvirtConfigCPU):
|
||||
return cpu
|
||||
|
||||
|
||||
class LibvirtConfigGuestSMBIOS(LibvirtConfigObject):
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(LibvirtConfigGuestSMBIOS, self).__init__(root_name="smbios",
|
||||
**kwargs)
|
||||
|
||||
self.mode = "sysinfo"
|
||||
|
||||
def format_dom(self):
|
||||
smbios = super(LibvirtConfigGuestSMBIOS, self).format_dom()
|
||||
smbios.set("mode", self.mode)
|
||||
|
||||
return smbios
|
||||
|
||||
|
||||
class LibvirtConfigGuestSysinfo(LibvirtConfigObject):
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
@ -678,6 +693,7 @@ class LibvirtConfigGuest(LibvirtConfigObject):
|
||||
self.os_root = None
|
||||
self.os_init_path = None
|
||||
self.os_boot_dev = None
|
||||
self.os_smbios = None
|
||||
self.devices = []
|
||||
|
||||
def _format_basic_props(self, root):
|
||||
@ -703,6 +719,8 @@ class LibvirtConfigGuest(LibvirtConfigObject):
|
||||
os.append(self._text_node("init", self.os_init_path))
|
||||
if self.os_boot_dev is not None:
|
||||
os.append(etree.Element("boot", dev=self.os_boot_dev))
|
||||
if self.os_smbios is not None:
|
||||
os.append(self.os_smbios.format_dom())
|
||||
root.append(os)
|
||||
|
||||
def _format_features(self, root):
|
||||
|
Loading…
x
Reference in New Issue
Block a user