diff --git a/nova/tests/test_libvirt_config.py b/nova/tests/test_libvirt_config.py index 8b0340fe..f771d23f 100644 --- a/nova/tests/test_libvirt_config.py +++ b/nova/tests/test_libvirt_config.py @@ -301,6 +301,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): @@ -678,6 +746,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" @@ -693,6 +765,14 @@ class LibvirtConfigGuestTest(LibvirtConfigBaseTest): demo 104857600 2 + + + Acme + + + 1.0.0 + + linux