mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-01-12 09:18:00 +03:00
cli: --sysinfo: Add oemStrings.entry[0-9]*
This commit is contained in:
parent
d16425aa8f
commit
7083294e2c
tests
virtinst
@ -70,6 +70,11 @@
|
||||
<entry name="asset">chasset</entry>
|
||||
<entry name="sku">chassku</entry>
|
||||
</chassis>
|
||||
<oemStrings>
|
||||
<entry>test0</entry>
|
||||
<entry>test1</entry>
|
||||
<entry>complicated parsing, foo=bar</entry>
|
||||
</oemStrings>
|
||||
</sysinfo>
|
||||
<bootloader>/new/bootld</bootloader>
|
||||
<os>
|
||||
@ -265,6 +270,11 @@
|
||||
<entry name="asset">chasset</entry>
|
||||
<entry name="sku">chassku</entry>
|
||||
</chassis>
|
||||
<oemStrings>
|
||||
<entry>test0</entry>
|
||||
<entry>test1</entry>
|
||||
<entry>complicated parsing, foo=bar</entry>
|
||||
</oemStrings>
|
||||
</sysinfo>
|
||||
<bootloader>/new/bootld</bootloader>
|
||||
<os>
|
||||
|
@ -462,6 +462,7 @@ cache.mode=emulate,cache.level=3
|
||||
--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
|
||||
--sysinfo type=smbios,oemStrings.entry2="complicated parsing, foo=bar",oemStrings.entry1=test1,oemStrings.entry0=test0
|
||||
--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
|
||||
|
@ -2382,6 +2382,13 @@ class ParserSysinfo(VirtCLIParser):
|
||||
inst.system_uuid = val
|
||||
self.guest.uuid = val
|
||||
|
||||
def oem_find_inst_cb(self, *args, **kwargs):
|
||||
# pylint: disable=protected-access
|
||||
cliarg = "entry" # oemStrings.entry[0-9]*
|
||||
list_propname = "oemStrings" # sysinfo.oemStrings
|
||||
cb = self._make_find_inst_cb(cliarg, list_propname)
|
||||
return cb(*args, **kwargs)
|
||||
|
||||
@classmethod
|
||||
def _init_class(cls, **kwargs):
|
||||
VirtCLIParser._init_class(**kwargs)
|
||||
@ -2417,6 +2424,9 @@ class ParserSysinfo(VirtCLIParser):
|
||||
cls.add_arg("chassis.asset", "chassis_asset")
|
||||
cls.add_arg("chassis.sku", "chassis_sku")
|
||||
|
||||
cls.add_arg("oemStrings.entry[0-9]", "value", can_comma=True,
|
||||
find_inst_cb=cls.oem_find_inst_cb)
|
||||
|
||||
|
||||
##############################
|
||||
# --qemu-commandline parsing #
|
||||
|
@ -5,7 +5,12 @@
|
||||
# This work is licensed under the GNU GPLv2 or later.
|
||||
# See the COPYING file in the top-level directory.
|
||||
|
||||
from ..xmlbuilder import XMLBuilder, XMLProperty
|
||||
from ..xmlbuilder import XMLBuilder, XMLChildProperty, XMLProperty
|
||||
|
||||
|
||||
class _SysinfoEntry(XMLBuilder):
|
||||
XML_NAME = "entry"
|
||||
value = XMLProperty(".")
|
||||
|
||||
|
||||
class DomainSysinfo(XMLBuilder):
|
||||
@ -21,7 +26,7 @@ class DomainSysinfo(XMLBuilder):
|
||||
"baseBoard_manufacturer", "baseBoard_product", "baseBoard_version",
|
||||
"baseBoard_serial", "baseBoard_asset", "baseBoard_location",
|
||||
"chassis_manufacturer", "chassis_version",
|
||||
"chassis_serial", "chassis_asset", "chassis_sku"]
|
||||
"chassis_serial", "chassis_asset", "chassis_sku", "oemStrings"]
|
||||
|
||||
type = XMLProperty("./@type")
|
||||
|
||||
@ -51,3 +56,5 @@ class DomainSysinfo(XMLBuilder):
|
||||
chassis_serial = XMLProperty("./chassis/entry[@name='serial']")
|
||||
chassis_asset = XMLProperty("./chassis/entry[@name='asset']")
|
||||
chassis_sku = XMLProperty("./chassis/entry[@name='sku']")
|
||||
|
||||
oemStrings = XMLChildProperty(_SysinfoEntry, relative_xpath="./oemStrings")
|
||||
|
Loading…
Reference in New Issue
Block a user