diff --git a/559e813b-xmlbuilder-02.patch b/559e813b-xmlbuilder-02.patch new file mode 100644 index 00000000..8107454e --- /dev/null +++ b/559e813b-xmlbuilder-02.patch @@ -0,0 +1,134 @@ +References: fate#319621 + +Subject: xmlbuilder: Clarify the node 'pretty' helper function +From: Cole Robinson crobinso@redhat.com Mon Jul 18 13:23:43 2016 -0400 +Date: Mon Jul 18 14:46:50 2016 -0400: +Git: 559e813b966c8e062740dd64d87f3193b0413771 + + +Index: virt-manager-1.4.0/virtinst/xmlbuilder.py +=================================================================== +--- virt-manager-1.4.0.orig/virtinst/xmlbuilder.py ++++ virt-manager-1.4.0/virtinst/xmlbuilder.py +@@ -98,14 +98,13 @@ def _get_xpath_node(ctx, xpath): + return (node and node[0] or None) + + +-def _build_xpath_node(ctx, xpath, addnode=None): ++def _add_pretty_child(parentnode, newnode): + """ +- Build all nodes required to set an xpath. If we have XML , and want +- to set xpath /foo/bar/baz@booyeah, we create node 'bar' and 'baz' +- returning the last node created. ++ Add 'newnode' as a child of 'parentnode', but try to preserve ++ whitespace and nicely format the result. + """ +- parentpath = "" +- parentnode = None ++ def node_is_text(n): ++ return bool(n and n.type == "text" and not n.content.count("<")) + + def prevSibling(node): + parent = node.get_parent() +@@ -120,47 +119,51 @@ def _build_xpath_node(ctx, xpath, addnod + + return None + +- def make_node(parentnode, newnode): +- # Add the needed parent node, try to preserve whitespace by +- # looking for a starting TEXT node, and copying it +- def node_is_text(n): +- return bool(n and n.type == "text" and not n.content.count("<")) +- +- sib = parentnode.get_last() +- if not node_is_text(sib): +- # This case is when we add a child element to a node for the +- # first time, like: +- # +- # +- # to +- # +- # +- # +- prevsib = prevSibling(parentnode) +- if node_is_text(prevsib): +- sib = libxml2.newText(prevsib.content) +- else: +- sib = libxml2.newText("\n") +- parentnode.addChild(sib) +- +- # This case is adding a child element to an already properly +- # spaced element. Example: +- # +- # +- # ++ sib = parentnode.get_last() ++ if not node_is_text(sib): ++ # This case is when we add a child element to a node for the ++ # first time, like: ++ # ++ # + # to + # + # +- # + # +- sib = parentnode.get_last() +- content = sib.content +- sib = sib.addNextSibling(libxml2.newText(" ")) +- txt = libxml2.newText(content) +- +- sib.addNextSibling(newnode) +- newnode.addNextSibling(txt) +- return newnode ++ prevsib = prevSibling(parentnode) ++ if node_is_text(prevsib): ++ sib = libxml2.newText(prevsib.content) ++ else: ++ sib = libxml2.newText("\n") ++ parentnode.addChild(sib) ++ ++ # This case is adding a child element to an already properly ++ # spaced element. Example: ++ # ++ # ++ # ++ # to ++ # ++ # ++ # ++ # ++ sib = parentnode.get_last() ++ content = sib.content ++ sib = sib.addNextSibling(libxml2.newText(" ")) ++ txt = libxml2.newText(content) ++ ++ sib.addNextSibling(newnode) ++ newnode.addNextSibling(txt) ++ return newnode ++ ++ ++def _build_xpath_node(ctx, xpath, addnode=None): ++ """ ++ Build all nodes required to set an xpath. If we have XML , and want ++ to set xpath /foo/bar/baz@booyeah, we create node 'bar' and 'baz' ++ returning the last node created. ++ """ ++ parentpath = "" ++ parentnode = None + + nodelist = xpath.split("/") + for nodename in nodelist: +@@ -192,10 +195,10 @@ def _build_xpath_node(ctx, xpath, addnod + nodename = nodename[:nodename.index("[")] + + newnode = libxml2.newNode(nodename) +- parentnode = make_node(parentnode, newnode) ++ parentnode = _add_pretty_child(parentnode, newnode) + + if addnode: +- parentnode = make_node(parentnode, addnode) ++ parentnode = _add_pretty_child(parentnode, addnode) + + return parentnode + diff --git a/835ddc5f-xmlbuilder-04.patch b/835ddc5f-xmlbuilder-04.patch new file mode 100644 index 00000000..dfa598a6 --- /dev/null +++ b/835ddc5f-xmlbuilder-04.patch @@ -0,0 +1,87 @@ +References: fate#319621 + +Subject: xmlbuilder: More comments for _build_xpath_node +From: Cole Robinson crobinso@redhat.com Mon Jul 18 13:50:25 2016 -0400 +Date: Mon Jul 18 14:46:50 2016 -0400: +Git: 835ddc5f7710d195a8d069358693712e68f2b353 + + +Index: virt-manager-1.4.0/virtinst/xmlbuilder.py +=================================================================== +--- virt-manager-1.4.0.orig/virtinst/xmlbuilder.py ++++ virt-manager-1.4.0/virtinst/xmlbuilder.py +@@ -158,44 +158,56 @@ def _add_pretty_child(parentnode, newnod + + def _build_xpath_node(ctx, xpath): + """ +- Build all nodes required to set an xpath. If we have XML , and want +- to set xpath /foo/bar/baz@booyeah, we create node 'bar' and 'baz' +- returning the last node created. +- """ +- parentpath = "" +- parentnode = None ++ Build all nodes for the passed xpath. For example, if 'ctx' xml=, ++ and xpath=./bar/@baz, after this function the 'ctx' XML will be: + +- nodelist = xpath.split("/") +- for nodename in nodelist: +- if not nodename: +- continue ++ ++ ++ ++ ++ And the node pointing to @baz will be returned, for the caller to ++ do with as they please. ++ """ ++ def _handle_node(nodename, parentnode, parentpath): ++ # If the passed xpath snippet (nodename) exists, return the node ++ # If it doesn't exist, create it, and return the new node + +- # If xpath is a node property, set it and move on ++ # If nodename is a node property, we can handle it up front + if nodename.startswith("@"): + nodename = nodename.strip("@") +- parentnode = parentnode.setProp(nodename, "") +- continue ++ return parentnode.setProp(nodename, ""), parentpath + + if not parentpath: + parentpath = nodename + else: + parentpath += "/%s" % nodename + +- # Node found, nothing to create for now ++ # See if the xpath node already exists + node = _get_xpath_node(ctx, parentpath) + if node: +- parentnode = node +- continue ++ # xpath node already exists, so we don't need to create anything ++ return node, parentpath + ++ # If we don't have a parentnode by this point, the root of the ++ # xpath didn't find anything. Usually a coding error + if not parentnode: + raise RuntimeError("Could not find XML root node") + +- # Remove conditional xpath elements for node creation ++ # Remove conditional xpath elements for node creation. We preserved ++ # them up until this point since it was needed for proper xpath ++ # lookup, but they aren't valid syntax when creating the node + if nodename.count("["): + nodename = nodename[:nodename.index("[")] + + newnode = libxml2.newNode(nodename) +- parentnode = _add_pretty_child(parentnode, newnode) ++ return _add_pretty_child(parentnode, newnode), parentpath ++ ++ ++ # Split the xpath and lookup/create each individual piece ++ parentpath = None ++ parentnode = None ++ for nodename in xpath.split("/"): ++ parentnode, parentpath = _handle_node(nodename, parentnode, parentpath) + + return parentnode + diff --git a/a3206f89-Add-the-sysinfo-option.patch b/a3206f89-Add-the-sysinfo-option.patch new file mode 100644 index 00000000..65c1d066 --- /dev/null +++ b/a3206f89-Add-the-sysinfo-option.patch @@ -0,0 +1,258 @@ +Subject: virtinst: Add the --sysinfo option +From: Charles Arnold carnold@suse.com Tue Sep 6 16:12:20 2016 -0600 +Date: Thu Sep 8 11:36:59 2016 -0400: +Git: a3206f89c89ff4f197748f2a7d1040380afc835d + +Allow passing SMBios information to the guest using the new sysinfo +option. Also update the appropriate files with test cases. + +Index: virt-manager-1.4.0/tests/cli-test-xml/compare/virt-install-singleton-config-2.xml +=================================================================== +--- virt-manager-1.4.0.orig/tests/cli-test-xml/compare/virt-install-singleton-config-2.xml ++++ virt-manager-1.4.0/tests/cli-test-xml/compare/virt-install-singleton-config-2.xml +@@ -36,6 +36,7 @@ + + + ++ + + + +@@ -122,6 +123,31 @@ + + + ++ ++ ++ Acme LLC ++ 1.2.3 ++ 01/01/1970 ++ 10.22 ++ ++ ++ Acme Inc. ++ Computer ++ 3.2.1 ++ 123456789 ++ 00000000-1111-2222-3333-444444444444 ++ abc-123 ++ Server ++ ++ ++ Acme Corp. ++ Motherboard ++ A01 ++ 1234-5678 ++ Tag ++ Chassis ++ ++ + ignore + + +@@ -162,6 +188,7 @@ + + + ++ + + + +@@ -248,5 +275,30 @@ + + + ++ ++ ++ Acme LLC ++ 1.2.3 ++ 01/01/1970 ++ 10.22 ++ ++ ++ Acme Inc. ++ Computer ++ 3.2.1 ++ 123456789 ++ 00000000-1111-2222-3333-444444444444 ++ abc-123 ++ Server ++ ++ ++ Acme Corp. ++ Motherboard ++ A01 ++ 1234-5678 ++ Tag ++ Chassis ++ ++ + ignore + +Index: virt-manager-1.4.0/tests/clitest.py +=================================================================== +--- virt-manager-1.4.0.orig/tests/clitest.py ++++ virt-manager-1.4.0/tests/clitest.py +@@ -427,6 +427,9 @@ c.add_compare("""--pxe \ + --memorybacking size=1,unit='G',nodeset='1,2-5',nosharepages=yes,locked=yes \ + --features acpi=off,eoi=on,privnet=on,hyperv_spinlocks=on,hyperv_spinlocks_retries=1234,vmport=off,pmu=off \ + --clock offset=utc,hpet_present=no,rtc_tickpolicy=merge \ ++--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 \ + --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 \ +Index: virt-manager-1.4.0/virtinst/cli.py +=================================================================== +--- virt-manager-1.4.0.orig/virtinst/cli.py ++++ virt-manager-1.4.0/virtinst/cli.py +@@ -21,6 +21,7 @@ + + import argparse + import collections ++import datetime + import logging + import logging.handlers + import os +@@ -67,6 +68,7 @@ from .osxml import OSXML + from .pm import PM + from .seclabel import Seclabel + from .storage import StoragePool, StorageVolume ++from .sysinfo import SYSInfo + + + ########################## +@@ -722,6 +724,13 @@ def add_guest_xml_options(geng): + help=_("Configure VM lifecycle management policy")) + geng.add_argument("--resource", action="append", + help=_("Configure VM resource partitioning (cgroups)")) ++ geng.add_argument("--sysinfo", action="append", ++ help=_("Configure SMBIOS System Information. Ex:\n" ++ "--sysinfo emulate\n" ++ "--sysinfo host\n" ++ "--sysinfo bios_vendor=Vendor_Inc.,bios_version=1.2.3-abc,...\n" ++ "--sysinfo system_manufacturer=System_Corp.,system_product=Computer,...\n" ++ "--sysinfo baseBoard_manufacturer=Baseboard_Corp.,baseBoard_product=Motherboard,...\n")) + + + def add_boot_options(insg): +@@ -1541,6 +1550,13 @@ class ParserBoot(VirtCLIParser): + def set_initargs_cb(self, inst, val, virtarg): + inst.os.set_initargs_string(val) + ++ def set_smbios_mode_cb(self, inst, val, virtarg): ++ if not val.startswith("emulate") and not val.startswith("host"): ++ inst.sysinfo.parse(val) ++ val = "sysinfo" ++ inst.os.smbios_mode = val ++ self.optdict["smbios_mode"] = val ++ + def noset_cb(self, inst, val, virtarg): + pass + +@@ -1584,6 +1600,8 @@ ParserBoot.add_arg("os.kernel_args", "ke + ParserBoot.add_arg("os.init", "init") + ParserBoot.add_arg("os.machine", "machine") + ParserBoot.add_arg("os.initargs", "initargs", cb=ParserBoot.set_initargs_cb) ++ParserBoot.add_arg("os.smbios_mode", "smbios_mode", ++ can_comma=True, cb=ParserBoot.set_smbios_mode_cb) + + # This is simply so the boot options are advertised with --boot help, + # actual processing is handled by _parse +@@ -1702,6 +1720,95 @@ ParserPM.add_arg("suspend_to_mem", "susp + ParserPM.add_arg("suspend_to_disk", "suspend_to_disk", is_onoff=True) + + ++##################### ++# --sysinfo parsing # ++##################### ++ ++class ParserSYSInfo(VirtCLIParser): ++ cli_arg_name = "sysinfo" ++ objclass = SYSInfo ++ remove_first = "type" ++ ++ def set_type_cb(self, inst, val, virtarg): ++ if val == "host" or val == "emulate": ++ self.guest.os.smbios_mode = val ++ elif val == "smbios": ++ self.guest.os.smbios_mode = "sysinfo" ++ inst.type = val ++ else: ++ fail(_("Unknown sysinfo flag '%s'") % val) ++ ++ def validate_date_cb(self, inst, val, virtarg): ++ # If supplied, date must be in either mm/dd/yy or mm/dd/yyyy format ++ try: ++ datetime.datetime.strptime(val, '%m/%d/%Y') ++ except ValueError: ++ try: ++ datetime.datetime.strptime(val, '%m/%d/%y') ++ except ValueError: ++ raise RuntimeError(_("SMBios date string '%s' is invalid.") ++ % val) ++ inst.bios_date = val ++ return val ++ ++ def validate_uuid_cb(self, inst, val, virtarg): ++ # If a uuid is supplied it must match the guest UUID. This would be ++ # impossible to guess if the guest uuid is autogenerated so just ++ # overwrite the guest uuid with what is passed in assuming it passes ++ # the sanity checking below. ++ try: ++ util.validate_uuid(val) ++ except ValueError: ++ raise ValueError(_("Invalid uuid for SMBios: %s") % val) ++ ++ if util.vm_uuid_collision(self.guest.conn, val): ++ raise ValueError(_("UUID '%s' is in use by another guest.") % ++ val) ++ ++ # Override guest uuid with passed in SMBios value (they must match) ++ self.guest.uuid = val ++ inst.system_uuid = val ++ ++ def _parse(self, inst): ++ if self.optstr == "none": ++ self.guest.skip_default_sysinfo = True ++ return ++ if self.optstr == "host" or self.optstr == "emulate": ++ self.optdict['type'] = self.optstr ++ ++ return VirtCLIParser._parse(self, inst) ++ ++_register_virt_parser(ParserSYSInfo) ++# ++ParserSYSInfo.add_arg("type", "type", ++ cb=ParserSYSInfo.set_type_cb, can_comma=True) ++ ++# type 0 BIOS Information ++ParserSYSInfo.add_arg("bios_vendor", "bios_vendor") ++ParserSYSInfo.add_arg("bios_version", "bios_version") ++ParserSYSInfo.add_arg("bios_date", "bios_date", ++ cb=ParserSYSInfo.validate_date_cb) ++ParserSYSInfo.add_arg("bios_release", "bios_release") ++ ++# type 1 System Information ++ParserSYSInfo.add_arg("system_manufacturer", "system_manufacturer") ++ParserSYSInfo.add_arg("system_product", "system_product") ++ParserSYSInfo.add_arg("system_version", "system_version") ++ParserSYSInfo.add_arg("system_serial", "system_serial") ++ParserSYSInfo.add_arg("system_uuid", "system_uuid", ++ cb=ParserSYSInfo.validate_uuid_cb) ++ParserSYSInfo.add_arg("system_sku", "system_sku") ++ParserSYSInfo.add_arg("system_family", "system_family") ++ ++# type 2 Baseboard (or Module) Information ++ParserSYSInfo.add_arg("baseBoard_manufacturer", "baseBoard_manufacturer") ++ParserSYSInfo.add_arg("baseBoard_product", "baseBoard_product") ++ParserSYSInfo.add_arg("baseBoard_version", "baseBoard_version") ++ParserSYSInfo.add_arg("baseBoard_serial", "baseBoard_serial") ++ParserSYSInfo.add_arg("baseBoard_asset", "baseBoard_asset") ++ParserSYSInfo.add_arg("baseBoard_location", "baseBoard_location") ++ ++ + ########################## + # Guest parsing # + ########################## diff --git a/a931a1a6-xmlbuilder-03.patch b/a931a1a6-xmlbuilder-03.patch new file mode 100644 index 00000000..9f1dba6e --- /dev/null +++ b/a931a1a6-xmlbuilder-03.patch @@ -0,0 +1,42 @@ +References: fate#319621 + +Subject: xmlbuilder: Opencode single addnode= usage +From: Cole Robinson crobinso@redhat.com Mon Jul 18 13:34:06 2016 -0400 +Date: Mon Jul 18 14:46:50 2016 -0400: +Git: a931a1a6adf768f73c223f9b8d78fb7ca25cb0a3 + + +Index: virt-manager-1.4.0/virtinst/xmlbuilder.py +=================================================================== +--- virt-manager-1.4.0.orig/virtinst/xmlbuilder.py ++++ virt-manager-1.4.0/virtinst/xmlbuilder.py +@@ -156,7 +156,7 @@ def _add_pretty_child(parentnode, newnod + return newnode + + +-def _build_xpath_node(ctx, xpath, addnode=None): ++def _build_xpath_node(ctx, xpath): + """ + Build all nodes required to set an xpath. If we have XML , and want + to set xpath /foo/bar/baz@booyeah, we create node 'bar' and 'baz' +@@ -197,9 +197,6 @@ def _build_xpath_node(ctx, xpath, addnod + newnode = libxml2.newNode(nodename) + parentnode = _add_pretty_child(parentnode, newnode) + +- if addnode: +- parentnode = _add_pretty_child(parentnode, addnode) +- + return parentnode + + +@@ -989,7 +986,9 @@ class XMLBuilder(object): + use_xpath = obj.get_root_xpath().rsplit("/", 1)[0] + indent = 2 * obj.get_root_xpath().count("/") + newnode = libxml2.parseDoc(util.xml_indent(xml, indent)).children +- _build_xpath_node(self._xmlstate.xml_ctx, use_xpath, newnode) ++ parentnode = _build_xpath_node(self._xmlstate.xml_ctx, use_xpath) ++ # Tack newnode on the end ++ _add_pretty_child(parentnode, newnode) + obj._parse_with_children(None, self._xmlstate.xml_node) + + def remove_child(self, obj): diff --git a/b08647c2-xmlbuilder-05.patch b/b08647c2-xmlbuilder-05.patch new file mode 100644 index 00000000..20000468 --- /dev/null +++ b/b08647c2-xmlbuilder-05.patch @@ -0,0 +1,63 @@ +References: fate#319621 + +Subject: xmlbuilder: Handle setting conditional xpaths correctly +From: Cole Robinson crobinso@redhat.com Mon Jul 18 14:40:58 2016 -0400 +Date: Mon Jul 18 14:46:50 2016 -0400: +Git: b08647c2f277e463971ae1e4430aaed28a4619f3 + +So if xml= and xpath=./bar[@baz='foo'] and val=XXX, xmlbuilder +previously would generate XML + + + XXX + + +But now generates the expected + + + XXX + + +No users yet, but they are incoming + +Index: virt-manager-1.4.0/virtinst/xmlbuilder.py +=================================================================== +--- virt-manager-1.4.0.orig/virtinst/xmlbuilder.py ++++ virt-manager-1.4.0/virtinst/xmlbuilder.py +@@ -167,6 +167,16 @@ def _build_xpath_node(ctx, xpath): + + And the node pointing to @baz will be returned, for the caller to + do with as they please. ++ ++ There's also special handling to ensure that setting ++ xpath=./bar[@baz='foo']/frob will create ++ ++ ++ ++ ++ ++ Even if didn't exist before. So we fill in the dependent property ++ expression values + """ + def _handle_node(nodename, parentnode, parentpath): + # If the passed xpath snippet (nodename) exists, return the node +@@ -209,6 +219,19 @@ def _build_xpath_node(ctx, xpath): + for nodename in xpath.split("/"): + parentnode, parentpath = _handle_node(nodename, parentnode, parentpath) + ++ # Check if the xpath snippet had an '=' expression in it, example: ++ # ++ # ./foo[@bar='baz'] ++ # ++ # If so, we also want to set , so that setting ++ # this XML element works as expected in this case. ++ if "[" not in nodename or "=" not in nodename: ++ continue ++ ++ propname, val = nodename.split("[")[1].strip("]").split("=") ++ propobj, ignore = _handle_node(propname, parentnode, parentpath) ++ propobj.setContent(val.strip("'")) ++ + return parentnode + + diff --git a/b31c0b44-Add-classes-for-defining-SMBios-information.patch b/b31c0b44-Add-classes-for-defining-SMBios-information.patch new file mode 100644 index 00000000..bad7ec8e --- /dev/null +++ b/b31c0b44-Add-classes-for-defining-SMBios-information.patch @@ -0,0 +1,125 @@ +Subject: virtinst: Add classes for defining SMBios information +From: Charles Arnold carnold@suse.com Tue Sep 6 16:12:19 2016 -0600 +Date: Thu Sep 8 11:36:59 2016 -0400: +Git: b31c0b442e9b1295d86cc49bd77c31919ab0cc02 + +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. + +Index: virt-manager-1.4.0/virtinst/guest.py +=================================================================== +--- virt-manager-1.4.0.orig/virtinst/guest.py ++++ virt-manager-1.4.0/virtinst/guest.py +@@ -52,6 +52,7 @@ from .idmap import IdMap + from .osxml import OSXML + from .pm import PM + from .seclabel import Seclabel ++from .sysinfo import SYSInfo + from .xmlbuilder import XMLBuilder, XMLProperty, XMLChildProperty + + +@@ -106,7 +107,7 @@ class Guest(XMLBuilder): + "vcpus", "curvcpus", "vcpu_placement", "cpuset", + "numatune", "bootloader", "os", "idmap", + "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): + XMLBuilder.__init__(self, *args, **kwargs) +@@ -212,6 +213,7 @@ class Guest(XMLBuilder): + memoryBacking = XMLChildProperty(DomainMemorybacking, is_single=True) + idmap = XMLChildProperty(IdMap, is_single=True) + resource = XMLChildProperty(DomainResource, is_single=True) ++ sysinfo = XMLChildProperty(SYSInfo, is_single=True) + + + ############################### +Index: virt-manager-1.4.0/virtinst/osxml.py +=================================================================== +--- virt-manager-1.4.0.orig/virtinst/osxml.py ++++ virt-manager-1.4.0/virtinst/osxml.py +@@ -77,7 +77,7 @@ class OSXML(XMLBuilder): + _XML_ROOT_NAME = "os" + _XML_PROP_ORDER = ["arch", "os_type", "loader", "loader_ro", "loader_type", + "nvram", "nvram_template", "kernel", "initrd", +- "kernel_args", "dtb", "_bootdevs"] ++ "kernel_args", "dtb", "_bootdevs", "smbios_mode"] + + def _get_bootorder(self): + return [dev.dev for dev in self._bootdevs] +@@ -116,6 +116,7 @@ class OSXML(XMLBuilder): + loader = XMLProperty("./loader") + loader_ro = XMLProperty("./loader/@readonly", is_yesno=True) + loader_type = XMLProperty("./loader/@type") ++ smbios_mode = XMLProperty("./smbios/@mode") + nvram = XMLProperty("./nvram") + nvram_template = XMLProperty("./nvram/@template") + arch = XMLProperty("./type/@arch", +Index: virt-manager-1.4.0/virtinst/sysinfo.py +=================================================================== +--- /dev/null ++++ virt-manager-1.4.0/virtinst/sysinfo.py +@@ -0,0 +1,61 @@ ++# ++# Copyright (C) 2016 Red Hat, Inc. ++# Copyright (C) 2016 SUSE LINUX Products GmbH, Nuernberg, Germany. ++# Charles Arnold ++# ++# 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 XML ++""" ++ ++from .xmlbuilder import XMLBuilder, XMLProperty ++ ++ ++class SYSInfo(XMLBuilder): ++ """ ++ Top level class for 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']") diff --git a/d8a0a788-xmlbuilder-01.patch b/d8a0a788-xmlbuilder-01.patch new file mode 100644 index 00000000..462c45a8 --- /dev/null +++ b/d8a0a788-xmlbuilder-01.patch @@ -0,0 +1,36 @@ +References: fate#319621 + +Subject: xmlbuilder: Update XMLProperty docs +From: Cole Robinson crobinso@redhat.com Mon Jul 18 12:46:59 2016 -0400 +Date: Mon Jul 18 14:46:50 2016 -0400: +Git: d8a0a78805b17778c37d181f7b3a0be145536e9b + + +Index: virt-manager-1.4.0/virtinst/xmlbuilder.py +=================================================================== +--- virt-manager-1.4.0.orig/virtinst/xmlbuilder.py ++++ virt-manager-1.4.0/virtinst/xmlbuilder.py +@@ -340,15 +340,16 @@ class XMLProperty(property): + is_bool=False, is_int=False, is_yesno=False, is_onoff=False, + default_cb=None, default_name=None, do_abspath=False): + """ +- Set a XMLBuilder class property that represents a value in the +- XML. For example ++ Set a XMLBuilder class property that maps to a value in an XML ++ document, indicated by the passed xpath. For example, for a ++ the definition may look like: + +- name = XMLProperty(get_name, set_name, xpath="/domain/name") ++ name = XMLProperty("./name") + +- When building XML from scratch (virt-install), name is a regular +- class property. When parsing and editting existing guest XML, we +- use the xpath value to map the name property to the underlying XML +- definition. ++ When building XML from scratch (virt-install), 'name' works ++ similar to a regular class property(). When parsing and editing ++ existing guest XML, we use the xpath value to get/set the value ++ in the parsed XML document. + + @param doc: option doc string for the property + @param xpath: xpath string which maps to the associated property diff --git a/virt-manager.changes b/virt-manager.changes index 19c3c0fe..f464c165 100644 --- a/virt-manager.changes +++ b/virt-manager.changes @@ -1,3 +1,15 @@ +------------------------------------------------------------------- +Thu Sep 8 10:03:24 MDT 2016 - carnold@suse.com + +- fate##319621 - KVM: Provide SMBIOS info to KVM virtual machines + d8a0a788-xmlbuilder-01.patch + 559e813b-xmlbuilder-02.patch + a931a1a6-xmlbuilder-03.patch + 835ddc5f-xmlbuilder-04.patch + b08647c2-xmlbuilder-05.patch + b31c0b44-Add-classes-for-defining-SMBios-information.patch + a3206f89-Add-the-sysinfo-option.patch + ------------------------------------------------------------------- Fri Aug 19 10:28:19 MDT 2016 - carnold@suse.com diff --git a/virt-manager.spec b/virt-manager.spec index 2da8e70c..833b7ff2 100644 --- a/virt-manager.spec +++ b/virt-manager.spec @@ -40,6 +40,13 @@ Source2: virt-install.desktop Patch1: e69cc002-spice-catch-failure-to-setup-usbdev-manager.patch Patch2: c5ce0ab5-connection-fix-transport-detection.patch Patch3: 6daff68a-fix-italian-lang-file.patch +Patch4: d8a0a788-xmlbuilder-01.patch +Patch5: 559e813b-xmlbuilder-02.patch +Patch6: a931a1a6-xmlbuilder-03.patch +Patch7: 835ddc5f-xmlbuilder-04.patch +Patch8: b08647c2-xmlbuilder-05.patch +Patch9: b31c0b44-Add-classes-for-defining-SMBios-information.patch +Patch10: a3206f89-Add-the-sysinfo-option.patch # SUSE Only Patch70: virtman-desktop.patch Patch71: virtman-kvm.patch @@ -160,6 +167,13 @@ machine). %patch1 -p1 %patch2 -p1 %patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 +%patch7 -p1 +%patch8 -p1 +%patch9 -p1 +%patch10 -p1 # SUSE Only %patch70 -p1 %patch71 -p1 diff --git a/virtinst-add-default-rng-device.patch b/virtinst-add-default-rng-device.patch index c70224f6..fae46af8 100644 --- a/virtinst-add-default-rng-device.patch +++ b/virtinst-add-default-rng-device.patch @@ -4,15 +4,15 @@ Index: virt-manager-1.4.0/virtinst/guest.py =================================================================== --- virt-manager-1.4.0.orig/virtinst/guest.py +++ virt-manager-1.4.0/virtinst/guest.py -@@ -54,6 +54,7 @@ from .pm import PM - from .seclabel import Seclabel - from .xmlbuilder import XMLBuilder, XMLProperty, XMLChildProperty - from .devicedisk import VirtualDisk +@@ -39,6 +39,7 @@ from .devicedisk import VirtualDisk + from .devicegraphics import VirtualGraphics + from .deviceinput import VirtualInputDevice + from .deviceredirdev import VirtualRedirDevice +from .devicerng import VirtualRNGDevice - - - class Guest(XMLBuilder): -@@ -654,6 +655,15 @@ class Guest(XMLBuilder): + from .devicevideo import VirtualVideoDevice + from .distroinstaller import DistroInstaller + from .domainblkiotune import DomainBlkiotune +@@ -655,6 +656,15 @@ class Guest(XMLBuilder): return self.add_device(VirtualGraphics(self.conn)) @@ -28,7 +28,7 @@ Index: virt-manager-1.4.0/virtinst/guest.py def add_default_devices(self): self.add_default_graphics() self.add_default_video_device() -@@ -661,6 +671,7 @@ class Guest(XMLBuilder): +@@ -662,6 +672,7 @@ class Guest(XMLBuilder): self.add_default_console_device() self.add_default_usb_controller() self.add_default_channels() diff --git a/virtinst-pvgrub2-bootloader.patch b/virtinst-pvgrub2-bootloader.patch index 1b2d2ef9..dcd21520 100644 --- a/virtinst-pvgrub2-bootloader.patch +++ b/virtinst-pvgrub2-bootloader.patch @@ -6,7 +6,7 @@ Index: virt-manager-1.4.0/virtinst/guest.py =================================================================== --- virt-manager-1.4.0.orig/virtinst/guest.py +++ virt-manager-1.4.0/virtinst/guest.py -@@ -362,8 +362,20 @@ class Guest(XMLBuilder): +@@ -364,8 +364,20 @@ class Guest(XMLBuilder): if (not install and self.os.is_xenpv() and not self.os.kernel): diff --git a/virtinst-s390x-disable-graphics.patch b/virtinst-s390x-disable-graphics.patch index 43cebedf..cef30c70 100644 --- a/virtinst-s390x-disable-graphics.patch +++ b/virtinst-s390x-disable-graphics.patch @@ -16,7 +16,7 @@ Index: virt-manager-1.4.0/virtinst/guest.py self.x86_cpu_default = self.cpu.SPECIAL_MODE_HOST_MODEL_ONLY self.__os_object = None -@@ -605,7 +608,7 @@ class Guest(XMLBuilder): +@@ -606,7 +609,7 @@ class Guest(XMLBuilder): self.add_device(dev) def add_default_video_device(self): @@ -25,7 +25,7 @@ Index: virt-manager-1.4.0/virtinst/guest.py return if self.get_devices("video"): return -@@ -643,6 +646,8 @@ class Guest(XMLBuilder): +@@ -644,6 +647,8 @@ class Guest(XMLBuilder): dev.target_type = "virtio" dev.target_name = dev.CHANNEL_NAME_QEMUGA self.add_device(dev) @@ -34,7 +34,7 @@ Index: virt-manager-1.4.0/virtinst/guest.py def add_default_graphics(self): if self.skip_default_graphics: -@@ -651,7 +656,7 @@ class Guest(XMLBuilder): +@@ -652,7 +657,7 @@ class Guest(XMLBuilder): return if self.os.is_container(): return @@ -43,7 +43,7 @@ Index: virt-manager-1.4.0/virtinst/guest.py return self.add_device(VirtualGraphics(self.conn)) -@@ -979,7 +984,7 @@ class Guest(XMLBuilder): +@@ -980,7 +985,7 @@ class Guest(XMLBuilder): if self._hv_only_supports_virtio(): return True diff --git a/virtinst-set-cache-mode-unsafe-for-install.patch b/virtinst-set-cache-mode-unsafe-for-install.patch index 3960d33d..ea2ebb55 100644 --- a/virtinst-set-cache-mode-unsafe-for-install.patch +++ b/virtinst-set-cache-mode-unsafe-for-install.patch @@ -4,15 +4,7 @@ Index: virt-manager-1.4.0/virtinst/guest.py =================================================================== --- virt-manager-1.4.0.orig/virtinst/guest.py +++ virt-manager-1.4.0/virtinst/guest.py -@@ -53,6 +53,7 @@ from .osxml import OSXML - from .pm import PM - from .seclabel import Seclabel - from .xmlbuilder import XMLBuilder, XMLProperty, XMLChildProperty -+from .devicedisk import VirtualDisk - - - class Guest(XMLBuilder): -@@ -358,6 +359,17 @@ class Guest(XMLBuilder): +@@ -360,6 +360,17 @@ class Guest(XMLBuilder): self._set_osxml_defaults() @@ -30,7 +22,7 @@ Index: virt-manager-1.4.0/virtinst/guest.py self.bootloader = None if (not install and self.os.is_xenpv() and -@@ -377,7 +389,10 @@ class Guest(XMLBuilder): +@@ -379,7 +390,10 @@ class Guest(XMLBuilder): self.bootloader = "/usr/bin/pygrub" self.os.clear() diff --git a/virtinst-set-qemu-emulator.patch b/virtinst-set-qemu-emulator.patch index ebd78ad7..a63f87dc 100644 --- a/virtinst-set-qemu-emulator.patch +++ b/virtinst-set-qemu-emulator.patch @@ -5,7 +5,7 @@ Index: virt-manager-1.4.0/virtinst/guest.py =================================================================== --- virt-manager-1.4.0.orig/virtinst/guest.py +++ virt-manager-1.4.0/virtinst/guest.py -@@ -792,14 +792,11 @@ class Guest(XMLBuilder): +@@ -793,14 +793,11 @@ class Guest(XMLBuilder): self.emulator = None return