[Pkg-libvirt-commits] [Git][libvirt-team/virt-manager][debian/sid] 2 commits: d/patches: add some fixes from upstream

Guido Günther (@agx) gitlab at salsa.debian.org
Thu Feb 17 14:54:02 GMT 2022



Guido Günther pushed to branch debian/sid at Libvirt Packaging Team / virt-manager


Commits:
ee034676 by Fabio Fantoni at 2022-02-02T14:21:43+01:00
d/patches: add some fixes from upstream

- virtinst: Fix TOCTOU in domain enumeration
- tests: storage: Fix with latest libvirt XML output
- tests: use different USB device when testing hot-add
- tests: don't add the same USB devices to the guest twice
- tests: Fix hyperv @mode handling on libvirt 8.0.0

Closes: #997367

- - - - -
c8d66b48 by Fabio Fantoni at 2022-02-02T14:22:20+01:00
release 1:3.2.0-3.1

- - - - -


7 changed files:

- debian/changelog
- + debian/patches/fix-tests2.patch
- + debian/patches/fix-tests3.patch
- + debian/patches/fix-tests4.patch
- + debian/patches/fix-tests5.patch
- + debian/patches/series
- + debian/patches/virtinst-Fix-TOCTOU-in-domain-enumeration.patch


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,16 @@
+virt-manager (1:3.2.0-3.1) unstable; urgency=medium
+
+  * Non-maintainer upload
+  * d/patches: add some fixes from upstream
+    - virtinst: Fix TOCTOU in domain enumeration
+    - tests: storage: Fix with latest libvirt XML output
+    - tests: use different USB device when testing hot-add
+    - tests: don't add the same USB devices to the guest twice
+    - tests: Fix hyperv @mode handling on libvirt 8.0.0
+    (Closes: #997367)
+
+ -- Fabio Fantoni <fantonifabio at tiscali.it>  Tue, 01 Feb 2022 18:21:01 +0100
+
 virt-manager (1:3.2.0-3) unstable; urgency=medium
 
   * Drop the librsvg2-common dependency from virt-manager, as seems unused


=====================================
debian/patches/fix-tests2.patch
=====================================
@@ -0,0 +1,107 @@
+Author: Cole Robinson <crobinso at redhat.com>
+Date: Tue, 6 Apr 2021 15:21:00 -0400
+Description: tests: storage: Fix with latest libvirt XML output
+
+Signed-off-by: Cole Robinson <crobinso at redhat.com>
+---
+ tests/data/storage/pool-dir-volclone.xml     |  2 --
+ tests/data/storage/pool-disk-volclone.xml    |  2 --
+ tests/data/storage/pool-fs-volclone.xml      |  2 --
+ tests/data/storage/pool-logical-volclone.xml |  2 --
+ tests/data/storage/pool-netfs-volclone.xml   |  2 --
+ tests/test_storage.py                        | 11 ++++++-----
+ 6 files changed, 6 insertions(+), 15 deletions(-)
+
+diff --git a/tests/data/storage/pool-dir-volclone.xml b/tests/data/storage/pool-dir-volclone.xml
+index c8bde66fb..16f1e561d 100644
+--- a/tests/data/storage/pool-dir-volclone.xml
++++ b/tests/data/storage/pool-dir-volclone.xml
+@@ -1,8 +1,6 @@
+ <volume type="file">
+   <name>pool-dir-volclone</name>
+   <key>/var/lib/libvirt/images/pool-dir/pool-dir-vol</key>
+-  <source>
+-  </source>
+   <capacity unit="bytes">10737418240</capacity>
+   <allocation unit="bytes">5368709120</allocation>
+   <target>
+diff --git a/tests/data/storage/pool-disk-volclone.xml b/tests/data/storage/pool-disk-volclone.xml
+index a4e9c3d12..24f71a1d9 100644
+--- a/tests/data/storage/pool-disk-volclone.xml
++++ b/tests/data/storage/pool-disk-volclone.xml
+@@ -1,8 +1,6 @@
+ <volume type="file">
+   <name>pool-disk-volclone</name>
+   <key>/dev/pool-disk-vol</key>
+-  <source>
+-  </source>
+   <capacity unit="bytes">10737418240</capacity>
+   <allocation unit="bytes">5368709120</allocation>
+   <target>
+diff --git a/tests/data/storage/pool-fs-volclone.xml b/tests/data/storage/pool-fs-volclone.xml
+index 34e8cd088..6c7d3b9dd 100644
+--- a/tests/data/storage/pool-fs-volclone.xml
++++ b/tests/data/storage/pool-fs-volclone.xml
+@@ -1,8 +1,6 @@
+ <volume type="file">
+   <name>pool-fs-volclone</name>
+   <key>/var/lib/libvirt/images/pool-fs/pool-fs-vol</key>
+-  <source>
+-  </source>
+   <capacity unit="bytes">10737418240</capacity>
+   <allocation unit="bytes">5368709120</allocation>
+   <target>
+diff --git a/tests/data/storage/pool-logical-volclone.xml b/tests/data/storage/pool-logical-volclone.xml
+index c012017ef..8abcfa64c 100644
+--- a/tests/data/storage/pool-logical-volclone.xml
++++ b/tests/data/storage/pool-logical-volclone.xml
+@@ -1,8 +1,6 @@
+ <volume type="file">
+   <name>pool-logical-volclone</name>
+   <key>/dev/pool-logical/pool-logical-vol</key>
+-  <source>
+-  </source>
+   <capacity unit="bytes">10737418240</capacity>
+   <allocation unit="bytes">10737418240</allocation>
+   <target>
+diff --git a/tests/data/storage/pool-netfs-volclone.xml b/tests/data/storage/pool-netfs-volclone.xml
+index b6b39f79d..b7fd26507 100644
+--- a/tests/data/storage/pool-netfs-volclone.xml
++++ b/tests/data/storage/pool-netfs-volclone.xml
+@@ -1,8 +1,6 @@
+ <volume type="file">
+   <name>pool-netfs-volclone</name>
+   <key>/var/lib/libvirt/images/pool-netfs/pool-netfs-vol</key>
+-  <source>
+-  </source>
+   <capacity unit="bytes">10737418240</capacity>
+   <allocation unit="bytes">5368709120</allocation>
+   <target>
+diff --git a/tests/test_storage.py b/tests/test_storage.py
+index ee33ab32e..ba0e4e711 100644
+--- a/tests/test_storage.py
++++ b/tests/test_storage.py
+@@ -65,11 +65,6 @@ def createVol(conn, poolobj, volname=None, input_vol=None, clone_vol=None):
+     if volname is None:
+         volname = poolobj.name() + "-vol"
+ 
+-    # Format here depends on libvirt-1.2.0 and later
+-    if clone_vol and conn.local_libvirt_version() < 1002000:
+-        log.debug("skip clone compare")
+-        return
+-
+     alloc = 5 * 1024 * 1024 * 1024
+     cap = 10 * 1024 * 1024 * 1024
+     vol_inst = StorageVolume(conn)
+@@ -91,6 +86,12 @@ def createVol(conn, poolobj, volname=None, input_vol=None, clone_vol=None):
+ 
+     vol_inst.validate()
+     filename = os.path.join(BASEPATH, vol_inst.name + ".xml")
++
++    # Format here depends on libvirt-7.2.0 and later
++    if clone_vol and conn.local_libvirt_version() < 7002000:
++        log.debug("skip clone compare")
++        return
++
+     utils.diff_compare(vol_inst.get_xml(), filename)
+     return vol_inst.install(meter=False)


=====================================
debian/patches/fix-tests3.patch
=====================================
@@ -0,0 +1,62 @@
+Author: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange at redhat.com>
+Date: Fri, 29 Oct 2021 12:04:49 +0100
+Description: tests: use different USB device when testing hot-add
+
+Libvirt now validates that all <hostdev> elements refer to distinct host
+devices. The test suite violates that constraint by trying to hot-add a
+device that alreadye exists in the config.
+
+Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
+---
+ .../data/cli/compare/virt-xml-add-host-device.xml  |  6 +++---
+ tests/data/testdriver/testsuite.xml                | 14 ++++++++++++++
+ tests/test_cli.py                                  |  2 +-
+ 3 files changed, 18 insertions(+), 4 deletions(-)
+
+--- a/tests/data/cli/compare/virt-xml-add-host-device.xml
++++ b/tests/data/cli/compare/virt-xml-add-host-device.xml
+@@ -3,8 +3,8 @@
+      </vsock>
+ +    <hostdev mode="subsystem" type="usb" managed="yes">
+ +      <source>
+-+        <vendor id="0x04b3"/>
+-+        <product id="0x4485"/>
+++        <vendor id="0x0483"/>
+++        <product id="0x2016"/>
+ +      </source>
+ +    </hostdev>
+    </devices>
+--- a/tests/data/testdriver/testsuite.xml
++++ b/tests/data/testdriver/testsuite.xml
+@@ -724,6 +724,20 @@
+ 
+ 
+ <device>
++  <name>usb_device_483_2016_noserial</name>
++  <parent>usb_device_1d6b_1_0000_00_1a_0</parent>
++  <driver>
++    <name>usb</name>
++  </driver>
++  <capability type='usb_device'>
++    <bus>3</bus>
++    <device>2</device>
++    <product id='0x2016'>Fingerprint Reader</product>
++    <vendor id='0x0483'>SGS Thomson Microelectronics</vendor>
++  </capability>
++</device>
++
++<device>
+   <name>usb_device_4b3_4485_noserial</name>
+   <parent>usb_device_1d6b_2_0000_00_1a_7</parent>
+   <driver>
+--- a/tests/test_cli.py
++++ b/tests/test_cli.py
+@@ -1293,7 +1293,7 @@
+ c.add_valid("--add-device --security model=dac")  # --add-device works for seclabel
+ 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
+-c.add_compare("--add-device --host-device usb_device_4b3_4485_noserial", "add-host-device")
++c.add_compare("--add-device --host-device usb_device_483_2016_noserial", "add-host-device")
+ c.add_compare("--add-device --sound pcspk", "add-sound")
+ c.add_compare("--add-device --disk %(EXISTIMG1)s,bus=virtio,target=vdf", "add-disk-basic")
+ c.add_compare("--add-device --disk %(EXISTIMG1)s", "add-disk-notarget")  # filling in acceptable target


=====================================
debian/patches/fix-tests4.patch
=====================================
@@ -0,0 +1,50 @@
+Author: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange at redhat.com>
+Date: Fri, 29 Oct 2021 12:18:54 +0100
+Description: tests: don't add the same USB devices to the guest twice
+
+Libvirt now validates that all <hostdev> elements refer to distinct host
+devices. The test suite violates that constraint by trying to build a
+new guest with the same USB devices added to the guest twice, to
+validate the various host device syntax options.
+
+Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
+---
+ tests/data/cli/compare/virt-install-many-devices.xml | 8 ++++----
+ tests/test_cli.py                                    | 4 ++--
+ 2 files changed, 6 insertions(+), 6 deletions(-)
+
+--- a/tests/data/cli/compare/virt-install-many-devices.xml
++++ b/tests/data/cli/compare/virt-install-many-devices.xml
+@@ -545,15 +545,15 @@
+     </hostdev>
+     <hostdev mode="subsystem" type="usb" managed="yes">
+       <source>
+-        <vendor id="0x0781"/>
+-        <product id="0x5151"/>
++        <vendor id="0x062a"/>
++        <product id="0x0001"/>
+       </source>
+       <driver name="vfio"/>
+     </hostdev>
+     <hostdev mode="subsystem" type="usb" managed="yes">
+       <source>
+-        <vendor id="0x04b3"/>
+-        <product id="0x4485"/>
++        <vendor id="0x0483"/>
++        <product id="0x2016"/>
+       </source>
+     </hostdev>
+     <hostdev mode="subsystem" type="scsi" managed="no">
+--- a/tests/test_cli.py
++++ b/tests/test_cli.py
+@@ -668,8 +668,8 @@
+ --hostdev 15:0.1
+ --host-device 2:15:0.2
+ --hostdev 0:15:0.3,address.type=pci,address.zpci.uid=0xffff,address.zpci.fid=0xffffffff
+---host-device 0x0781:0x5151,driver_name=vfio
+---host-device 04b3:4485
++--host-device 0x062a:0x0001,driver_name=vfio
++--host-device 0483:2016
+ --host-device pci_8086_2829_scsi_host_scsi_device_lun0,rom.bar=on
+ --hostdev usb_5_20 --hostdev usb_5_21
+ --hostdev wlan0,type=net


=====================================
debian/patches/fix-tests5.patch
=====================================
@@ -0,0 +1,32 @@
+Author: Cole Robinson <crobinso at redhat.com>
+Date: Mon, 17 Jan 2022 13:54:45 -0500
+Description: tests: Fix hyperv @mode handling on libvirt 8.0.0
+
+Signed-off-by: Cole Robinson <crobinso at redhat.com>
+---
+ tests/data/cli/compare/virt-xml-edit-simple-features.xml | 2 +-
+ tests/test_cli.py                                        | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+--- a/tests/data/cli/compare/virt-xml-edit-simple-features.xml
++++ b/tests/data/cli/compare/virt-xml-edit-simple-features.xml
+@@ -4,7 +4,7 @@
+ -    <acpi/>
+ -    <apic eoi="off"/>
+ +    <apic eoi="on"/>
+-     <hyperv>
++     <hyperv mode="custom">
+ -      <relaxed state="on"/>
+ +      <relaxed state="off"/>
+        <vapic state="on"/>
+--- a/tests/test_cli.py
++++ b/tests/test_cli.py
+@@ -1231,7 +1231,7 @@
+ c.add_compare("--idmap uid_start=0,uid_target=2000,uid_count=30,gid_start=0,gid_target=3000,gid_count=40", "edit-simple-idmap")
+ c.add_compare("--boot loader=foo.bar,useserial=on,init=/bin/bash,nvram=/test/nvram.img,os_type=hvm,domain_type=test,loader.readonly=on,loader.secure=no,machine=", "edit-simple-boot")
+ c.add_compare("--security label=foo,bar,baz,UNKNOWN=val,relabel=on", "edit-simple-security")
+-c.add_compare("--features eoi=on,hyperv_relaxed=off,acpi=", "edit-simple-features")
++c.add_compare("--features eoi=on,hyperv_relaxed=off,acpi=", "edit-simple-features", precompare_check="8.0.0")
+ c.add_compare("--clock offset=localtime,hpet_present=yes,kvmclock_present=no,kvmclock_tickpolicy=foo,rtc_tickpolicy=merge", "edit-simple-clock")
+ c.add_compare("--pm suspend_to_mem.enabled=yes,suspend_to_disk.enabled=no", "edit-simple-pm")
+ c.add_compare("--disk /dev/zero,perms=ro,source.startupPolicy=optional", "edit-simple-disk")


=====================================
debian/patches/series
=====================================
@@ -0,0 +1,5 @@
+virtinst-Fix-TOCTOU-in-domain-enumeration.patch
+fix-tests2.patch
+fix-tests3.patch
+fix-tests4.patch
+fix-tests5.patch


=====================================
debian/patches/virtinst-Fix-TOCTOU-in-domain-enumeration.patch
=====================================
@@ -0,0 +1,41 @@
+Author: Martin Pitt <martin at piware.de>
+Date: Tue, 24 Nov 2020 14:24:06 +0100
+Description: [PATCH virt-manager] virtinst: Fix TOCTOU in domain enumeration
+
+Similar to commit 49a01b5482, _fetch_all_domains_raw() has a race
+condition where a domain may disappear (from parallel libvirt
+operations) in between enumerating and inspecting the objects.
+
+Ignore these missing domains instead of crashing.
+
+https://bugzilla.redhat.com/show_bug.cgi?id=1901081
+Signed-off-by: Cole Robinson <crobinso at redhat.com>
+---
+ virtinst/connection.py | 12 ++++++++++--
+ 1 file changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/virtinst/connection.py b/virtinst/connection.py
+index fec273b7..06bc60ad 100644
+--- a/virtinst/connection.py
++++ b/virtinst/connection.py
+@@ -182,8 +182,16 @@ class VirtinstConnection(object):
+     def _fetch_all_domains_raw(self):
+         dummy1, dummy2, ret = pollhelpers.fetch_vms(
+             self, {}, lambda obj, ignore: obj)
+-        return [Guest(weakref.proxy(self), parsexml=obj.XMLDesc(0))
+-                for obj in ret]
++        domains = []
++        for obj in ret:
++            # TOCTOU race: a domain may go away in between enumeration and inspection
++            try:
++                xml = obj.XMLDesc(0)
++            except libvirt.libvirtError as e:  # pragma: no cover
++                log.debug("Fetching domain XML failed: %s", e)
++                continue
++            domains.append(Guest(weakref.proxy(self), parsexml=xml))
++        return domains
+ 
+     def _build_pool_raw(self, poolobj):
+         return StoragePool(weakref.proxy(self),
+-- 
+2.29.2



View it on GitLab: https://salsa.debian.org/libvirt-team/virt-manager/-/compare/971a93781ff4aaf1ca80061fe34df6998a56e90f...c8d66b48eeab47217d66c73310fd2bbd317e466e

-- 
View it on GitLab: https://salsa.debian.org/libvirt-team/virt-manager/-/compare/971a93781ff4aaf1ca80061fe34df6998a56e90f...c8d66b48eeab47217d66c73310fd2bbd317e466e
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-libvirt-commits/attachments/20220217/544bb669/attachment-0001.htm>


More information about the Pkg-libvirt-commits mailing list