From 4a7a46fd8cb053c63455f07e83074578ad1ecb8f Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Tue, 11 Dec 2012 16:47:55 +0000 Subject: Add support for libvirt domain XML config Libvirt domains can have system metadata defined in a XML element. For the x86 platform with KVM guests, this can then be used to populate the SMBIOS data tables Acme Acme Wile Coyote c7a5fdbd-edaf-9455-926a-d65c16db1809 Change-Id: Ib4980ddc2f558921893a7e208e304ba59636e430 Signed-off-by: Daniel P. Berrange --- nova/tests/test_libvirt_config.py | 80 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) (limited to 'nova/tests') diff --git a/nova/tests/test_libvirt_config.py b/nova/tests/test_libvirt_config.py index c332ce7c3..f95d904c7 100644 --- a/nova/tests/test_libvirt_config.py +++ b/nova/tests/test_libvirt_config.py @@ -303,6 +303,74 @@ class LibvirtConfigGuestCPUTest(LibvirtConfigBaseTest): """) +class LibvirtConfigGuestSysinfoTest(LibvirtConfigBaseTest): + + def test_config_simple(self): + obj = config.LibvirtConfigGuestSysinfo() + + xml = obj.to_xml() + self.assertXmlEqual(xml, """ + + """) + + def test_config_bios(self): + obj = config.LibvirtConfigGuestSysinfo() + obj.bios_vendor = "Acme" + obj.bios_version = "6.6.6" + + xml = obj.to_xml() + self.assertXmlEqual(xml, """ + + + Acme + 6.6.6 + + + """) + + def test_config_system(self): + obj = config.LibvirtConfigGuestSysinfo() + obj.system_manufacturer = "Acme" + obj.system_product = "Wile Coyote" + obj.system_version = "6.6.6" + obj.system_serial = "123456" + obj.system_uuid = "c7a5fdbd-edaf-9455-926a-d65c16db1809" + + xml = obj.to_xml() + self.assertXmlEqual(xml, """ + + + Acme + Wile Coyote + 6.6.6 + 123456 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + + + """) + + def test_config_mixed(self): + obj = config.LibvirtConfigGuestSysinfo() + obj.bios_vendor = "Acme" + obj.system_manufacturer = "Acme" + obj.system_product = "Wile Coyote" + obj.system_uuid = "c7a5fdbd-edaf-9455-926a-d65c16db1809" + + xml = obj.to_xml() + self.assertXmlEqual(xml, """ + + + Acme + + + Acme + Wile Coyote + c7a5fdbd-edaf-9455-926a-d65c16db1809 + + + """) + + class LibvirtConfigGuestDiskTest(LibvirtConfigBaseTest): def test_config_file(self): @@ -680,6 +748,10 @@ class LibvirtConfigGuestTest(LibvirtConfigBaseTest): obj.acpi = True obj.apic = True + obj.sysinfo = config.LibvirtConfigGuestSysinfo() + obj.sysinfo.bios_vendor = "Acme" + obj.sysinfo.system_version = "1.0.0" + disk = config.LibvirtConfigGuestDisk() disk.source_type = "file" disk.source_path = "/tmp/img" @@ -695,6 +767,14 @@ class LibvirtConfigGuestTest(LibvirtConfigBaseTest): demo 104857600 2 + + + Acme + + + 1.0.0 + + linux -- cgit