mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-08-04 08:21:59 +03:00
domain: Add metadata.libosinfo
From the libosinfo discussion here: https://www.redhat.com/archives/libosinfo/2018-September/msg00003.html This is a cross-app schema for tracking libosinfo OS ID in the domain <metadata> XML. Example: <metadata> <libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0"> <libosinfo:os id="http://fedoraproject.org/fedora/17"/> </libosinfo:libosinfo> </metadata>
This commit is contained in:
@ -1,5 +1,10 @@
|
||||
<domain type="kvm">
|
||||
<name>TestGuest</name>
|
||||
<metadata>
|
||||
<libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
|
||||
<libosinfo:os id="http://fedoraproject.org/fedora/17"/>
|
||||
</libosinfo:libosinfo>
|
||||
</metadata>
|
||||
<currentMemory>204800</currentMemory>
|
||||
<memory>409600</memory>
|
||||
<uuid>12345678-1234-1234-1234-123456789012</uuid>
|
||||
|
@ -1,5 +1,10 @@
|
||||
<domain type="test" id="1234">
|
||||
<name>change_name</name>
|
||||
<metadata>
|
||||
<libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
|
||||
<libosinfo:os id="frib"/>
|
||||
</libosinfo:libosinfo>
|
||||
</metadata>
|
||||
<currentMemory>1024000</currentMemory>
|
||||
<memory>2048000</memory>
|
||||
<uuid>11111111-2222-3333-4444-555555555555</uuid>
|
||||
|
@ -115,6 +115,9 @@ class XMLParseTest(unittest.TestCase):
|
||||
check("on_crash", "destroy", "restart")
|
||||
check("on_lockfailure", "poweroff", "restart")
|
||||
|
||||
check = self._make_checker(guest._metadata.libosinfo) # pylint: disable=protected-access
|
||||
check("os_id", "http://fedoraproject.org/fedora/17", "frib")
|
||||
|
||||
check = self._make_checker(guest.clock)
|
||||
check("offset", "utc", "localtime")
|
||||
guest.clock.remove_child(guest.clock.timers[0])
|
||||
|
@ -8,6 +8,7 @@ from .cpu import DomainCpu
|
||||
from .cputune import DomainCputune
|
||||
from .features import DomainFeatures
|
||||
from .idmap import DomainIdmap
|
||||
from .metadata import DomainMetadata
|
||||
from .memorybacking import DomainMemoryBacking
|
||||
from .memtune import DomainMemtune
|
||||
from .numatune import DomainNumatune
|
||||
|
26
virtinst/domain/metadata.py
Normal file
26
virtinst/domain/metadata.py
Normal file
@ -0,0 +1,26 @@
|
||||
# Copyright 2017 Red Hat, Inc.
|
||||
# Cole Robinson <crobinso@redhat.com>
|
||||
#
|
||||
# This work is licensed under the GNU GPLv2 or later.
|
||||
# See the COPYING file in the top-level directory.
|
||||
|
||||
from ..xmlbuilder import XMLBuilder, XMLChildProperty, XMLProperty
|
||||
|
||||
|
||||
XMLBuilder.register_namespace(
|
||||
"libosinfo", "http://libosinfo.org/xmlns/libvirt/domain/1.0")
|
||||
|
||||
|
||||
class _XMLNSLibosinfo(XMLBuilder):
|
||||
XML_NAME = "libosinfo:libosinfo"
|
||||
|
||||
os_id = XMLProperty("./libosinfo:os/@id")
|
||||
|
||||
|
||||
class DomainMetadata(XMLBuilder):
|
||||
"""
|
||||
Class for generating <metadata> XML
|
||||
"""
|
||||
XML_NAME = "metadata"
|
||||
|
||||
libosinfo = XMLChildProperty(_XMLNSLibosinfo, is_single=True)
|
@ -139,7 +139,8 @@ class Guest(XMLBuilder):
|
||||
#################
|
||||
|
||||
XML_NAME = "domain"
|
||||
_XML_PROP_ORDER = ["type", "name", "uuid", "title", "description",
|
||||
_XML_PROP_ORDER = [
|
||||
"type", "name", "uuid", "title", "description", "_metadata",
|
||||
"hotplugmemorymax", "hotplugmemoryslots", "maxmemory", "_memory",
|
||||
"blkiotune", "memtune", "memoryBacking",
|
||||
"_vcpus", "curvcpus", "vcpu_placement",
|
||||
@ -230,6 +231,7 @@ class Guest(XMLBuilder):
|
||||
idmap = XMLChildProperty(DomainIdmap, is_single=True)
|
||||
resource = XMLChildProperty(DomainResource, is_single=True)
|
||||
sysinfo = XMLChildProperty(DomainSysinfo, is_single=True)
|
||||
_metadata = XMLChildProperty(DomainMetadata, is_single=True)
|
||||
|
||||
xmlns_qemu = XMLChildProperty(DomainXMLNSQemu, is_single=True)
|
||||
|
||||
|
Reference in New Issue
Block a user