Package: release.debian.org
Severity: normal
Tags: bullseye
User: release.debian....@packages.debian.org
Usertags: pu
X-Debbugs-Cc: libv...@packages.debian.org
Control: affects -1 + src:libvirt

This update fixes the test failures on arm64 that were
detected by the 7.0.0-3+deb11u1 build.

[ Impact ]
We can't do any further updates of libvirt in stable (unless we
disable the test suite or specific tests).

[ Risks ]
As this doesn't affect actual code in a binary packages the
risk should be fairly low.

[ Checklist ]
  [x] *all* changes are documented in the d/changelog
  [x] I reviewed all changes and I approve them
  [x] attach debdiff against the package in (old)stable
  [x] the issue is verified as fixed in unstable

[ Changes ]
Backport to upstream patches to fix libxl test failures
triggered by newer xen versions.

Cheers,
 -- Guido
diff --git a/debian/changelog b/debian/changelog
index 28579ccd7e..76fb402cbc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+libvirt (7.0.0-3+deb11u2) bullseye; urgency=medium
+
+  * [461d540] Fix libxl config test failures.
+    Backports two commits from upstream to not fail with newer xen.
+
+ -- Guido Günther <a...@sigxcpu.org>  Mon, 06 Feb 2023 17:50:14 +0100
+
 libvirt (7.0.0-3+deb11u1) bullseye; urgency=medium
 
   [ Guido Günther ]
diff --git a/debian/patches/backport/tests-Fix-libxlxml2domconfigtest-with-latest-xen.patch b/debian/patches/backport/tests-Fix-libxlxml2domconfigtest-with-latest-xen.patch
new file mode 100644
index 0000000000..b30cd52dc1
--- /dev/null
+++ b/debian/patches/backport/tests-Fix-libxlxml2domconfigtest-with-latest-xen.patch
@@ -0,0 +1,235 @@
+From: Cole Robinson <crobi...@redhat.com>
+Date: Thu, 27 Oct 2022 08:51:25 -0400
+Subject: tests: Fix libxlxml2domconfigtest with latest xen
+
+shadow_memkb is populated from a libxl API call, and the value can
+change. For example:
+https://xenbits.xen.org/gitweb/?p=xen.git;a=commit;h=2c992810854a15b41be920519ce83a4a328d5168
+
+Mock libxl_get_required_shadow_memory to give consistent output
+
+Reviewed-by: Michal Privoznik <mpriv...@redhat.com>
+Signed-off-by: Cole Robinson <crobi...@redhat.com>
+(cherry picked from commit 72d4709ab901dd3699d342f15ca3aff9bffddf96)
+---
+ tests/libxlmock.c                                            | 11 +++++++++++
+ tests/libxlxml2domconfigdata/basic-hvm.json                  |  2 +-
+ tests/libxlxml2domconfigdata/basic-pv.json                   |  2 +-
+ tests/libxlxml2domconfigdata/basic-pvh.json                  |  2 +-
+ tests/libxlxml2domconfigdata/cpu-shares-hvm.json             |  2 +-
+ tests/libxlxml2domconfigdata/fullvirt-acpi-slic.json         |  2 +-
+ tests/libxlxml2domconfigdata/fullvirt-cpuid-legacy-nest.json |  2 +-
+ tests/libxlxml2domconfigdata/fullvirt-cpuid.json             |  2 +-
+ tests/libxlxml2domconfigdata/max-eventchannels-hvm.json      |  2 +-
+ tests/libxlxml2domconfigdata/max-gntframes-hvm.json          |  2 +-
+ tests/libxlxml2domconfigdata/moredevs-hvm.json               |  2 +-
+ tests/libxlxml2domconfigdata/multiple-ip.json                |  2 +-
+ tests/libxlxml2domconfigdata/variable-clock-hvm.json         |  2 +-
+ tests/libxlxml2domconfigdata/vnuma-hvm-legacy-nest.json      |  2 +-
+ tests/libxlxml2domconfigdata/vnuma-hvm.json                  |  2 +-
+ 15 files changed, 25 insertions(+), 14 deletions(-)
+
+diff --git a/tests/libxlmock.c b/tests/libxlmock.c
+index a36ca13..644b8ef 100644
+--- a/tests/libxlmock.c
++++ b/tests/libxlmock.c
+@@ -95,6 +95,17 @@ VIR_MOCK_STUB_RET_ARGS(bind,
+                        const struct sockaddr *, addr,
+                        socklen_t, addrlen)
+ 
++VIR_MOCK_IMPL_RET_ARGS(libxl_get_required_shadow_memory,
++                       unsigned long,
++                       unsigned long, maxmem_kb,
++                       unsigned int, smp_cpus)
++{
++    /* silence gcc warning about unused function */
++    if (0)
++        real_libxl_get_required_shadow_memory(maxmem_kb, smp_cpus);
++    return 1234;
++}
++
+ VIR_MOCK_IMPL_RET_ARGS(__xstat, int,
+                        int, ver,
+                        const char *, path,
+diff --git a/tests/libxlxml2domconfigdata/basic-hvm.json b/tests/libxlxml2domconfigdata/basic-hvm.json
+index 87f8cb7..d308754 100644
+--- a/tests/libxlxml2domconfigdata/basic-hvm.json
++++ b/tests/libxlxml2domconfigdata/basic-hvm.json
+@@ -15,7 +15,7 @@
+         "max_memkb": 1048576,
+         "target_memkb": 1048576,
+         "video_memkb": 8192,
+-        "shadow_memkb": 12288,
++        "shadow_memkb": 1234,
+         "device_model_version": "qemu_xen",
+         "device_model": "/bin/true",
+         "sched_params": {
+diff --git a/tests/libxlxml2domconfigdata/basic-pv.json b/tests/libxlxml2domconfigdata/basic-pv.json
+index b71c3b0..32d188f 100644
+--- a/tests/libxlxml2domconfigdata/basic-pv.json
++++ b/tests/libxlxml2domconfigdata/basic-pv.json
+@@ -14,7 +14,7 @@
+         ],
+         "max_memkb": 524288,
+         "target_memkb": 524288,
+-        "shadow_memkb": 8192,
++        "shadow_memkb": 1234,
+         "sched_params": {
+ 
+         },
+diff --git a/tests/libxlxml2domconfigdata/basic-pvh.json b/tests/libxlxml2domconfigdata/basic-pvh.json
+index 48365c9..f51957a 100644
+--- a/tests/libxlxml2domconfigdata/basic-pvh.json
++++ b/tests/libxlxml2domconfigdata/basic-pvh.json
+@@ -14,7 +14,7 @@
+         ],
+         "max_memkb": 524288,
+         "target_memkb": 524288,
+-        "shadow_memkb": 8192,
++        "shadow_memkb": 1234,
+         "sched_params": {
+ 
+         },
+diff --git a/tests/libxlxml2domconfigdata/cpu-shares-hvm.json b/tests/libxlxml2domconfigdata/cpu-shares-hvm.json
+index 2aa97e8..15105c8 100644
+--- a/tests/libxlxml2domconfigdata/cpu-shares-hvm.json
++++ b/tests/libxlxml2domconfigdata/cpu-shares-hvm.json
+@@ -15,7 +15,7 @@
+         "max_memkb": 1048576,
+         "target_memkb": 1048576,
+         "video_memkb": 8192,
+-        "shadow_memkb": 12288,
++        "shadow_memkb": 1234,
+         "device_model_version": "qemu_xen",
+         "device_model": "/bin/true",
+         "sched_params": {
+diff --git a/tests/libxlxml2domconfigdata/fullvirt-acpi-slic.json b/tests/libxlxml2domconfigdata/fullvirt-acpi-slic.json
+index a2d4679..26f5abe 100644
+--- a/tests/libxlxml2domconfigdata/fullvirt-acpi-slic.json
++++ b/tests/libxlxml2domconfigdata/fullvirt-acpi-slic.json
+@@ -11,7 +11,7 @@
+         ],
+         "max_memkb": 592896,
+         "target_memkb": 403456,
+-        "shadow_memkb": 5656,
++        "shadow_memkb": 1234,
+         "sched_params": {
+         },
+         "apic": "True",
+diff --git a/tests/libxlxml2domconfigdata/fullvirt-cpuid-legacy-nest.json b/tests/libxlxml2domconfigdata/fullvirt-cpuid-legacy-nest.json
+index 6290655..740b82d 100644
+--- a/tests/libxlxml2domconfigdata/fullvirt-cpuid-legacy-nest.json
++++ b/tests/libxlxml2domconfigdata/fullvirt-cpuid-legacy-nest.json
+@@ -11,7 +11,7 @@
+         ],
+         "max_memkb": 592896,
+         "target_memkb": 403456,
+-        "shadow_memkb": 5656,
++        "shadow_memkb": 1234,
+         "cpuid": [
+             {
+                 "leaf": 1,
+diff --git a/tests/libxlxml2domconfigdata/fullvirt-cpuid.json b/tests/libxlxml2domconfigdata/fullvirt-cpuid.json
+index 811a4f0..8bf4189 100644
+--- a/tests/libxlxml2domconfigdata/fullvirt-cpuid.json
++++ b/tests/libxlxml2domconfigdata/fullvirt-cpuid.json
+@@ -11,7 +11,7 @@
+         ],
+         "max_memkb": 592896,
+         "target_memkb": 403456,
+-        "shadow_memkb": 5656,
++        "shadow_memkb": 1234,
+         "cpuid": [
+             {
+                 "leaf": 1,
+diff --git a/tests/libxlxml2domconfigdata/max-eventchannels-hvm.json b/tests/libxlxml2domconfigdata/max-eventchannels-hvm.json
+index 4a5b0ca..6f0daa0 100644
+--- a/tests/libxlxml2domconfigdata/max-eventchannels-hvm.json
++++ b/tests/libxlxml2domconfigdata/max-eventchannels-hvm.json
+@@ -15,7 +15,7 @@
+         "max_memkb": 1048576,
+         "target_memkb": 1048576,
+         "video_memkb": 8192,
+-        "shadow_memkb": 12288,
++        "shadow_memkb": 1234,
+         "event_channels": 2047,
+         "device_model_version": "qemu_xen",
+         "device_model": "/bin/true",
+diff --git a/tests/libxlxml2domconfigdata/max-gntframes-hvm.json b/tests/libxlxml2domconfigdata/max-gntframes-hvm.json
+index 2883d05..35de588 100644
+--- a/tests/libxlxml2domconfigdata/max-gntframes-hvm.json
++++ b/tests/libxlxml2domconfigdata/max-gntframes-hvm.json
+@@ -15,7 +15,7 @@
+         "max_memkb": 1048576,
+         "target_memkb": 1048576,
+         "video_memkb": 8192,
+-        "shadow_memkb": 12288,
++        "shadow_memkb": 1234,
+         "max_grant_frames": 64,
+         "device_model_version": "qemu_xen",
+         "device_model": "/bin/true",
+diff --git a/tests/libxlxml2domconfigdata/moredevs-hvm.json b/tests/libxlxml2domconfigdata/moredevs-hvm.json
+index 58cf32a..bdc9afc 100644
+--- a/tests/libxlxml2domconfigdata/moredevs-hvm.json
++++ b/tests/libxlxml2domconfigdata/moredevs-hvm.json
+@@ -17,7 +17,7 @@
+         "max_memkb": 1048576,
+         "target_memkb": 1048576,
+         "video_memkb": 8192,
+-        "shadow_memkb": 12288,
++        "shadow_memkb": 1234,
+         "device_model_version": "qemu_xen",
+         "device_model": "/bin/true",
+         "sched_params": {
+diff --git a/tests/libxlxml2domconfigdata/multiple-ip.json b/tests/libxlxml2domconfigdata/multiple-ip.json
+index 2db98b8..e0b37aa 100644
+--- a/tests/libxlxml2domconfigdata/multiple-ip.json
++++ b/tests/libxlxml2domconfigdata/multiple-ip.json
+@@ -14,7 +14,7 @@
+         ],
+         "max_memkb": 524288,
+         "target_memkb": 524288,
+-        "shadow_memkb": 8192,
++        "shadow_memkb": 1234,
+         "sched_params": {
+ 
+         },
+diff --git a/tests/libxlxml2domconfigdata/variable-clock-hvm.json b/tests/libxlxml2domconfigdata/variable-clock-hvm.json
+index 9a25d51..3c131c6 100644
+--- a/tests/libxlxml2domconfigdata/variable-clock-hvm.json
++++ b/tests/libxlxml2domconfigdata/variable-clock-hvm.json
+@@ -15,7 +15,7 @@
+         "max_memkb": 1048576,
+         "target_memkb": 1048576,
+         "video_memkb": 8192,
+-        "shadow_memkb": 12288,
++        "shadow_memkb": 1234,
+         "rtc_timeoffset": 3600,
+         "localtime": "True",
+         "device_model_version": "qemu_xen",
+diff --git a/tests/libxlxml2domconfigdata/vnuma-hvm-legacy-nest.json b/tests/libxlxml2domconfigdata/vnuma-hvm-legacy-nest.json
+index 6cda8d0..6725df9 100644
+--- a/tests/libxlxml2domconfigdata/vnuma-hvm-legacy-nest.json
++++ b/tests/libxlxml2domconfigdata/vnuma-hvm-legacy-nest.json
+@@ -103,7 +103,7 @@
+         "max_memkb": 1048576,
+         "target_memkb": 1048576,
+         "video_memkb": 8192,
+-        "shadow_memkb": 14336,
++        "shadow_memkb": 1234,
+         "device_model_version": "qemu_xen",
+         "device_model": "/bin/true",
+         "sched_params": {
+diff --git a/tests/libxlxml2domconfigdata/vnuma-hvm.json b/tests/libxlxml2domconfigdata/vnuma-hvm.json
+index f578ccd..2556c82 100644
+--- a/tests/libxlxml2domconfigdata/vnuma-hvm.json
++++ b/tests/libxlxml2domconfigdata/vnuma-hvm.json
+@@ -103,7 +103,7 @@
+         "max_memkb": 1048576,
+         "target_memkb": 1048576,
+         "video_memkb": 8192,
+-        "shadow_memkb": 14336,
++        "shadow_memkb": 1234,
+         "device_model_version": "qemu_xen",
+         "device_model": "/bin/true",
+         "sched_params": {
diff --git a/debian/patches/backport/tests-Fix-libxlxml2domconfigtest.patch b/debian/patches/backport/tests-Fix-libxlxml2domconfigtest.patch
new file mode 100644
index 0000000000..57409c41ae
--- /dev/null
+++ b/debian/patches/backport/tests-Fix-libxlxml2domconfigtest.patch
@@ -0,0 +1,98 @@
+From: Jim Fehlig <jfeh...@suse.com>
+Date: Thu, 10 Nov 2022 17:55:38 -0700
+Subject: tests: Fix libxlxml2domconfigtest
+
+Downstream CI recently encountered failures of libxlxml2domconfigtest when
+building libvirt packages against Xen 4.17 rc3 packages. The test fails on
+vnuma_hvm config, where suddently the actual json produced by
+libxl_domain_config_to_json() contains a 'pnode' entry in the 'vnuma_nodes'
+list, which is absent in the expected json. It appears the test has thus far
+passed by luck. E.g. I was able to make the test pass in the failing
+environment by changing the meson buildtype from debugoptimized to debug.
+
+When a VM config contains vnuma settings, libxlMakeVnumaList() checks if the
+number of requested vnuma nodes exceeds the number of physical nodes. The
+number of physical nodes is retrieved with libxl_get_physinfo(), which can
+return wildly different results in the context of unit tests. This change
+mocks libxl_get_physinfo() to return consistent results. All fields of the
+libxl_physinfo struct are set to 0 except nr_nodes, which is set to 6 to
+ensure the vnuma_hvm configuration is properly tested.
+
+Signed-off-by: Jim Fehlig <jfeh...@suse.com>
+Reviewed-by: Michal Privoznik <mpriv...@redhat.com>
+(cherry picked from commit f81ee7b549242c93bead8c8772bb31047da00415)
+---
+ tests/libxlmock.c                           | 15 +++++++++++++++
+ tests/libxlxml2domconfigdata/vnuma-hvm.json |  5 +++++
+ 2 files changed, 20 insertions(+)
+
+diff --git a/tests/libxlmock.c b/tests/libxlmock.c
+index 644b8ef..4ab88dd 100644
+--- a/tests/libxlmock.c
++++ b/tests/libxlmock.c
+@@ -64,6 +64,21 @@ VIR_MOCK_IMPL_RET_ARGS(libxl_get_version_info,
+     return &info;
+ }
+ 
++VIR_MOCK_IMPL_RET_ARGS(libxl_get_physinfo,
++                       int,
++                       libxl_ctx *, ctx,
++                       libxl_physinfo *, physinfo)
++{
++    memset(physinfo, 0, sizeof(*physinfo));
++    physinfo->nr_nodes = 6;
++
++    /* silence gcc warning about unused function */
++    if (0)
++        real_libxl_get_physinfo(ctx, physinfo);
++
++    return 0;
++}
++
+ VIR_MOCK_STUB_RET_ARGS(libxl_get_free_memory,
+                        int, 0,
+                        libxl_ctx *, ctx,
+diff --git a/tests/libxlxml2domconfigdata/vnuma-hvm.json b/tests/libxlxml2domconfigdata/vnuma-hvm.json
+index 2556c82..68c1c25 100644
+--- a/tests/libxlxml2domconfigdata/vnuma-hvm.json
++++ b/tests/libxlxml2domconfigdata/vnuma-hvm.json
+@@ -39,6 +39,7 @@
+                     41,
+                     51
+                 ],
++                "pnode": 1,
+                 "vcpus": [
+                     1
+                 ]
+@@ -53,6 +54,7 @@
+                     31,
+                     41
+                 ],
++                "pnode": 2,
+                 "vcpus": [
+                     2
+                 ]
+@@ -67,6 +69,7 @@
+                     21,
+                     31
+                 ],
++                "pnode": 3,
+                 "vcpus": [
+                     3
+                 ]
+@@ -81,6 +84,7 @@
+                     10,
+                     21
+                 ],
++                "pnode": 4,
+                 "vcpus": [
+                     4
+                 ]
+@@ -95,6 +99,7 @@
+                     21,
+                     10
+                 ],
++                "pnode": 5,
+                 "vcpus": [
+                     5
+                 ]
diff --git a/debian/patches/series b/debian/patches/series
index dae748e4ee..cd3210e8dc 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -13,3 +13,5 @@ debian/Set-defaults-for-zfs-tools.patch
 debian/Revert-m4-virt-xdr-rewrite-XDR-check.patch
 debian/Use-sensible-editor-by-default.patch
 backport/vircgroup-Fix-virCgroupKillRecursive-wrt-nested-controlle.patch
+backport/tests-Fix-libxlxml2domconfigtest-with-latest-xen.patch
+backport/tests-Fix-libxlxml2domconfigtest.patch

Reply via email to