From d16425aa8faf4c013ed48d6fc40ff32fab82e058 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Tue, 14 May 2019 14:05:08 -0400 Subject: [PATCH] cli: --sysinfo: Add chasis suboptions Add the following --sysinfo suboptions: - chassis.manufacturer - chassis.version - chassis.serial - chassis.asset - chassis.sku --- .../compare/virt-install-singleton-config-2.xml | 14 ++++++++++++++ tests/clitest.py | 1 + virtinst/cli.py | 6 ++++++ virtinst/domain/sysinfo.py | 10 +++++++++- 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/tests/cli-test-xml/compare/virt-install-singleton-config-2.xml b/tests/cli-test-xml/compare/virt-install-singleton-config-2.xml index 66c5d312..ee4d0411 100644 --- a/tests/cli-test-xml/compare/virt-install-singleton-config-2.xml +++ b/tests/cli-test-xml/compare/virt-install-singleton-config-2.xml @@ -63,6 +63,13 @@ Tag Chassis + + Chassis Corp. + 4.0 + 1234chassis + chasset + chassku + /new/bootld @@ -251,6 +258,13 @@ Tag Chassis + + Chassis Corp. + 4.0 + 1234chassis + chasset + chassku + /new/bootld diff --git a/tests/clitest.py b/tests/clitest.py index 336e225c..02f913e5 100644 --- a/tests/clitest.py +++ b/tests/clitest.py @@ -461,6 +461,7 @@ cache.mode=emulate,cache.level=3 --sysinfo type=smbios,bios_vendor="Acme LLC",bios_version=1.2.3,bios_date=01/01/1970,bios_release=10.22 --sysinfo type=smbios,system_manufacturer="Acme Inc.",system_product=Computer,system_version=3.2.1,system_serial=123456789,system_uuid=00000000-1111-2222-3333-444444444444,system_sku=abc-123,system_family=Server --sysinfo type=smbios,baseBoard_manufacturer="Acme Corp.",baseBoard_product=Motherboard,baseBoard_version=A01,baseBoard_serial=1234-5678,baseBoard_asset=Tag,baseBoard_location=Chassis +--sysinfo type=smbios,chassis.manufacturer="Chassis Corp.",chassis.serial=1234chassis,chassis.asset=chasset,chassis.sku=chassku,chassis.version=4.0 --pm suspend_to_mem=yes,suspend_to_disk=no --resource partition=/virtualmachines/production --events on_poweroff=destroy,on_reboot=restart,on_crash=preserve,on_lockfailure=ignore diff --git a/virtinst/cli.py b/virtinst/cli.py index ae38494b..2b961583 100644 --- a/virtinst/cli.py +++ b/virtinst/cli.py @@ -2411,6 +2411,12 @@ class ParserSysinfo(VirtCLIParser): cls.add_arg("baseBoard.asset", "baseBoard_asset") cls.add_arg("baseBoard.location", "baseBoard_location") + cls.add_arg("chassis.manufacturer", "chassis_manufacturer") + cls.add_arg("chassis.version", "chassis_version") + cls.add_arg("chassis.serial", "chassis_serial") + cls.add_arg("chassis.asset", "chassis_asset") + cls.add_arg("chassis.sku", "chassis_sku") + ############################## # --qemu-commandline parsing # diff --git a/virtinst/domain/sysinfo.py b/virtinst/domain/sysinfo.py index bab16262..0925474d 100644 --- a/virtinst/domain/sysinfo.py +++ b/virtinst/domain/sysinfo.py @@ -19,7 +19,9 @@ class DomainSysinfo(XMLBuilder): "system_manufacturer", "system_product", "system_version", "system_serial", "system_uuid", "system_sku", "system_family", "baseBoard_manufacturer", "baseBoard_product", "baseBoard_version", - "baseBoard_serial", "baseBoard_asset", "baseBoard_location"] + "baseBoard_serial", "baseBoard_asset", "baseBoard_location", + "chassis_manufacturer", "chassis_version", + "chassis_serial", "chassis_asset", "chassis_sku"] type = XMLProperty("./@type") @@ -43,3 +45,9 @@ class DomainSysinfo(XMLBuilder): baseBoard_serial = XMLProperty("./baseBoard/entry[@name='serial']") baseBoard_asset = XMLProperty("./baseBoard/entry[@name='asset']") baseBoard_location = XMLProperty("./baseBoard/entry[@name='location']") + + chassis_manufacturer = XMLProperty("./chassis/entry[@name='manufacturer']") + chassis_version = XMLProperty("./chassis/entry[@name='version']") + chassis_serial = XMLProperty("./chassis/entry[@name='serial']") + chassis_asset = XMLProperty("./chassis/entry[@name='asset']") + chassis_sku = XMLProperty("./chassis/entry[@name='sku']")