Hello community, here is the log from the commit of package virt-manager for openSUSE:Factory checked in at 2019-06-01 09:57:08 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/virt-manager (Old) and /work/SRC/openSUSE:Factory/.virt-manager.new.5148 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "virt-manager" Sat Jun 1 09:57:08 2019 rev:194 rq:706525 version:2.1.0 Changes: -------- --- /work/SRC/openSUSE:Factory/virt-manager/virt-manager.changes 2019-04-04 12:08:15.297392180 +0200 +++ /work/SRC/openSUSE:Factory/.virt-manager.new.5148/virt-manager.changes 2019-06-01 09:57:13.463166055 +0200 @@ -1,0 +2,25 @@ +Thu May 23 08:17:01 MDT 2019 - carn...@suse.com + +- jsc#SLE-6262, fate#327048: KVM: Boot Configuration Override + 001-adf30349-cli-refactor-get_prop.patch + 002-60c7e778-xmlapi-add-set_prop.patch + 003-5bad22e8-tests-Use-get-set_prop.patch + 004-ee5f3eab-support-Add-SUPPORT_CONN_DEVICE_BOOT_ORDER.patch + 005-7768eb17-cli-Add-check-if-device-boot-order-is-supported.patch + 006-ecc0861c-tests-xmlparse-refactor-method-for-generating-out-file-path.patch + 007-c9d070da-guest-Add-reorder_boot_order-method.patch + 008-1b535940-tests-Add-test-case-for-reorder_boot_order-method.patch + 009-b83a0a61-cli-Use-reorder_boot_order-for-setting-the-boot-order.patch + 010-c896d19d-tests-cli-Add-boot.order-tests.patch + 011-29f9f2ac-virt-xml-Add-no-define-argument.patch + 012-c2bff509-tests-cli-Add-test-case-for-no-define-argument.patch + 013-90b1a3ab-virt-xml-Add-support-for-starting-the-domain.patch + 014-908b8e8d-tests-virt-xml-Add-test-cases-for-start-option.patch + +------------------------------------------------------------------- +Tue Apr 9 10:21:29 MDT 2019 - carn...@suse.com + +- Drop unneeded 0003-virtinst-python3-avoid-using-long-type.patch + Drop Requires on python3-six + +------------------------------------------------------------------- Old: ---- 0003-virtinst-python3-avoid-using-long-type.patch New: ---- 001-adf30349-cli-refactor-get_prop.patch 002-60c7e778-xmlapi-add-set_prop.patch 003-5bad22e8-tests-Use-get-set_prop.patch 004-ee5f3eab-support-Add-SUPPORT_CONN_DEVICE_BOOT_ORDER.patch 005-7768eb17-cli-Add-check-if-device-boot-order-is-supported.patch 006-ecc0861c-tests-xmlparse-refactor-method-for-generating-out-file-path.patch 007-c9d070da-guest-Add-reorder_boot_order-method.patch 008-1b535940-tests-Add-test-case-for-reorder_boot_order-method.patch 009-b83a0a61-cli-Use-reorder_boot_order-for-setting-the-boot-order.patch 010-c896d19d-tests-cli-Add-boot.order-tests.patch 011-29f9f2ac-virt-xml-Add-no-define-argument.patch 012-c2bff509-tests-cli-Add-test-case-for-no-define-argument.patch 013-90b1a3ab-virt-xml-Add-support-for-starting-the-domain.patch 014-908b8e8d-tests-virt-xml-Add-test-cases-for-start-option.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ virt-manager.spec ++++++ --- /var/tmp/diff_new_pack.rMCMFx/_old 2019-06-01 09:57:14.759165613 +0200 +++ /var/tmp/diff_new_pack.rMCMFx/_new 2019-06-01 09:57:14.763165611 +0200 @@ -40,13 +40,28 @@ Patch6: 4f66c423-cloner-Handle-nonsparse-for-qcow2-images.patch Patch7: a02fc0d0-virtManager-clone-build-default-clone-path-if-we-know-how.patch Patch8: 1856c1fa-support-Fix-minimum-version-check.patch -Patch9: 5bc847eb-virt-install-Do-not-warn-about-consoles-on-s390x.patch -Patch10: 74bbc3db-urldetect-Check-also-for-treeinfo.patch -Patch11: 708af01c-osdict-Add-supports_virtioinput.patch -Patch12: f23b01be-guest-Add-VirtIO-input-devices-to-s390x-guests-with-graphics.patch -Patch13: 7afbb90b-virt-xml-Handle-VM-names-that-look-like-id-uuid.patch -Patch14: 8d9743d6-virt-install-Add-support-for-xenbus-controller.patch -Patch15: a0ca387a-cli-Fix-pool-default-when-path-belongs-to-another-pool.patch +# jsc#SLE-6262 - KVM: Boot Configuration Override (virt-manager) +Patch9: 001-adf30349-cli-refactor-get_prop.patch +Patch10: 002-60c7e778-xmlapi-add-set_prop.patch +Patch11: 003-5bad22e8-tests-Use-get-set_prop.patch +Patch12: 004-ee5f3eab-support-Add-SUPPORT_CONN_DEVICE_BOOT_ORDER.patch +Patch13: 005-7768eb17-cli-Add-check-if-device-boot-order-is-supported.patch +Patch14: 006-ecc0861c-tests-xmlparse-refactor-method-for-generating-out-file-path.patch +Patch15: 007-c9d070da-guest-Add-reorder_boot_order-method.patch +Patch16: 008-1b535940-tests-Add-test-case-for-reorder_boot_order-method.patch +Patch17: 009-b83a0a61-cli-Use-reorder_boot_order-for-setting-the-boot-order.patch +Patch18: 010-c896d19d-tests-cli-Add-boot.order-tests.patch +Patch19: 011-29f9f2ac-virt-xml-Add-no-define-argument.patch +Patch20: 012-c2bff509-tests-cli-Add-test-case-for-no-define-argument.patch +Patch21: 013-90b1a3ab-virt-xml-Add-support-for-starting-the-domain.patch +Patch22: 014-908b8e8d-tests-virt-xml-Add-test-cases-for-start-option.patch +Patch23: 5bc847eb-virt-install-Do-not-warn-about-consoles-on-s390x.patch +Patch24: 74bbc3db-urldetect-Check-also-for-treeinfo.patch +Patch25: 708af01c-osdict-Add-supports_virtioinput.patch +Patch26: f23b01be-guest-Add-VirtIO-input-devices-to-s390x-guests-with-graphics.patch +Patch27: 7afbb90b-virt-xml-Handle-VM-names-that-look-like-id-uuid.patch +Patch28: 8d9743d6-virt-install-Add-support-for-xenbus-controller.patch +Patch29: a0ca387a-cli-Fix-pool-default-when-path-belongs-to-another-pool.patch # SUSE Only Patch70: virtman-desktop.patch Patch71: virtman-kvm.patch @@ -91,8 +106,7 @@ Patch202: virtman-python2-to-python3-conversion.patch Patch203: virttests-python2-to-python3-conversion.patch Patch204: 0002-virtinst-python3-avoid-comparison-of-None-and-int.patch -Patch205: 0003-virtinst-python3-avoid-using-long-type.patch -Patch206: virtman-register-delete-event-for-details-dialog.patch +Patch205: virtman-register-delete-event-for-details-dialog.patch BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -102,8 +116,6 @@ Requires: dconf Requires: gtk3 Requires: python3-gobject-Gdk -# Patch 0003-virtinst-python3-avoid-using-long-type.patch adds a python3-six dependency. Drop it when dropping the patch. -Requires: python3-six # For console widget Requires: python3-cairo Requires: python3-gobject-cairo @@ -190,6 +202,20 @@ %patch13 -p1 %patch14 -p1 %patch15 -p1 +%patch16 -p1 +%patch17 -p1 +%patch18 -p1 +%patch19 -p1 +%patch20 -p1 +%patch21 -p1 +%patch22 -p1 +%patch23 -p1 +%patch24 -p1 +%patch25 -p1 +%patch26 -p1 +%patch27 -p1 +%patch28 -p1 +%patch29 -p1 # SUSE Only %patch70 -p1 %patch71 -p1 @@ -235,7 +261,6 @@ %patch203 -p1 %patch204 -p1 %patch205 -p1 -%patch206 -p1 %build %if %{default_hvs} ++++++ 001-adf30349-cli-refactor-get_prop.patch ++++++ References: jsc#SLE-6262, fate#327048: KVM: Boot Configuration Override (virt-manager) Subject: cli: refactor get_prop From: Marc Hartmayer mhart...@linux.ibm.com Tue Feb 26 10:56:31 2019 +0100 Date: Wed Mar 6 13:13:13 2019 -0500: Git: adf30349c3a0cb07674bc00a4aa2f8e278c584a6 Refactor get_prop since it will be used in the next patches at other places as well. Signed-off-by: Marc Hartmayer <mhart...@linux.ibm.com> Reviewed-by: Boris Fiuczynski <fiu...@linux.ibm.com> Index: virt-manager-2.1.0/virtinst/cli.py =================================================================== --- virt-manager-2.1.0.orig/virtinst/cli.py +++ virt-manager-2.1.0/virtinst/cli.py @@ -22,7 +22,7 @@ import libvirt from virtcli import CLIConfig -from . import util +from . import util, xmlapi from .devices import (Device, DeviceController, DeviceDisk, DeviceGraphics, DeviceInterface, DevicePanic) from .domain import DomainClock, DomainOs @@ -1223,12 +1223,7 @@ class VirtCLIParser(metaclass=InitClass) """ if not cls.propname: return None - parent = obj - pieces = cls.propname.split(".") - for piece in pieces[:-1]: - parent = getattr(parent, piece) - - return getattr(parent, pieces[-1]) + return xmlapi.get_prop(obj, cls.propname) @classmethod def prop_is_list(cls, obj): Index: virt-manager-2.1.0/virtinst/xmlapi.py =================================================================== --- virt-manager-2.1.0.orig/virtinst/xmlapi.py +++ virt-manager-2.1.0/virtinst/xmlapi.py @@ -11,6 +11,22 @@ from . import util # pylint: disable=protected-access +def get_prop(obj, prop_path): + """Return value of attribute identified by `prop_path` + + Look up the attribute of `obj` identified by `prop_path` + (separated by "."). If any component along the path is missing an + `AttributeError` is raised. + + """ + parent = obj + pieces = prop_path.split(".") + for piece in pieces[:-1]: + parent = getattr(parent, piece) + + return getattr(parent, pieces[-1]) + + class _XPathSegment(object): """ Class representing a single 'segment' of an xpath string. For example, ++++++ 002-60c7e778-xmlapi-add-set_prop.patch ++++++ References: jsc#SLE-6262, fate#327048: KVM: Boot Configuration Override (virt-manager) Subject: xmlapi: add set_prop From: Marc Hartmayer mhart...@linux.ibm.com Tue Feb 26 10:56:32 2019 +0100 Date: Wed Mar 6 13:13:13 2019 -0500: Git: 60c7e778e306c66af2690cafea076aba15a2b233 Introduce set_prop helper function. It will be used in the next patch. Signed-off-by: Marc Hartmayer <mhart...@linux.ibm.com> Reviewed-by: Boris Fiuczynski <fiu...@linux.ibm.com> diff --git a/virtinst/xmlapi.py b/virtinst/xmlapi.py index 569e47f7..49ca0fa3 100644 --- a/virtinst/xmlapi.py +++ b/virtinst/xmlapi.py @@ -27,6 +27,22 @@ def get_prop(obj, prop_path): return getattr(parent, pieces[-1]) +def set_prop(obj, prop_path, value): + """Set value of attribute identified by `prop_path` + + Set the attribute of `obj` identified by `prop_path` (separated by + ".") to `value`. If any component along the path is missing an + `AttributeError` is raised. + + """ + parent = obj + pieces = prop_path.split(".") + for piece in pieces[:-1]: + parent = getattr(parent, piece) + + return setattr(parent, pieces[-1], value) + + class _XPathSegment(object): """ Class representing a single 'segment' of an xpath string. For example, ++++++ 003-5bad22e8-tests-Use-get-set_prop.patch ++++++ References: jsc#SLE-6262, fate#327048: KVM: Boot Configuration Override (virt-manager) Subject: tests: Use (get|set)_prop From: Marc Hartmayer mhart...@linux.ibm.com Tue Feb 26 10:56:33 2019 +0100 Date: Wed Mar 6 13:13:13 2019 -0500: Git: 5bad22e8375f60bb838f7f5e0bbf58d78ffd91ee Signed-off-by: Marc Hartmayer <mhart...@linux.ibm.com> Reviewed-by: Boris Fiuczynski <fiu...@linux.ibm.com> diff --git a/tests/xmlparse.py b/tests/xmlparse.py index 709bc48f..df6f022e 100644 --- a/tests/xmlparse.py +++ b/tests/xmlparse.py @@ -68,12 +68,12 @@ class XMLParseTest(unittest.TestCase): Check expected initial value obj.param == initval, then set newval, and make sure it is returned properly """ - curval = getattr(obj, param) + curval = virtinst.xmlapi.get_prop(obj, param) self.assertEqual(initval, curval) for newval in args: - setattr(obj, param, newval) - curval = getattr(obj, param) + virtinst.xmlapi.set_prop(obj, param, newval) + curval = virtinst.xmlapi.get_prop(obj, param) self.assertEqual(newval, curval) def _make_checker(self, obj): ++++++ 004-ee5f3eab-support-Add-SUPPORT_CONN_DEVICE_BOOT_ORDER.patch ++++++ References: jsc#SLE-6262, fate#327048: KVM: Boot Configuration Override (virt-manager) Subject: support: Add SUPPORT_CONN_DEVICE_BOOT_ORDER From: Marc Hartmayer mhart...@linux.ibm.com Tue Feb 26 10:56:34 2019 +0100 Date: Wed Mar 6 13:15:34 2019 -0500: Git: ee5f3eab4b52e09ae5d0e65ba42c508084f9b6d9 ...and use it in domain.py. Signed-off-by: Marc Hartmayer <mhart...@linux.ibm.com> Reviewed-by: Boris Fiuczynski <fiu...@linux.ibm.com> Index: virt-manager-2.1.0/virtManager/domain.py =================================================================== --- virt-manager-2.1.0.orig/virtManager/domain.py +++ virt-manager-2.1.0/virtManager/domain.py @@ -17,6 +17,7 @@ from virtinst import Guest from virtinst import util from virtinst import DeviceController from virtinst import DeviceDisk +from virtinst import support from .libvirtobject import vmmLibvirtObject from .libvirtenummap import LibvirtEnumMap @@ -1364,7 +1365,7 @@ class vmmDomain(vmmLibvirtObject): def can_use_device_boot_order(self): # Return 'True' if guest can use new style boot device ordering - return self.conn.is_qemu() or self.conn.is_test() + return self.conn.check_support(support.SUPPORT_CONN_DEVICE_BOOT_ORDER) def get_bootable_devices(self): # redirdev can also be marked bootable, but it should be rarely Index: virt-manager-2.1.0/virtinst/support.py =================================================================== --- virt-manager-2.1.0.orig/virtinst/support.py +++ virt-manager-2.1.0/virtinst/support.py @@ -266,6 +266,7 @@ SUPPORT_CONN_USB3_PORTS = _make(version= SUPPORT_CONN_MACHVIRT_PCI_DEFAULT = _make(version="3.0.0") SUPPORT_CONN_QEMU_XHCI = _make(version="3.3.0", hv_version={"qemu": "2.9.0"}) SUPPORT_CONN_VNC_NONE_AUTH = _make(hv_version={"qemu": "2.9.0"}) +SUPPORT_CONN_DEVICE_BOOT_ORDER = _make(hv_version={"qemu": 0, "test": 0}) # We choose qemu 2.11.0 as the first version to target for q35 default. # That's not really based on anything except reasonably modern at the ++++++ 005-7768eb17-cli-Add-check-if-device-boot-order-is-supported.patch ++++++ References: jsc#SLE-6262, fate#327048: KVM: Boot Configuration Override (virt-manager) Subject: cli: Add check if device boot order is supported From: Marc Hartmayer mhart...@linux.ibm.com Tue Feb 26 10:56:35 2019 +0100 Date: Wed Mar 6 13:15:38 2019 -0500: Git: 7768eb17d98352a29f2e5b62035630483d1f3b63 Add a check if device boot order is supported to Parser(Network|Disk|Redirdev|...) and throw an exception if not. Signed-off-by: Marc Hartmayer <mhart...@linux.ibm.com> Reviewed-by: Boris Fiuczynski <fiu...@linux.ibm.com> Index: virt-manager-2.1.0/virtinst/cli.py =================================================================== --- virt-manager-2.1.0.orig/virtinst/cli.py +++ virt-manager-2.1.0/virtinst/cli.py @@ -20,6 +20,7 @@ import types import libvirt +from virtinst import support from virtcli import CLIConfig from . import util, xmlapi @@ -2154,6 +2155,18 @@ def _add_device_address_args(cls): cls.add_arg("address.base", "address.base") +def _add_device_boot_order_arg(cls): + def set_boot_order_cb(self, inst, val, virtarg): + val = int(val) + guest = self.guest + if not guest.conn.check_support(support.SUPPORT_CONN_DEVICE_BOOT_ORDER): + raise NotImplementedError('Device boot order isn\'t supported by the connection') + + inst.boot.order = val + cls.set_boot_order_cb = set_boot_order_cb + cls.add_arg("boot.order", "boot_order", cb=cls.set_boot_order_cb) + + ################## # --disk parsing # ################## @@ -2323,7 +2336,7 @@ class ParserDisk(VirtCLIParser): cls.add_arg("startup_policy", "startup_policy") cls.add_arg("read_only", "readonly", is_onoff=True) cls.add_arg("shareable", "shareable", is_onoff=True) - cls.add_arg("boot.order", "boot_order") + _add_device_boot_order_arg(cls) cls.add_arg("iotune_rbs", "read_bytes_sec") cls.add_arg("iotune_wbs", "write_bytes_sec") @@ -2419,7 +2432,7 @@ class ParserNetwork(VirtCLIParser): cls.add_arg("model", "model") cls.add_arg("macaddr", "mac", cb=cls.set_mac_cb) cls.add_arg("filterref", "filterref") - cls.add_arg("boot.order", "boot_order") + _add_device_boot_order_arg(cls) cls.add_arg("link_state", "link_state", cb=cls.set_link_state) @@ -2637,7 +2650,7 @@ class ParserRedir(VirtCLIParser): _add_device_address_args(cls) cls.add_arg("bus", "bus", ignore_default=True) cls.add_arg("type", "type", ignore_default=True) - cls.add_arg("boot.order", "boot_order") + _add_device_boot_order_arg(cls) cls.add_arg(None, "server", cb=cls.set_server_cb) @@ -3048,7 +3061,7 @@ class ParserHostdev(VirtCLIParser): cb=cls.set_name_cb, lookup_cb=cls.name_lookup_cb) cls.add_arg("driver_name", "driver_name") - cls.add_arg("boot.order", "boot_order") + _add_device_boot_order_arg(cls) cls.add_arg("rom_bar", "rom_bar", is_onoff=True) ++++++ 006-ecc0861c-tests-xmlparse-refactor-method-for-generating-out-file-path.patch ++++++ References: jsc#SLE-6262, fate#327048: KVM: Boot Configuration Override (virt-manager) Subject: tests: xmlparse: refactor method for generating out file path From: Marc Hartmayer mhart...@linux.ibm.com Tue Feb 26 10:56:36 2019 +0100 Date: Wed Mar 6 13:15:38 2019 -0500: Git: ecc0861c891263eacba8f63e9aa74797a1e7cba2 Refactor method for generating out file path. It will be used in a upcoming patch. Signed-off-by: Marc Hartmayer <mhart...@linux.ibm.com> Reviewed-by: Boris Fiuczynski <fiu...@linux.ibm.com> diff --git a/tests/xmlparse.py b/tests/xmlparse.py index df6f022e..2dbaf24c 100644 --- a/tests/xmlparse.py +++ b/tests/xmlparse.py @@ -81,9 +81,17 @@ class XMLParseTest(unittest.TestCase): return self._set_and_check(obj, name, initval, *args) return check + def _gen_outfile_path(self, basename): + """ + Returns relative path to the file containing the expected XML + output + + """ + return "tests/xmlparse-xml/{!s}-out.xml".format(basename) + def _get_test_content(self, basename, kvm=False): infile = "tests/xmlparse-xml/%s-in.xml" % basename - outfile = "tests/xmlparse-xml/%s-out.xml" % basename + outfile = self._gen_outfile_path(basename) guest = virtinst.Guest(kvm and self.kvmconn or self.conn, parsexml=open(infile).read()) return guest, outfile ++++++ 007-c9d070da-guest-Add-reorder_boot_order-method.patch ++++++ References: jsc#SLE-6262, fate#327048: KVM: Boot Configuration Override (virt-manager) Subject: guest: Add reorder_boot_order method From: Marc Hartmayer mhart...@linux.ibm.com Tue Feb 26 10:56:37 2019 +0100 Date: Wed Mar 6 13:15:38 2019 -0500: Git: c9d070da4c3d31c3c504f52dbff775483ebf5e35 Add `reorder_boot_order` method to Guest class. It sets the boot order of the passed `dev` to `boot_index` and adapts all other boot indices of the guest accordingly. Signed-off-by: Marc Hartmayer <mhart...@linux.ibm.com> Reviewed-by: Boris Fiuczynski <fiu...@linux.ibm.com> Index: virt-manager-2.1.0/virtinst/guest.py =================================================================== --- virt-manager-2.1.0.orig/virtinst/guest.py +++ virt-manager-2.1.0/virtinst/guest.py @@ -257,6 +257,40 @@ class Guest(XMLBuilder): return self.__osinfo osinfo = property(_get_osinfo) + def reorder_boot_order(self, dev, boot_index): + """Sets boot order of `dev` to `boot_index` + + Sets the boot order for device `dev` to value `boot_index` and + adjusts all other boot indices accordingly. Additionally the + boot order defined in the 'os' node of a domain definition is + disabled since they are mutually exclusive in libvirt. + + """ + # unset legacy boot order + self.os.bootorder = [] + + # Sort the bootable devices by boot order + devs_sorted = sorted([device for device in self.get_bootable_devices() + if device.boot.order is not None], + key=lambda device: device.boot.order) + + # set new boot order + dev.boot.order = boot_index + + next_boot_index = None + for device in devs_sorted: + if device is dev: + continue + + if device.boot.order in [next_boot_index, boot_index]: + next_boot_index = device.boot.order + 1 + device.boot.order = next_boot_index + continue + + if next_boot_index is not None: + # we found a hole so we can stop here + break + def set_os_name(self, name): obj = OSDB.lookup_os(name) if obj is None: ++++++ 008-1b535940-tests-Add-test-case-for-reorder_boot_order-method.patch ++++++ References: jsc#SLE-6262, fate#327048: KVM: Boot Configuration Override (virt-manager) Subject: tests: Add test case for reorder_boot_order method From: Marc Hartmayer mhart...@linux.ibm.com Tue Feb 26 10:56:38 2019 +0100 Date: Wed Mar 6 13:15:38 2019 -0500: Git: 1b535940028dda1c63e9c1d98a40aa11223a05b2 Add a test case for `reorder_boot_order`. It verifies that the OS boot order is removed and that all other boot order indices are adjusted accordingly. Signed-off-by: Marc Hartmayer <mhart...@linux.ibm.com> Reviewed-by: Boris Fiuczynski <fiu...@linux.ibm.com> diff --git a/tests/xmlparse-xml/change-devices-bootorder-fixed-out.xml b/tests/xmlparse-xml/change-devices-bootorder-fixed-out.xml new file mode 100644 index 00000000..e8fa6975 --- /dev/null +++ b/tests/xmlparse-xml/change-devices-bootorder-fixed-out.xml @@ -0,0 +1,71 @@ +<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> + <os> + <type arch="i686" machine="foobar">hvm</type> + </os> + <features> + <acpi/> + <apic/> + <hyperv> + <vapic state="off"/> + <spinlocks state="on" retries="12287"/> + </hyperv> + <vmport state="off"/> + </features> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <on_lockfailure>poweroff</on_lockfailure> + <devices> + <emulator>/usr/lib/xen/bin/qemu-dm</emulator> + <disk type="file" device="floppy"> + <driver name="qemu" type="qcow2"/> + <source file="/dev/default-pool/testvol1.img"/> + <target dev="fda" bus="fdc"/> + <boot order="1"/> + </disk> + <disk type="file" device="disk"> + <driver name="qemu" type="raw"/> + <source file="/tmp/test.img"/> + <target dev="vda" bus="virtio"/> + <boot order="10"/> + </disk> + <disk type="block" device="disk"> + <driver name="qemu"/> + <source dev="/dev/null"/> + <target dev="vdb" bus="virtio"/> + <boot order="11"/> + </disk> + <disk type="block" device="cdrom"> + <target dev="hdc" bus="ide"/> + <readonly/> + <boot order="2"/> + </disk> + <interface type="network"> + <source network="default"/> + <mac address="22:22:33:44:55:66"/> + <model type="virtio"/> + <boot order="3"/> + </interface> + <interface type="network"> + <source network="default"/> + <model type="virtio"/> + </interface> + <controller type="usb" index="0"/> + <redirdev bus="usb" type="tcp"> + <source mode="connect" host="localhost" service="4000"/> + <boot order="4"/> + </redirdev> + <graphics type="vnc" display=":3.4" xauth="/tmp/.Xauthority"/> + <console type="pty"/> + <memballoon model="virtio"/> + </devices> +</domain> diff --git a/tests/xmlparse-xml/change-devices-bootorder-in.xml b/tests/xmlparse-xml/change-devices-bootorder-in.xml new file mode 100644 index 00000000..66dd57a8 --- /dev/null +++ b/tests/xmlparse-xml/change-devices-bootorder-in.xml @@ -0,0 +1,71 @@ +<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> + <os> + <type arch="i686" machine="foobar">hvm</type> + <boot dev="hd"/> + </os> + <features> + <acpi/> + <apic/> + <hyperv> + <vapic state="off"/> + <spinlocks state="on" retries="12287"/> + </hyperv> + <vmport state="off"/> + </features> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <on_lockfailure>poweroff</on_lockfailure> + <devices> + <emulator>/usr/lib/xen/bin/qemu-dm</emulator> + <disk type="file" device="floppy"> + <driver name="qemu" type="qcow2"/> + <source file="/dev/default-pool/testvol1.img"/> + <target dev="fda" bus="fdc"/> + </disk> + <disk type="file" device="disk"> + <driver name="qemu" type="raw"/> + <source file="/tmp/test.img"/> + <target dev="vda" bus="virtio"/> + <boot order="10"/> + </disk> + <disk type="block" device="disk"> + <driver name="qemu"/> + <source dev="/dev/null"/> + <target dev="vdb" bus="virtio"/> + <boot order="10"/> + </disk> + <disk type="block" device="cdrom"> + <target dev="hdc" bus="ide"/> + <readonly/> + <boot order="1"/> + </disk> + <interface type="network"> + <source network="default"/> + <mac address="22:22:33:44:55:66"/> + <model type="virtio"/> + <boot order="2"/> + </interface> + <interface type="network"> + <source network="default"/> + <model type="virtio"/> + </interface> + <controller type="usb" index="0"/> + <redirdev bus="usb" type="tcp"> + <source mode="connect" host="localhost" service="4000"/> + <boot order="3"/> + </redirdev> + <graphics type="vnc" display=":3.4" xauth="/tmp/.Xauthority"/> + <console type="pty"/> + <memballoon model="virtio"/> + </devices> +</domain> diff --git a/tests/xmlparse-xml/change-devices-bootorder-out.xml b/tests/xmlparse-xml/change-devices-bootorder-out.xml new file mode 100644 index 00000000..f03bc591 --- /dev/null +++ b/tests/xmlparse-xml/change-devices-bootorder-out.xml @@ -0,0 +1,71 @@ +<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> + <os> + <type arch="i686" machine="foobar">hvm</type> + </os> + <features> + <acpi/> + <apic/> + <hyperv> + <vapic state="off"/> + <spinlocks state="on" retries="12287"/> + </hyperv> + <vmport state="off"/> + </features> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <on_lockfailure>poweroff</on_lockfailure> + <devices> + <emulator>/usr/lib/xen/bin/qemu-dm</emulator> + <disk type="file" device="floppy"> + <driver name="qemu" type="qcow2"/> + <source file="/dev/default-pool/testvol1.img"/> + <target dev="fda" bus="fdc"/> + <boot order="1"/> + </disk> + <disk type="file" device="disk"> + <driver name="qemu" type="raw"/> + <source file="/tmp/test.img"/> + <target dev="vda" bus="virtio"/> + <boot order="10"/> + </disk> + <disk type="block" device="disk"> + <driver name="qemu"/> + <source dev="/dev/null"/> + <target dev="vdb" bus="virtio"/> + <boot order="10"/> + </disk> + <disk type="block" device="cdrom"> + <target dev="hdc" bus="ide"/> + <readonly/> + <boot order="2"/> + </disk> + <interface type="network"> + <source network="default"/> + <mac address="22:22:33:44:55:66"/> + <model type="virtio"/> + <boot order="3"/> + </interface> + <interface type="network"> + <source network="default"/> + <model type="virtio"/> + </interface> + <controller type="usb" index="0"/> + <redirdev bus="usb" type="tcp"> + <source mode="connect" host="localhost" service="4000"/> + <boot order="4"/> + </redirdev> + <graphics type="vnc" display=":3.4" xauth="/tmp/.Xauthority"/> + <console type="pty"/> + <memballoon model="virtio"/> + </devices> +</domain> diff --git a/tests/xmlparse.py b/tests/xmlparse.py index 2dbaf24c..d12522ab 100644 --- a/tests/xmlparse.py +++ b/tests/xmlparse.py @@ -436,6 +436,55 @@ class XMLParseTest(unittest.TestCase): self._alter_compare(guest.get_xml(), outfile) + def testAlterDevicesBootorder(self): + basename = "change-devices-bootorder" + guest, outfile = self._get_test_content(basename) + disk_1 = guest.devices.disk[0] + disk_2 = guest.devices.disk[1] + disk_3 = guest.devices.disk[2] + disk_4 = guest.devices.disk[3] + iface_1 = guest.devices.interface[0] + iface_2 = guest.devices.interface[1] + redirdev_1 = guest.devices.redirdev[0] + + self.assertEqual(guest.os.bootorder, ['hd']) + self.assertEqual(disk_1.boot.order, None) + self.assertEqual(disk_2.boot.order, 10) + self.assertEqual(disk_3.boot.order, 10) + self.assertEqual(disk_4.boot.order, 1) + self.assertEqual(iface_1.boot.order, 2) + self.assertEqual(iface_2.boot.order, None) + self.assertEqual(redirdev_1.boot.order, 3) + + guest.reorder_boot_order(disk_1, 1) + + self.assertEqual(guest.os.bootorder, []) + self.assertEqual(disk_1.boot.order, 1) + self.assertEqual(disk_2.boot.order, 10) + self.assertEqual(disk_3.boot.order, 10) + # verify that the used algorithm preserves the order of + # records with equal boot indices + self.assertIs(disk_2, guest.devices.disk[1]) + self.assertIs(disk_3, guest.devices.disk[2]) + self.assertEqual(disk_4.boot.order, 2) + self.assertEqual(iface_1.boot.order, 3) + self.assertEqual(iface_2.boot.order, None) + self.assertEqual(redirdev_1.boot.order, 4) + + try: + self._alter_compare(guest.get_xml(), outfile) + except RuntimeError as error: + self.assertIn("unsupported configuration", str(error)) + + guest.reorder_boot_order(disk_2, 10) + self.assertEqual(disk_2.boot.order, 10) + self.assertEqual(disk_3.boot.order, 11) + self.assertIs(disk_2, guest.devices.disk[1]) + self.assertIs(disk_3, guest.devices.disk[2]) + + outfile = self._gen_outfile_path("change-devices-bootorder-fixed") + self._alter_compare(guest.get_xml(), outfile) + def testSingleDisk(self): xml = ("""<disk type="file" device="disk"><source file="/a.img"/>\n""" """<target dev="hda" bus="ide"/></disk>\n""") ++++++ 009-b83a0a61-cli-Use-reorder_boot_order-for-setting-the-boot-order.patch ++++++ References: jsc#SLE-6262, fate#327048: KVM: Boot Configuration Override (virt-manager) Subject: cli: Use reorder_boot_order for setting the boot order From: Marc Hartmayer mhart...@linux.ibm.com Tue Feb 26 10:56:39 2019 +0100 Date: Wed Mar 6 13:15:38 2019 -0500: Git: b83a0a61a0da867048b232054a41c4c98edbb9d8 Use the newly introduced method `reorder_boot_order` for setting the boot index of a device. This ensures that all other boot order values of domain guest definition are adjusted accordingly. Signed-off-by: Marc Hartmayer <mhart...@linux.ibm.com> Reviewed-by: Boris Fiuczynski <fiu...@linux.ibm.com> Index: virt-manager-2.1.0/virtinst/cli.py =================================================================== --- virt-manager-2.1.0.orig/virtinst/cli.py +++ virt-manager-2.1.0/virtinst/cli.py @@ -2162,7 +2162,7 @@ def _add_device_boot_order_arg(cls): if not guest.conn.check_support(support.SUPPORT_CONN_DEVICE_BOOT_ORDER): raise NotImplementedError('Device boot order isn\'t supported by the connection') - inst.boot.order = val + guest.reorder_boot_order(inst, val) cls.set_boot_order_cb = set_boot_order_cb cls.add_arg("boot.order", "boot_order", cb=cls.set_boot_order_cb) ++++++ 010-c896d19d-tests-cli-Add-boot.order-tests.patch ++++++ References: jsc#SLE-6262, fate#327048: KVM: Boot Configuration Override (virt-manager) Subject: tests: cli: Add boot.order tests From: Marc Hartmayer mhart...@linux.ibm.com Tue Feb 26 10:56:40 2019 +0100 Date: Wed Mar 6 13:15:38 2019 -0500: Git: c896d19d7645a2728b064d2026610178358220c5 Signed-off-by: Marc Hartmayer <mhart...@linux.ibm.com> Reviewed-by: Boris Fiuczynski <fiu...@linux.ibm.com> diff --git a/tests/cli-test-xml/compare/virt-xml-edit-select-disk-bootorder.xml b/tests/cli-test-xml/compare/virt-xml-edit-select-disk-bootorder.xml new file mode 100644 index 00000000..60114b99 --- /dev/null +++ b/tests/cli-test-xml/compare/virt-xml-edit-select-disk-bootorder.xml @@ -0,0 +1,19 @@ + <total_iops_sec>50</total_iops_sec> + </iotune> + <address type="drive" controller="0" bus="0" target="0" unit="0"/> ++ <boot order="1"/> + </disk> + <disk type="file" device="disk"> + <driver name="qemu" type="qcow2" cache="none"/> +@@ + </source> + <target dev="sda" bus="scsi"/> + <shareable/> +- <boot order="1"/> ++ <boot order="2"/> + <address type="drive" controller="9" bus="0" target="0" unit="0"/> + </disk> + <controller type="scsi" index="0"/> + +Domain 'test-for-virtxml' defined successfully. +Changes will take effect after the domain is fully powered off. \ No newline at end of file diff --git a/tests/cli-test-xml/compare/virt-xml-edit-select-disk-bootorder2.xml b/tests/cli-test-xml/compare/virt-xml-edit-select-disk-bootorder2.xml new file mode 100644 index 00000000..0c35cd14 --- /dev/null +++ b/tests/cli-test-xml/compare/virt-xml-edit-select-disk-bootorder2.xml @@ -0,0 +1,18 @@ + <os> + <type arch="i686">hvm</type> + <loader type="rom">/usr/lib/xen/boot/hvmloader</loader> +- <boot dev="hd"/> + </os> + <features> + <acpi/> +@@ + <source file="/dev/default-pool/collidevol1.img"/> + <target dev="hda" bus="ide"/> + <address type="drive" controller="0" bus="0" target="0" unit="0"/> ++ <boot order="1"/> + </disk> + <controller type="ide" index="0"/> + <interface type="user"> + +Domain 'test-collide' defined successfully. +Changes will take effect after the domain is fully powered off. \ No newline at end of file diff --git a/tests/clitest.py b/tests/clitest.py index a86c15cc..fff4b99f 100644 --- a/tests/clitest.py +++ b/tests/clitest.py @@ -965,6 +965,10 @@ c.add_compare("--edit ich6 --sound pcspk", "edit-select-sound-model", check_vers c.add_compare("--edit target=hda --disk /dev/null", "edit-select-disk-target") c.add_compare("--edit /tmp/foobar2 --disk shareable=off,readonly=on", "edit-select-disk-path") c.add_compare("--edit mac=00:11:7f:33:44:55 --network target=nic55", "edit-select-network-mac") +c.add_compare("--edit target=hda --disk boot_order=1", "edit-select-disk-bootorder") + +c = vixml.add_category("edit selection 2", "test-collide --print-diff --define") +c.add_compare("--edit target=hda --disk boot_order=1", "edit-select-disk-bootorder2") c = vixml.add_category("edit clear", "test-for-virtxml --print-diff --define") c.add_invalid("--edit --memory 200,clearxml=yes") # clear isn't wired up for memory ++++++ 011-29f9f2ac-virt-xml-Add-no-define-argument.patch ++++++ References: jsc#SLE-6262, fate#327048: KVM: Boot Configuration Override (virt-manager) Subject: virt-xml: Add --no-define argument From: Marc Hartmayer mhart...@linux.ibm.com Tue Feb 26 10:56:41 2019 +0100 Date: Wed Mar 6 13:15:38 2019 -0500: Git: 29f9f2ac9c168b29043e8a443d354f2b7802c9f9 Add `--no-define` argument. It's mutually exclusive to the `--define` argument and later on it allows the user to start a domain transiently. Signed-off-by: Marc Hartmayer <mhart...@linux.ibm.com> Reviewed-by: Boris Fiuczynski <fiu...@linux.ibm.com> Index: virt-manager-2.1.0/virt-xml =================================================================== --- virt-manager-2.1.0.orig/virt-xml +++ virt-manager-2.1.0/virt-xml @@ -363,9 +363,13 @@ def parse_args(): "With --add-device, this is a hotplug operation.\n" "With --remove-device, this is a hotunplug operation.\n" "With --edit, this is an update device operation.")) - outg.add_argument("--define", action="store_true", - help=_("Force defining the domain. Only required if a --print " - "option was specified.")) + define_g = outg.add_mutually_exclusive_group() + define_g.add_argument("--define", action="store_true", + help=_("Force defining the domain. Only required if a --print " + "option was specified.")) + define_g.add_argument("--no-define", dest='define', action="store_false", + help=_("Force not defining the domain.")) + define_g.set_defaults(define=None) outg.add_argument("--print-diff", action="store_true", help=_("Only print the requested change, in diff format")) outg.add_argument("--print-xml", action="store_true", @@ -426,7 +430,8 @@ def main(conn=None): if not options.define: options.print_xml = True else: - options.define = True + if options.define is None: + options.define = True if options.confirm and not options.print_xml: options.print_diff = True ++++++ 012-c2bff509-tests-cli-Add-test-case-for-no-define-argument.patch ++++++ References: jsc#SLE-6262, fate#327048: KVM: Boot Configuration Override (virt-manager) Subject: tests: cli: Add test case for --no-define argument From: Marc Hartmayer mhart...@linux.ibm.com Tue Feb 26 10:56:42 2019 +0100 Date: Wed Mar 6 13:15:38 2019 -0500: Git: c2bff50977b83bb1b4bddbfe579735c2fc9d9c65 Add a test case validating mutual exclusivity of `--no-define` and '--define' arguments. Signed-off-by: Marc Hartmayer <mhart...@linux.ibm.com> Reviewed-by: Boris Fiuczynski <fiu...@linux.ibm.com> diff --git a/tests/clitest.py b/tests/clitest.py index fff4b99f..b4f41b79 100644 --- a/tests/clitest.py +++ b/tests/clitest.py @@ -902,6 +902,7 @@ c.add_invalid("test-for-virtxml --add-device --host-device 0x04b3:0x4485 --updat c.add_invalid("test-for-virtxml --remove-device --host-device 1 --update") # test driver doesn't support detachdevice... c.add_invalid("test-for-virtxml --edit --graphics password=foo --update") # test driver doesn't support updatdevice... c.add_invalid("--build-xml --memory 10,maxmemory=20") # building XML for option that doesn't support it +c.add_invalid("test --edit --boot network,cdrom --define --no-define") c.add_compare("test --print-xml --edit --vcpus 7", "print-xml") # test --print-xml c.add_compare("--edit --cpu host-passthrough", "stdin-edit", input_file=(XMLDIR + "/virtxml-stdin-edit.xml")) # stdin test c.add_compare("--build-xml --cpu pentium3,+x2apic", "build-cpu") ++++++ 013-90b1a3ab-virt-xml-Add-support-for-starting-the-domain.patch ++++++ References: jsc#SLE-6262, fate#327048: KVM: Boot Configuration Override (virt-manager) Subject: virt-xml: Add support for starting the domain From: Marc Hartmayer mhart...@linux.ibm.com Tue Feb 26 10:56:43 2019 +0100 Date: Wed Mar 6 13:15:38 2019 -0500: Git: 90b1a3ab7d9cb9c84e7dda7093ae2c97217fa591 Add support for starting the domain. By default, first the domain is defined and then started. If the `--start` is used in combination with `--no-define` a transient domain is created without persisting the changes in the persistent domain definition. Signed-off-by: Marc Hartmayer <mhart...@linux.ibm.com> Reviewed-by: Boris Fiuczynski <fiu...@linux.ibm.com> Index: virt-manager-2.1.0/virt-xml =================================================================== --- virt-manager-2.1.0.orig/virt-xml +++ virt-manager-2.1.0/virt-xml @@ -257,9 +257,28 @@ def define_changes(conn, inactive_xmlobj for dev in devs: setup_device(dev) - conn.defineXML(inactive_xmlobj.get_xml()) + dom = conn.defineXML(inactive_xmlobj.get_xml()) print_stdout(_("Domain '%s' defined successfully.") % inactive_xmlobj.name) - return True + return dom + + +def start_domain_transient(conn, xmlobj, devs, action, confirm): + if confirm: + if not prompt_yes_or_no( + _("Start '%s' with the changed XML?") % xmlobj.name): + return False + + if action == "hotplug": + for dev in devs: + setup_device(dev) + + try: + dom = conn.createXML(xmlobj.get_xml()) + except libvirt.libvirtError as e: + fail(_("Failed starting domain '%s': %s") % (xmlobj.name, e)) + else: + print_stdout(_("Domain '%s' started successfully.") % xmlobj.name) + return dom def update_changes(domain, devs, action, confirm): @@ -370,6 +389,8 @@ def parse_args(): define_g.add_argument("--no-define", dest='define', action="store_false", help=_("Force not defining the domain.")) define_g.set_defaults(define=None) + outg.add_argument("--start", action="store_true", + help=_("Start the domain.")) outg.add_argument("--print-diff", action="store_true", help=_("Only print the requested change, in diff format")) outg.add_argument("--print-xml", action="store_true", @@ -411,6 +432,9 @@ def main(conn=None): options.quiet = False cli.setupLogging("virt-xml", options.debug, options.quiet) + if options.update and options.start: + fail(_("Either update or start a domain")) + if cli.check_option_introspection(options): return 0 @@ -468,14 +492,27 @@ def main(conn=None): else: logging.warning( _("The VM is not running, --update is inapplicable.")) - if options.define: + + if options.define or options.start: devs, action = prepare_changes(inactive_xmlobj, options, parserclass) - applied = define_changes(conn, inactive_xmlobj, + if options.define: + dom = define_changes(conn, inactive_xmlobj, devs, action, options.confirm) - if not options.update and active_xmlobj and applied: - print_stdout( - _("Changes will take effect after the domain is fully powered off.")) - if not options.update and not options.define: + if dom and options.start: + try: + dom.create() + except libvirt.libvirtError as e: + fail(_("Failed starting domain '%s': %s") % (inactive_xmlobj.name, e)) + print_stdout(_("Domain '%s' started successfully.") % + inactive_xmlobj.name) + elif not options.update and active_xmlobj and dom: + print_stdout( + _("Changes will take effect after the domain is fully powered off.")) + else: + dom = start_domain_transient(conn, inactive_xmlobj, devs, + action, options.confirm) + + if not options.update and not options.define and not options.start: prepare_changes(inactive_xmlobj, options, parserclass) return 0 ++++++ 014-908b8e8d-tests-virt-xml-Add-test-cases-for-start-option.patch ++++++ References: jsc#SLE-6262, fate#327048: KVM: Boot Configuration Override (virt-manager) Subject: tests: virt-xml: Add test cases for --start option From: Marc Hartmayer mhart...@linux.ibm.com Tue Feb 26 10:56:44 2019 +0100 Date: Wed Mar 6 13:15:38 2019 -0500: Git: 908b8e8d7c3663ca791b068f2f03234e31281bbc The test cases verify that: + --start works + --define --start works + --no-define --start works + --start works in combination with --add and --remove + combination of --start --update isn't valid + combination of --define --no-define --start isn't valid Signed-off-by: Marc Hartmayer <mhart...@linux.ibm.com> Reviewed-by: Boris Fiuczynski <fiu...@linux.ibm.com> diff --git a/tests/cli-test-xml/compare/virt-xml-add-disk-basic-start.xml b/tests/cli-test-xml/compare/virt-xml-add-disk-basic-start.xml new file mode 100644 index 00000000..0071d9e7 --- /dev/null +++ b/tests/cli-test-xml/compare/virt-xml-add-disk-basic-start.xml @@ -0,0 +1,11 @@ + <model type="cirrus" vram="16384" heads="1" primary="yes"/> + </video> + <memballoon model="virtio"/> ++ <disk type="file" device="disk"> ++ <source file="/dev/default-pool/testvol1.img"/> ++ <target dev="vdf" bus="virtio"/> ++ </disk> + </devices> + </domain> + +Domain 'test-state-shutoff' started successfully. \ No newline at end of file diff --git a/tests/cli-test-xml/compare/virt-xml-add-disk-create-storage-start.xml b/tests/cli-test-xml/compare/virt-xml-add-disk-create-storage-start.xml new file mode 100644 index 00000000..6a02dcc3 --- /dev/null +++ b/tests/cli-test-xml/compare/virt-xml-add-disk-create-storage-start.xml @@ -0,0 +1,11 @@ + <model type="cirrus" vram="16384" heads="1" primary="yes"/> + </video> + <memballoon model="virtio"/> ++ <disk type="file" device="disk"> ++ <source file="/dev/default-pool/new1.img"/> ++ <target dev="hdd" bus="ide"/> ++ </disk> + </devices> + </domain> + +Domain 'test-state-shutoff' started successfully. \ No newline at end of file diff --git a/tests/cli-test-xml/compare/virt-xml-add-host-device-start.xml b/tests/cli-test-xml/compare/virt-xml-add-host-device-start.xml new file mode 100644 index 00000000..b3db5279 --- /dev/null +++ b/tests/cli-test-xml/compare/virt-xml-add-host-device-start.xml @@ -0,0 +1,14 @@ + <model type="cirrus" vram="16384" heads="1" primary="yes"/> + </video> + <memballoon model="virtio"/> ++ <hostdev mode="subsystem" type="usb" managed="yes"> ++ <source> ++ <vendor id="0x04b3"/> ++ <product id="0x4485"/> ++ </source> ++ </hostdev> + </devices> + </domain> + +Domain 'test-state-shutoff' defined successfully. +Domain 'test-state-shutoff' started successfully. \ No newline at end of file diff --git a/tests/cli-test-xml/compare/virt-xml-remove-disk-path-start.xml b/tests/cli-test-xml/compare/virt-xml-remove-disk-path-start.xml new file mode 100644 index 00000000..e04db8fb --- /dev/null +++ b/tests/cli-test-xml/compare/virt-xml-remove-disk-path-start.xml @@ -0,0 +1,20 @@ + <on_lockfailure>poweroff</on_lockfailure> + <devices> + <emulator>/usr/lib/xen/bin/qemu-dm</emulator> +- <disk type="block" device="disk"> +- <driver name="qemu"/> +- <source dev="/dev/null"/> +- <target dev="vda" bus="virtio"/> +- <boot order="10"/> +- </disk> +- <disk type="block" device="disk"> +- <driver name="qemu"/> +- <source dev="/dev/null"/> +- <target dev="vdb" bus="virtio"/> +- <boot order="3"/> +- </disk> + <disk type="block" device="cdrom"> + <target dev="hdc" bus="ide"/> + <readonly/> + +Domain 'test-state-shutoff' started successfully. \ No newline at end of file diff --git a/tests/cli-test-xml/compare/virt-xml-start-select-disk-bootorder.xml b/tests/cli-test-xml/compare/virt-xml-start-select-disk-bootorder.xml new file mode 100644 index 00000000..280d9fc5 --- /dev/null +++ b/tests/cli-test-xml/compare/virt-xml-start-select-disk-bootorder.xml @@ -0,0 +1,33 @@ + <driver name="qemu"/> + <source dev="/dev/null"/> + <target dev="vda" bus="virtio"/> +- <boot order="10"/> ++ <boot order="1"/> + </disk> + <disk type="block" device="disk"> + <driver name="qemu"/> + <source dev="/dev/null"/> + <target dev="vdb" bus="virtio"/> +- <boot order="3"/> ++ <boot order="4"/> + </disk> + <disk type="block" device="cdrom"> + <target dev="hdc" bus="ide"/> + <readonly/> +- <boot order="1"/> ++ <boot order="2"/> + <address type="drive" controller="0" bus="1" target="0" unit="0"/> + </disk> + <controller type="ide" index="0"/> +@@ + <source network="default"/> + <target dev="testnet0"/> + <model type="virtio"/> +- <boot order="2"/> ++ <boot order="3"/> + </interface> + <interface type="network"> + <mac address="52:54:00:11:fa:28"/> + +Domain 'test-state-shutoff' defined successfully. +Domain 'test-state-shutoff' started successfully. \ No newline at end of file diff --git a/tests/cli-test-xml/compare/virt-xml-start-select-disk-bootorder2.xml b/tests/cli-test-xml/compare/virt-xml-start-select-disk-bootorder2.xml new file mode 100644 index 00000000..1144f4c5 --- /dev/null +++ b/tests/cli-test-xml/compare/virt-xml-start-select-disk-bootorder2.xml @@ -0,0 +1,32 @@ + <driver name="qemu"/> + <source dev="/dev/null"/> + <target dev="vda" bus="virtio"/> +- <boot order="10"/> ++ <boot order="1"/> + </disk> + <disk type="block" device="disk"> + <driver name="qemu"/> + <source dev="/dev/null"/> + <target dev="vdb" bus="virtio"/> +- <boot order="3"/> ++ <boot order="4"/> + </disk> + <disk type="block" device="cdrom"> + <target dev="hdc" bus="ide"/> + <readonly/> +- <boot order="1"/> ++ <boot order="2"/> + <address type="drive" controller="0" bus="1" target="0" unit="0"/> + </disk> + <controller type="ide" index="0"/> +@@ + <source network="default"/> + <target dev="testnet0"/> + <model type="virtio"/> +- <boot order="2"/> ++ <boot order="3"/> + </interface> + <interface type="network"> + <mac address="52:54:00:11:fa:28"/> + +Domain 'test-state-shutoff' started successfully. \ No newline at end of file diff --git a/tests/clitest.py b/tests/clitest.py index b4f41b79..1c3cd5a5 100644 --- a/tests/clitest.py +++ b/tests/clitest.py @@ -893,6 +893,7 @@ c = vixml.add_category("misc", "") c.add_valid("--help") # basic --help test c.add_valid("--sound=? --tpm=?") # basic introspection test c.add_valid("test-state-shutoff --edit --update --boot menu=on") # --update with inactive VM, should work but warn +c.add_invalid("test-state-shutoff --edit --update --boot menu=on --start") c.add_invalid("test --edit --hostdev driver_name=vfio") # Guest has no hostdev to edit c.add_invalid("test --edit --cpu host-passthrough --boot hd,network") # Specified more than 1 option c.add_invalid("test --edit") # specified no edit option @@ -968,6 +969,12 @@ c.add_compare("--edit /tmp/foobar2 --disk shareable=off,readonly=on", "edit-sele c.add_compare("--edit mac=00:11:7f:33:44:55 --network target=nic55", "edit-select-network-mac") c.add_compare("--edit target=hda --disk boot_order=1", "edit-select-disk-bootorder") +c = vixml.add_category("edit and start selection", "test-state-shutoff --print-diff --start") +c.add_compare("--define --edit target=vda --disk boot_order=1", "start-select-disk-bootorder") +c.add_invalid("--define --no-define --edit target=vda --disk boot_order=1") +c.add_compare("--edit target=vda --disk boot_order=1", "start-select-disk-bootorder2") +c.add_compare("--no-define --edit target=vda --disk boot_order=1", "start-select-disk-bootorder2") + c = vixml.add_category("edit selection 2", "test-collide --print-diff --define") c.add_compare("--edit target=hda --disk boot_order=1", "edit-select-disk-bootorder2") @@ -995,6 +1002,16 @@ c.add_compare("--remove-device --disk /dev/null", "remove-disk-path") c.add_compare("--remove-device --video all", "remove-video-all", check_version="1.3.3") # check_version=video primary= attribute c.add_compare("--remove-device --host-device 0x04b3:0x4485", "remove-hostdev-name", check_version="1.2.11") # check_version=video ram output change +c = vixml.add_category("add/rm devices and start", "test-state-shutoff --print-diff --start") +c.add_invalid("--add-device --pm suspend_to_disk=yes") # --add-device without a device +c.add_invalid("--remove-device --clock utc") # --remove-device without a dev +# one test in combination with --define +c.add_compare("--define --add-device --host-device usb_device_4b3_4485_noserial", "add-host-device-start") +# all other test cases without +c.add_compare("--add-device --disk %(EXISTIMG1)s,bus=virtio,target=vdf", "add-disk-basic-start") +c.add_compare("--add-device --disk %(NEWIMG1)s,size=.01", "add-disk-create-storage-start") +c.add_compare("--remove-device --disk /dev/null", "remove-disk-path-start") + c = vixml.add_category("add/rm devices OS KVM", "--connect %(URI-KVM)s test --print-diff --define") c.add_compare("--add-device --disk %(EXISTIMG1)s", "kvm-add-disk-os-from-xml") # Guest OS (none) from XML c.add_compare("--add-device --disk %(EXISTIMG1)s --os-variant fedora28", "kvm-add-disk-os-from-cmdline") # Guest OS (fedora) provided on command line diff --git a/tests/testsuite.xml b/tests/testsuite.xml index fa0a077f..2e6f0fd6 100644 --- a/tests/testsuite.xml +++ b/tests/testsuite.xml @@ -289,6 +289,64 @@ <memory>1048576</memory> <bootloader>/tmp/bootfoo</bootloader> <test:runstate>5</test:runstate> + <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> + <os> + <type arch="i686" machine="foobar">hvm</type> + </os> + <features> + <acpi/> + <apic/> + <hyperv> + <vapic state="off"/> + <spinlocks state="on" retries="12287"/> + </hyperv> + <vmport state="off"/> + </features> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <on_lockfailure>poweroff</on_lockfailure> + <devices> + <emulator>/usr/lib/xen/bin/qemu-dm</emulator> + <disk type="block" device="disk"> + <driver name="qemu"/> + <source dev="/dev/null"/> + <target dev="vda" bus="virtio"/> + <boot order="10"/> + </disk> + <disk type="block" device="disk"> + <driver name="qemu"/> + <source dev="/dev/null"/> + <target dev="vdb" bus="virtio"/> + <boot order="3"/> + </disk> + <disk type="block" device="cdrom"> + <target dev="hdc" bus="ide"/> + <readonly/> + <boot order="1"/> + </disk> + <interface type="network"> + <source network="default"/> + <mac address="22:22:33:44:55:66"/> + <model type="virtio"/> + <boot order="2"/> + </interface> + <interface type="network"> + <source network="default"/> + <mac address="52:54:00:11:fa:28"/> + <model type="virtio"/> + </interface> + <graphics type="vnc" display=":3.4" xauth="/tmp/.Xauthority"/> + <console type="pty"/> + <memballoon model="virtio"/> + </devices> </domain> ++++++ 7afbb90b-virt-xml-Handle-VM-names-that-look-like-id-uuid.patch ++++++ --- /var/tmp/diff_new_pack.rMCMFx/_old 2019-06-01 09:57:14.967165542 +0200 +++ /var/tmp/diff_new_pack.rMCMFx/_new 2019-06-01 09:57:14.967165542 +0200 @@ -12,7 +12,7 @@ =================================================================== --- virt-manager-2.1.0.orig/tests/clitest.py +++ virt-manager-2.1.0/tests/clitest.py -@@ -908,8 +908,8 @@ c.add_compare("--build-xml --cpu pentium +@@ -910,8 +910,8 @@ c.add_compare("--build-xml --cpu pentium c.add_compare("--build-xml --tpm /dev/tpm", "build-tpm") c.add_compare("--build-xml --blkiotune weight=100,device_path=/dev/sdf,device_weight=200", "build-blkiotune") c.add_compare("--build-xml --idmap uid_start=0,uid_target=1000,uid_count=10,gid_start=0,gid_target=1000,gid_count=10", "build-idmap") ++++++ 8d9743d6-virt-install-Add-support-for-xenbus-controller.patch ++++++ --- /var/tmp/diff_new_pack.rMCMFx/_old 2019-06-01 09:57:14.979165537 +0200 +++ /var/tmp/diff_new_pack.rMCMFx/_new 2019-06-01 09:57:14.983165536 +0200 @@ -67,7 +67,7 @@ =================================================================== --- virt-manager-2.1.0.orig/virtinst/cli.py +++ virt-manager-2.1.0/virtinst/cli.py -@@ -2430,6 +2430,7 @@ class ParserNetwork(VirtCLIParser): +@@ -2438,6 +2438,7 @@ class ParserNetwork(VirtCLIParser): cls.add_arg("driver_name", "driver_name") cls.add_arg("driver_queues", "driver_queues") ++++++ a0ca387a-cli-Fix-pool-default-when-path-belongs-to-another-pool.patch ++++++ --- /var/tmp/diff_new_pack.rMCMFx/_old 2019-06-01 09:57:14.995165532 +0200 +++ /var/tmp/diff_new_pack.rMCMFx/_new 2019-06-01 09:57:14.995165532 +0200 @@ -18,7 +18,7 @@ =================================================================== --- virt-manager-2.1.0.orig/virtinst/cli.py +++ virt-manager-2.1.0/virtinst/cli.py -@@ -2263,7 +2263,9 @@ class ParserDisk(VirtCLIParser): +@@ -2271,7 +2271,9 @@ class ParserDisk(VirtCLIParser): poolobj = None if poolname: if poolname == "default": ++++++ f23b01be-guest-Add-VirtIO-input-devices-to-s390x-guests-with-graphics.patch ++++++ --- /var/tmp/diff_new_pack.rMCMFx/_old 2019-06-01 09:57:15.007165528 +0200 +++ /var/tmp/diff_new_pack.rMCMFx/_new 2019-06-01 09:57:15.007165528 +0200 @@ -23,7 +23,7 @@ =================================================================== --- virt-manager-2.1.0.orig/virtinst/guest.py +++ virt-manager-2.1.0/virtinst/guest.py -@@ -588,6 +588,17 @@ class Guest(XMLBuilder): +@@ -622,6 +622,17 @@ class Guest(XMLBuilder): dev.bus = "usb" self.add_device(dev) ++++++ virtinst-add-caasp-support.patch ++++++ --- /var/tmp/diff_new_pack.rMCMFx/_old 2019-06-01 09:57:15.071165506 +0200 +++ /var/tmp/diff_new_pack.rMCMFx/_new 2019-06-01 09:57:15.071165506 +0200 @@ -4,7 +4,7 @@ =================================================================== --- virt-manager-2.1.0.orig/virtinst/urldetect.py +++ virt-manager-2.1.0/virtinst/urldetect.py -@@ -258,6 +258,12 @@ class _SUSEContent(object): +@@ -267,6 +267,12 @@ class _SUSEContent(object): self.product_name.strip().rsplit(' ')[5][2]) distro_version = sle_version @@ -17,7 +17,7 @@ return distro_version -@@ -544,6 +550,9 @@ class _SuseDistro(_RHELDistro): +@@ -553,6 +559,9 @@ class _SuseDistro(_RHELDistro): # Tumbleweed 8 digit date return "opensusetumbleweed" @@ -27,7 +27,7 @@ if int(version) < 10: return self._variant_prefix + "9" -@@ -616,6 +625,14 @@ class _OpensuseDistro(_SuseDistro): +@@ -625,6 +634,14 @@ class _OpensuseDistro(_SuseDistro): famregex = ".*openSUSE.*" ++++++ virtinst-add-pvh-support.patch ++++++ --- /var/tmp/diff_new_pack.rMCMFx/_old 2019-06-01 09:57:15.079165504 +0200 +++ /var/tmp/diff_new_pack.rMCMFx/_new 2019-06-01 09:57:15.083165502 +0200 @@ -32,7 +32,7 @@ =================================================================== --- virt-manager-2.1.0.orig/virtinst/guest.py +++ virt-manager-2.1.0/virtinst/guest.py -@@ -574,7 +574,7 @@ class Guest(XMLBuilder): +@@ -608,7 +608,7 @@ class Guest(XMLBuilder): usb_tablet = False usb_keyboard = False @@ -45,7 +45,7 @@ =================================================================== --- virt-manager-2.1.0.orig/virtManager/domain.py +++ virt-manager-2.1.0/virtManager/domain.py -@@ -1224,6 +1224,8 @@ class vmmDomain(vmmLibvirtObject): +@@ -1225,6 +1225,8 @@ class vmmDomain(vmmLibvirtObject): return self.get_xmlobj().os.is_xenpv() def is_hvm(self): return self.get_xmlobj().os.is_hvm() ++++++ virtinst-add-sle15-detection-support.patch ++++++ --- /var/tmp/diff_new_pack.rMCMFx/_old 2019-06-01 09:57:15.091165499 +0200 +++ /var/tmp/diff_new_pack.rMCMFx/_new 2019-06-01 09:57:15.091165499 +0200 @@ -4,7 +4,7 @@ =================================================================== --- virt-manager-2.1.0.orig/virtinst/urldetect.py +++ virt-manager-2.1.0/virtinst/urldetect.py -@@ -580,6 +580,10 @@ class _SuseDistro(_RHELDistro): +@@ -589,6 +589,10 @@ class _SuseDistro(_RHELDistro): if re.search("openSUSE Tumbleweed", self.cache.treeinfo_name): return "opensusetumbleweed" @@ -15,7 +15,7 @@ version, update = self.cache.split_version() base = self._variant_prefix + str(version) while update >= 0: -@@ -587,7 +591,10 @@ class _SuseDistro(_RHELDistro): +@@ -596,7 +600,10 @@ class _SuseDistro(_RHELDistro): # SLE doesn't use '.0' for initial releases in # osinfo-db (sles11, sles12, etc) if update > 0 or not base.startswith('sle'): @@ -27,7 +27,7 @@ if OSDB.lookup_os(tryvar): return tryvar update -= 1 -@@ -601,6 +608,14 @@ class _SuseDistro(_RHELDistro): +@@ -610,6 +617,14 @@ class _SuseDistro(_RHELDistro): return var ++++++ virtinst-detect-oes-distros.patch ++++++ --- /var/tmp/diff_new_pack.rMCMFx/_old 2019-06-01 09:57:15.111165493 +0200 +++ /var/tmp/diff_new_pack.rMCMFx/_new 2019-06-01 09:57:15.111165493 +0200 @@ -4,7 +4,7 @@ =================================================================== --- virt-manager-2.1.0.orig/virtinst/urldetect.py +++ virt-manager-2.1.0/virtinst/urldetect.py -@@ -547,7 +547,7 @@ class _SuseDistro(_RHELDistro): +@@ -556,7 +556,7 @@ class _SuseDistro(_RHELDistro): if int(version) < 10: return self._variant_prefix + "9" @@ -13,7 +13,7 @@ sp_version = "" if len(distro_version.split('.', 1)) == 2: sp_version = 'sp' + distro_version.split('.', 1)[1].strip() -@@ -616,6 +616,14 @@ class _OpensuseDistro(_SuseDistro): +@@ -625,6 +625,14 @@ class _OpensuseDistro(_SuseDistro): famregex = ".*openSUSE.*" ++++++ virtinst-media-detection.patch ++++++ --- /var/tmp/diff_new_pack.rMCMFx/_old 2019-06-01 09:57:15.123165488 +0200 +++ /var/tmp/diff_new_pack.rMCMFx/_new 2019-06-01 09:57:15.123165488 +0200 @@ -2,9 +2,11 @@ look in the media.1/products and media.1/media files for information. Caasp 4.0 has not content or .treeinfo file on the media ---- virt-manager-2.1.0/virtinst/urldetect.py.orig 2019-03-13 15:34:14.489019082 -0600 -+++ virt-manager-2.1.0/virtinst/urldetect.py 2019-03-13 15:34:56.813552736 -0600 -@@ -485,8 +485,23 @@ class _SuseDistro(_RHELDistro): +Index: virt-manager-2.1.0/virtinst/urldetect.py +=================================================================== +--- virt-manager-2.1.0.orig/virtinst/urldetect.py ++++ virt-manager-2.1.0/virtinst/urldetect.py +@@ -494,8 +494,23 @@ class _SuseDistro(_RHELDistro): cache.checked_for_suse_content = True content_str = cache.acquire_file_content("content") if content_str is None: ++++++ virtinst-s390x-disable-graphics.patch ++++++ --- /var/tmp/diff_new_pack.rMCMFx/_old 2019-06-01 09:57:15.139165483 +0200 +++ /var/tmp/diff_new_pack.rMCMFx/_new 2019-06-01 09:57:15.139165483 +0200 @@ -16,7 +16,7 @@ self.skip_default_rng = False self.x86_cpu_default = self.cpu.SPECIAL_MODE_APP_DEFAULT -@@ -289,7 +292,7 @@ class Guest(XMLBuilder): +@@ -323,7 +326,7 @@ class Guest(XMLBuilder): if not os_support: return False @@ -25,7 +25,7 @@ return True return False -@@ -601,7 +604,7 @@ class Guest(XMLBuilder): +@@ -646,7 +649,7 @@ class Guest(XMLBuilder): self.add_device(dev) def _add_default_video_device(self): @@ -34,7 +34,7 @@ return if self.devices.video: return -@@ -665,7 +668,7 @@ class Guest(XMLBuilder): +@@ -710,7 +713,7 @@ class Guest(XMLBuilder): return if self.os.is_container() and not self.conn.is_vz(): return ++++++ virtinst-use-xenpae-kernel-for-32bit.patch ++++++ --- /var/tmp/diff_new_pack.rMCMFx/_old 2019-06-01 09:57:15.151165479 +0200 +++ /var/tmp/diff_new_pack.rMCMFx/_new 2019-06-01 09:57:15.155165477 +0200 @@ -8,7 +8,7 @@ =================================================================== --- virt-manager-2.1.0.orig/virtinst/urldetect.py +++ virt-manager-2.1.0/virtinst/urldetect.py -@@ -530,9 +530,14 @@ class _SuseDistro(_RHELDistro): +@@ -539,9 +539,14 @@ class _SuseDistro(_RHELDistro): if self.type == "xen": # Matches Opensuse > 10.2 and sles 10 ++++++ virtinst-vol-default-nocow.patch ++++++ --- /var/tmp/diff_new_pack.rMCMFx/_old 2019-06-01 09:57:15.163165475 +0200 +++ /var/tmp/diff_new_pack.rMCMFx/_new 2019-06-01 09:57:15.163165475 +0200 @@ -8,7 +8,7 @@ =================================================================== --- virt-manager-2.1.0.orig/virtinst/storage.py +++ virt-manager-2.1.0/virtinst/storage.py -@@ -617,6 +617,11 @@ class StorageVolume(_StorageObject): +@@ -629,6 +629,11 @@ class StorageVolume(_StorageObject): return self._pool_xml.get_disk_type() file_type = property(_get_vol_type) @@ -24,10 +24,10 @@ =================================================================== --- virt-manager-2.1.0.orig/virtinst/support.py +++ virt-manager-2.1.0/virtinst/support.py -@@ -266,6 +266,8 @@ SUPPORT_CONN_USB3_PORTS = _make(version= - SUPPORT_CONN_MACHVIRT_PCI_DEFAULT = _make(version="3.0.0") +@@ -267,6 +267,8 @@ SUPPORT_CONN_MACHVIRT_PCI_DEFAULT = _mak SUPPORT_CONN_QEMU_XHCI = _make(version="3.3.0", hv_version={"qemu": "2.9.0"}) SUPPORT_CONN_VNC_NONE_AUTH = _make(hv_version={"qemu": "2.9.0"}) + SUPPORT_CONN_DEVICE_BOOT_ORDER = _make(hv_version={"qemu": 0, "test": 0}) +SUPPORT_CONN_NOCOW = _make( + version="1.2.18", hv_version={"qemu": "2.2.0", "test": 0})