virt-manager/7afbb90b-virt-xml-Handle-VM-names-that-look-like-id-uuid.patch
Charles Arnold 2d558399a0 - Upstream bug fixes (bsc#1027942)
57db4185-virt-clone-fix-force-copy-of-empty-cdrom-or-floppy-disk.patch
  26a433fc-virtManager-clone-check-which-storage-pools-supports-volume-cloning.patch
  4f66c423-cloner-Handle-nonsparse-for-qcow2-images.patch
  a02fc0d0-virtManager-clone-build-default-clone-path-if-we-know-how.patch
  1856c1fa-support-Fix-minimum-version-check.patch
  74bbc3db-urldetect-Check-also-for-treeinfo.patch
  708af01c-osdict-Add-supports_virtioinput.patch
  f23b01be-guest-Add-VirtIO-input-devices-to-s390x-guests-with-graphics.patch
  7afbb90b-virt-xml-Handle-VM-names-that-look-like-id-uuid.patch
  a0ca387a-cli-Fix-pool-default-when-path-belongs-to-another-pool.patch

OBS-URL: https://build.opensuse.org/package/show/Virtualization/virt-manager?expand=0&rev=465
2019-04-03 17:16:11 +00:00

54 lines
2.6 KiB
Diff

Subject: virt-xml: Handle VM names that look like id/uuid (bz 1679025)
From: Cole Robinson crobinso@redhat.com Thu Mar 21 13:34:52 2019 -0400
Date: Thu Mar 21 13:45:58 2019 -0400:
Git: 7afbb90b4ddfa449e4efc2d57e726d477f96637b
Previously we assume they are id/uuid, so if it's actually the VM
name then the command fails. Now we always check for a name first,
https://bugzilla.redhat.com/show_bug.cgi?id=1679025
Index: virt-manager-2.1.0/tests/clitest.py
===================================================================
--- 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
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")
-c.add_compare("test --edit --boot network,cdrom", "edit-bootorder")
-c.add_compare("--confirm test --edit --cpu host-passthrough", "prompt-response")
+c.add_compare("4a64cc71-19c4-2fd0-2323-3050941ea3c3 --edit --boot network,cdrom", "edit-bootorder") # basic bootorder test, also using UUID lookup
+c.add_compare("--confirm 1 --edit --cpu host-passthrough", "prompt-response") # prompt response, also using domid lookup
c.add_compare("--edit --print-diff --qemu-commandline clearxml=yes", "edit-clearxml-qemu-commandline", input_file=(XMLDIR + "/virtxml-qemu-commandline-clear.xml"))
c.add_compare("--connect %(URI-KVM)s test-hyperv-uefi --edit --boot uefi", "hyperv-uefi-collision")
Index: virt-manager-2.1.0/virt-xml
===================================================================
--- virt-manager-2.1.0.orig/virt-xml
+++ virt-manager-2.1.0/virt-xml
@@ -73,12 +73,18 @@ def get_domain_and_guest(conn, domstr):
isuuid = bool(re.match(uuidre, domstr))
try:
- if isint:
- domain = conn.lookupByID(int(domstr))
- elif isuuid:
- domain = conn.lookupByUUIDString(domstr)
- else:
+ domain = None
+ try:
domain = conn.lookupByName(domstr)
+ except Exception:
+ # Incase the VM has a UUID or ID for a name
+ logging.debug("Error looking up domain by name", exc_info=True)
+ if isint:
+ domain = conn.lookupByID(int(domstr))
+ elif isuuid:
+ domain = conn.lookupByUUIDString(domstr)
+ else:
+ raise
except libvirt.libvirtError as e:
fail(_("Could not find domain '%s': %s") % (domstr, e))