Merge ~paelzer/ubuntu/+source/libvirt-dbus:lp-1802005-allow-libvirtdbus-to-access-libvirt-GROOVY into ~paelzer/ubuntu/+source/libvirt-dbus:current-groovy

Proposed by Christian Ehrhardt 
Status: Merged
Merge reported by: Christian Ehrhardt 
Merged at revision: 1337867762c59af0e9e9aba3f1c2b30c38b21f78
Proposed branch: ~paelzer/ubuntu/+source/libvirt-dbus:lp-1802005-allow-libvirtdbus-to-access-libvirt-GROOVY
Merge into: ~paelzer/ubuntu/+source/libvirt-dbus:current-groovy
Diff against target: 239 lines (+189/-1)
7 files modified
debian/changelog (+11/-0)
debian/control (+2/-1)
debian/patches/series (+3/-0)
debian/patches/tests-skip-CPU-pinning-test-on-libvirt-6.6.0.patch (+41/-0)
debian/patches/tests-vcpupininfo-32bit.patch (+36/-0)
debian/patches/tests-vcpupininfo-use-pytest.skip.patch (+43/-0)
debian/postinst (+53/-0)
Reviewer Review Type Date Requested Status
Paride Legovini (community) Approve
Canonical Server packageset reviewers Pending
Christian Ehrhardt  Pending
Review via email: mp+391526@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Set back to WIP for now ...

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

*sigh* test errors (unrelated to my change) that didn't happen before stall this ...

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

After some patches from upstream, a discussion there, and a follow on patch.
Now builds fine.

Ready for review

Revision history for this message
Paride Legovini (paride) wrote :

LGTM, I just spotted a typo in a comment (see inline comment).

Builds fine locally and it's lintian clean. The "usermod -a -G" bit looks good, I'm surprised by the low number of packages needing to run usermod that way in postinst, but I couldn't find a different way of doing it (e.g. directly via dh_sysusers or similar).

More worrisome is the issue with gulong on armhf: tests-vcpupininfo-32bit.patch band-aids the bug but the underlying issue is likely to still show, as gulongs are used elsewhere in the code. This is however clearly stated in the patch description.

review: Approve
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

complete

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 6650114..f61e3fe 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,14 @@
6+libvirt-dbus (1.4.0-1ubuntu1) groovy; urgency=medium
7+
8+ * d/postinst: add libvirtdbus to group libvirt to be able to access the
9+ sockets of libvirtd (LP: #1802005)
10+ * Fix FTFBS due to libvirt 6.6
11+ - d/p/tests-skip-CPU-pinning-test-on-libvirt-6.6.0.patch
12+ - d/p/tests-vcpupininfo-use-pytest.skip.patch
13+ - d/p/tests-vcpupininfo-32bit.patch: fix tests on armhf
14+
15+ -- Christian Ehrhardt <christian.ehrhardt@canonical.com> Tue, 29 Sep 2020 15:16:03 +0200
16+
17 libvirt-dbus (1.4.0-1) unstable; urgency=medium
18
19 * [47a48e5] New upstream version 1.4.0
20diff --git a/debian/control b/debian/control
21index 1d41361..a51385a 100644
22--- a/debian/control
23+++ b/debian/control
24@@ -1,7 +1,8 @@
25 Source: libvirt-dbus
26 Section: admin
27 Priority: optional
28-Maintainer: Debian Libvirt Maintainers <pkg-libvirt-maintainers@lists.alioth.debian.org>
29+Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
30+XSBC-Original-Maintainer: Debian Libvirt Maintainers <pkg-libvirt-maintainers@lists.alioth.debian.org>
31 Uploaders: Andrea Bolognani <eof@kiyuko.org>
32 Homepage: https://libvirt.org/
33 Vcs-Git: https://salsa.debian.org/libvirt-team/libvirt-dbus.git
34diff --git a/debian/patches/series b/debian/patches/series
35new file mode 100644
36index 0000000..16f1b67
37--- /dev/null
38+++ b/debian/patches/series
39@@ -0,0 +1,3 @@
40+tests-skip-CPU-pinning-test-on-libvirt-6.6.0.patch
41+tests-vcpupininfo-use-pytest.skip.patch
42+tests-vcpupininfo-32bit.patch
43diff --git a/debian/patches/tests-skip-CPU-pinning-test-on-libvirt-6.6.0.patch b/debian/patches/tests-skip-CPU-pinning-test-on-libvirt-6.6.0.patch
44new file mode 100644
45index 0000000..cbc496d
46--- /dev/null
47+++ b/debian/patches/tests-skip-CPU-pinning-test-on-libvirt-6.6.0.patch
48@@ -0,0 +1,41 @@
49+From e01a3cf5e60fa8f4d3bf9a805bfedbe5d5fa1507 Mon Sep 17 00:00:00 2001
50+From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
51+Date: Tue, 22 Sep 2020 16:16:02 +0100
52+Subject: [PATCH] tests: skip CPU pinning test on libvirt 6.6.0
53+MIME-Version: 1.0
54+Content-Type: text/plain; charset=UTF-8
55+Content-Transfer-Encoding: 8bit
56+
57+This release broke the test driver making it depend on host CPU topology
58+instead of the fake CPU topology.
59+
60+Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
61+
62+Origin: upstream, https://gitlab.com/libvirt/libvirt-dbus/-/commit/e01a3cf5e6
63+Last-Update: 2020-10-01
64+
65+---
66+ tests/test_domain.py | 7 +++++++
67+ 1 file changed, 7 insertions(+)
68+
69+diff --git a/tests/test_domain.py b/tests/test_domain.py
70+index 624d25b..7f67a3a 100755
71+--- a/tests/test_domain.py
72++++ b/tests/test_domain.py
73+@@ -153,6 +153,13 @@ class TestDomain(libvirttest.BaseTestClass):
74+ assert domain.GetVcpus(0) == dbus.Int32(vcpus_expected)
75+
76+ def test_domain_vcpu_pin_info(self):
77++ # Test driver was broken in 6.6.0 accidentally depending
78++ # on host CPU topology instead of its fake topology
79++ obj = self.bus.get_object('org.libvirt', '/org/libvirt/Test')
80++ ver = obj.Get('org.libvirt.Connect', "LibVersion", dbus_interface=dbus.PROPERTIES_IFACE)
81++ if ver == 6006000:
82++ return
83++
84+ obj, domain = self.get_test_domain()
85+ pinInfo_expected = [
86+ [True, True, True, True, True, True, True, True],
87+--
88+2.28.0
89+
90diff --git a/debian/patches/tests-vcpupininfo-32bit.patch b/debian/patches/tests-vcpupininfo-32bit.patch
91new file mode 100644
92index 0000000..74644aa
93--- /dev/null
94+++ b/debian/patches/tests-vcpupininfo-32bit.patch
95@@ -0,0 +1,36 @@
96+Description: fix tests on 32bit armhf
97+ There seems to be an underlying issue with gulong variables, for now mask
98+ the value in the test to get the correct 32bit result that it checks on.
99+ I forwarded the case in below IRC discussion, but the fix is only a band aid
100+ for our builds until the underlying issue is fixed.
101+ IRC snippet:
102+ <cpaelzer> danp: jtomko: but I wonder about the result - it works on all
103+ architectures but armhf for me - the version that is returned is odd
104+ <cpaelzer> it is 17830927092969874672
105+ <jtomko> cpaelzer: the lower 32 bits of the number you posted are 6006000
106+ <cpaelzer> hmm, so we could need a mask then on armhf
107+ <jtomko> virtDBusConnectGetLibVersion sets "t" as the type (u64) but passes
108+ a gulong there
109+ <cpaelzer> the type auto-set for var is <class 'dbus.UInt64'>
110+ <jtomko> cpaelzer: it might not be the only libvirt-dbus API broken on 32-bit.
111+ a quick 'git grep gulong' shows we use it even for APIs that take long long
112+ sometimes
113+ <cpaelzer> jtomko: just for confirmation ver &= 0xFFFFFFFF indeed "fixes" the
114+ issue
115+ <cpaelzer> but yes there might be a bigger underlying issue in regard to the
116+ gulong usage
117+Forwarded: IRC
118+Author: Christian Ehrhardt <christian.ehrhardt@canonical.com>
119+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=971171
120+Last-Update: 2019-06-30
121+--- a/tests/test_domain.py
122++++ b/tests/test_domain.py
123+@@ -158,6 +158,8 @@ class TestDomain(libvirttest.BaseTestCla
124+ # on host CPU topology instead of its fake topology
125+ obj = self.bus.get_object('org.libvirt', '/org/libvirt/Test')
126+ ver = obj.Get('org.libvirt.Connect', "LibVersion", dbus_interface=dbus.PROPERTIES_IFACE)
127++ # There is a problem on 32bit architectures, for now mask this value
128++ ver &= 0xFFFFFFFF
129+ if ver == 6006000:
130+ pytest.skip("CPU toploogy is broken in libvirt 6.6.0 test driver")
131+
132diff --git a/debian/patches/tests-vcpupininfo-use-pytest.skip.patch b/debian/patches/tests-vcpupininfo-use-pytest.skip.patch
133new file mode 100644
134index 0000000..720384a
135--- /dev/null
136+++ b/debian/patches/tests-vcpupininfo-use-pytest.skip.patch
137@@ -0,0 +1,43 @@
138+From e19bc98ff7f653dca7c38e0aeec5754a74141e16 Mon Sep 17 00:00:00 2001
139+From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
140+Date: Thu, 24 Sep 2020 15:10:27 +0200
141+Subject: [PATCH] tests: vcpupininfo: use pytest.skip()
142+MIME-Version: 1.0
143+Content-Type: text/plain; charset=UTF-8
144+Content-Transfer-Encoding: 8bit
145+
146+Mark the test as skipped instead of quietly passing.
147+
148+Signed-off-by: Ján Tomko <jtomko@redhat.com>
149+
150+Origin: upstream, https://gitlab.com/libvirt/libvirt-dbus/-/commit/e19bc98ff7
151+Last-Update: 2020-10-01
152+
153+---
154+ tests/test_domain.py | 3 ++-
155+ 1 file changed, 2 insertions(+), 1 deletion(-)
156+
157+diff --git a/tests/test_domain.py b/tests/test_domain.py
158+index 7f67a3a..605fb43 100755
159+--- a/tests/test_domain.py
160++++ b/tests/test_domain.py
161+@@ -2,6 +2,7 @@
162+
163+ import dbus
164+ import libvirttest
165++import pytest
166+ import xmldata
167+
168+ DBUS_EXCEPTION_MISSING_FUNCTION = 'this function is not supported by the connection driver'
169+@@ -158,7 +159,7 @@ class TestDomain(libvirttest.BaseTestClass):
170+ obj = self.bus.get_object('org.libvirt', '/org/libvirt/Test')
171+ ver = obj.Get('org.libvirt.Connect', "LibVersion", dbus_interface=dbus.PROPERTIES_IFACE)
172+ if ver == 6006000:
173+- return
174++ pytest.skip("CPU toploogy is broken in libvirt 6.6.0 test driver")
175+
176+ obj, domain = self.get_test_domain()
177+ pinInfo_expected = [
178+--
179+2.28.0
180+
181diff --git a/debian/postinst b/debian/postinst
182new file mode 100644
183index 0000000..4bdfa84
184--- /dev/null
185+++ b/debian/postinst
186@@ -0,0 +1,53 @@
187+#!/bin/sh
188+# postinst script for libvirt-dbus
189+#
190+# see: dh_installdeb(1)
191+
192+set -e
193+
194+# summary of how this script can be called:
195+# * <postinst> `configure' <most-recently-configured-version>
196+# * <old-postinst> `abort-upgrade' <new version>
197+# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
198+# <new-version>
199+# * <postinst> `abort-remove'
200+# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
201+# <failed-install-package> <version> `removing'
202+# <conflicting-package> <version>
203+# for details, see https://www.debian.org/doc/debian-policy/ or
204+# the debian-policy package
205+
206+
207+case "$1" in
208+ configure)
209+ ;;
210+
211+ abort-upgrade|abort-remove|abort-deconfigure)
212+ ;;
213+
214+ *)
215+ echo "postinst called with unknown argument \`$1'" >&2
216+ exit 1
217+ ;;
218+esac
219+
220+# dh_installdeb will replace this with shell code automatically
221+# generated by other debhelper scripts.
222+
223+#DEBHELPER#
224+
225+case "$1" in
226+ configure)
227+ # after users are created by dh_sysuser: add user to libvirt group
228+ # if policykit isn't used to manae access to libvirt sockets then it
229+ # will use group based permission management with the group "libvirt"
230+ # being the one to gain access.
231+ # libvirt-dbus is safe via /usr/share/dbus-1/system.d/org.libvirt.conf
232+ # so we can allow that by default
233+ if getent group libvirt >/dev/null; then
234+ usermod -a -G libvirt libvirtdbus
235+ fi
236+ ;;
237+esac
238+
239+exit 0

Subscribers

People subscribed via source and target branches

to all changes: