mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
virtinst: Add classes for defining SMBios information
This includes adding an smbios sub-element to the guest os element and a sysinfo sub-element to the guest. The sysinfo sub-element contains the SMBios specific data.
This commit is contained in:
parent
8296c5b74f
commit
b31c0b442e
@ -52,6 +52,7 @@ from .idmap import IdMap
|
|||||||
from .osxml import OSXML
|
from .osxml import OSXML
|
||||||
from .pm import PM
|
from .pm import PM
|
||||||
from .seclabel import Seclabel
|
from .seclabel import Seclabel
|
||||||
|
from .sysinfo import SYSInfo
|
||||||
from .xmlbuilder import XMLBuilder, XMLProperty, XMLChildProperty
|
from .xmlbuilder import XMLBuilder, XMLProperty, XMLChildProperty
|
||||||
|
|
||||||
|
|
||||||
@ -106,7 +107,7 @@ class Guest(XMLBuilder):
|
|||||||
"vcpus", "curvcpus", "vcpu_placement", "cpuset",
|
"vcpus", "curvcpus", "vcpu_placement", "cpuset",
|
||||||
"numatune", "bootloader", "os", "idmap",
|
"numatune", "bootloader", "os", "idmap",
|
||||||
"features", "cpu", "clock", "on_poweroff", "on_reboot", "on_crash",
|
"features", "cpu", "clock", "on_poweroff", "on_reboot", "on_crash",
|
||||||
"resource", "pm", "emulator", "_devices", "seclabels"]
|
"resource", "pm", "emulator", "_devices", "seclabels", "sysinfo"]
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
XMLBuilder.__init__(self, *args, **kwargs)
|
XMLBuilder.__init__(self, *args, **kwargs)
|
||||||
@ -212,6 +213,7 @@ class Guest(XMLBuilder):
|
|||||||
memoryBacking = XMLChildProperty(DomainMemorybacking, is_single=True)
|
memoryBacking = XMLChildProperty(DomainMemorybacking, is_single=True)
|
||||||
idmap = XMLChildProperty(IdMap, is_single=True)
|
idmap = XMLChildProperty(IdMap, is_single=True)
|
||||||
resource = XMLChildProperty(DomainResource, is_single=True)
|
resource = XMLChildProperty(DomainResource, is_single=True)
|
||||||
|
sysinfo = XMLChildProperty(SYSInfo, is_single=True)
|
||||||
|
|
||||||
|
|
||||||
###############################
|
###############################
|
||||||
|
@ -77,7 +77,7 @@ class OSXML(XMLBuilder):
|
|||||||
_XML_ROOT_NAME = "os"
|
_XML_ROOT_NAME = "os"
|
||||||
_XML_PROP_ORDER = ["arch", "os_type", "loader", "loader_ro", "loader_type",
|
_XML_PROP_ORDER = ["arch", "os_type", "loader", "loader_ro", "loader_type",
|
||||||
"nvram", "nvram_template", "kernel", "initrd",
|
"nvram", "nvram_template", "kernel", "initrd",
|
||||||
"kernel_args", "dtb", "_bootdevs"]
|
"kernel_args", "dtb", "_bootdevs", "smbios_mode"]
|
||||||
|
|
||||||
def _get_bootorder(self):
|
def _get_bootorder(self):
|
||||||
return [dev.dev for dev in self._bootdevs]
|
return [dev.dev for dev in self._bootdevs]
|
||||||
@ -116,6 +116,7 @@ class OSXML(XMLBuilder):
|
|||||||
loader = XMLProperty("./loader")
|
loader = XMLProperty("./loader")
|
||||||
loader_ro = XMLProperty("./loader/@readonly", is_yesno=True)
|
loader_ro = XMLProperty("./loader/@readonly", is_yesno=True)
|
||||||
loader_type = XMLProperty("./loader/@type")
|
loader_type = XMLProperty("./loader/@type")
|
||||||
|
smbios_mode = XMLProperty("./smbios/@mode")
|
||||||
nvram = XMLProperty("./nvram")
|
nvram = XMLProperty("./nvram")
|
||||||
nvram_template = XMLProperty("./nvram/@template")
|
nvram_template = XMLProperty("./nvram/@template")
|
||||||
arch = XMLProperty("./type/@arch",
|
arch = XMLProperty("./type/@arch",
|
||||||
|
61
virtinst/sysinfo.py
Normal file
61
virtinst/sysinfo.py
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
#
|
||||||
|
# Copyright (C) 2016 Red Hat, Inc.
|
||||||
|
# Copyright (C) 2016 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||||
|
# Charles Arnold <carnold suse com>
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
# MA 02110-1301 USA.
|
||||||
|
"""
|
||||||
|
Classes for building and installing with libvirt <sysinfo> XML
|
||||||
|
"""
|
||||||
|
|
||||||
|
from .xmlbuilder import XMLBuilder, XMLProperty
|
||||||
|
|
||||||
|
|
||||||
|
class SYSInfo(XMLBuilder):
|
||||||
|
"""
|
||||||
|
Top level class for <sysinfo type='smbios'> object XML
|
||||||
|
"""
|
||||||
|
|
||||||
|
_XML_ROOT_NAME = "sysinfo"
|
||||||
|
_XML_PROP_ORDER = ["type",
|
||||||
|
"bios_vendor", "bios_version", "bios_date", "bios_release",
|
||||||
|
"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"]
|
||||||
|
|
||||||
|
type = XMLProperty("./@type")
|
||||||
|
|
||||||
|
bios_vendor = XMLProperty("./bios/entry[@name='vendor']")
|
||||||
|
bios_version = XMLProperty("./bios/entry[@name='version']")
|
||||||
|
bios_date = XMLProperty("./bios/entry[@name='date']")
|
||||||
|
bios_release = XMLProperty("./bios/entry[@name='release']")
|
||||||
|
|
||||||
|
system_manufacturer = XMLProperty("./system/entry[@name='manufacturer']")
|
||||||
|
system_product = XMLProperty("./system/entry[@name='product']")
|
||||||
|
system_version = XMLProperty("./system/entry[@name='version']")
|
||||||
|
system_serial = XMLProperty("./system/entry[@name='serial']")
|
||||||
|
system_uuid = XMLProperty("./system/entry[@name='uuid']")
|
||||||
|
system_sku = XMLProperty("./system/entry[@name='sku']")
|
||||||
|
system_family = XMLProperty("./system/entry[@name='family']")
|
||||||
|
|
||||||
|
baseBoard_manufacturer = XMLProperty(
|
||||||
|
"./baseBoard/entry[@name='manufacturer']")
|
||||||
|
baseBoard_product = XMLProperty("./baseBoard/entry[@name='product']")
|
||||||
|
baseBoard_version = XMLProperty("./baseBoard/entry[@name='version']")
|
||||||
|
baseBoard_serial = XMLProperty("./baseBoard/entry[@name='serial']")
|
||||||
|
baseBoard_asset = XMLProperty("./baseBoard/entry[@name='asset']")
|
||||||
|
baseBoard_location = XMLProperty("./baseBoard/entry[@name='location']")
|
Loading…
Reference in New Issue
Block a user