[PATCH 00/12] fix many test failures in various build config scenarios
by Daniel P. Berrangé
I was annoyed that
meson build --auto-features=disabled -Dtests=enabled
will fail in unit tests. Rather than just fix that scenario, I went
down the rabbit hole and tested (almost) every single minimal build
option.
By that I mean I looked at meson_options.txt and got a list of every
option that has 'auto' as its default. I then attempted a minimal
build with only that enabled. I quickly found some options have
mandatory pre-requisite options, so I re-did the tests with such
deps present.
This uncovered many scenarios where we didn't use the right conditions
for tests. Surprisingly (at first, but not in retrospect) it also
found many places where the tests failed to depend on the earlier
build artifacts.
My test process was:
opts=$(grep auto meson_options.txt | sed -e 's/option(//' -e 's/,.*//' -e "s/'//g")
for opt in $opts
do
deps=`grep --before 1 "option('$opt'" meson_options.txt | grep dep: | head -1 | sed -e 's/# //' -e 's/dep:/-D/g' -e 's/$/=enabled/' -e 's/ -D/=enabled -D/g'`
echo "Try test $opt with $deps"
rm -rf build
meson setup build --auto-features=disabled -Dtests=enabled $deps -D$opt=enabled 1> opt-$opt.log 2>&1
meson test -C build --no-suite syntax-check --print-errorlogs 1>> opt-$opt.log 2>&1 ; done
done
Then to check results
grep '^Fail:' opt-*.log | grep -v 0
This is slow, but not as slow as you might think, because each
build is very minimal, so we're not actually building more than
300-400 files each time, rather than 1000's, and we're not running
as many tests either.
Might be interesting to get extensive test into CI.
Strictly speaking we care about the combinatorial expansion of
meson_options.txt, but that would be insanely slow and is likely
to be overkill.
Daniel P. Berrangé (12):
scripts/rpcgen: skip tests if tirpc is not present
tests: fix tests when test driver is disabled
meson: record which other options are a pre-requisite
docs: ensure HTML/images are built before running reference tests
src: ensure augeas test file is generated before running test
tests: build 'virsh' before running virsh-auth test
tests: build driver modules before virdrivermoduletest
test: conditionalize 'virsh-auth' on test driver
tests: always build securityselinuxhelper if libselinux is present
test: drop bogus check for YAJL from libxl test/mock
tests: don't run mdevctl test if lacking YAJL
src/node_device: don't overwrite error messages
docs/images/meson.build | 5 ++-
docs/logos/meson.build | 5 ++-
docs/meson.build | 1 +
meson_options.txt | 20 +++++++++
scripts/rpcgen/meson.build | 2 +-
src/meson.build | 6 ++-
src/node_device/node_device_driver.c | 2 -
tests/fchosttest.c | 9 ++--
tests/libxlmock.c | 4 +-
tests/libxlxml2domconfigtest.c | 4 +-
tests/meson.build | 67 ++++++++++++++++++----------
11 files changed, 87 insertions(+), 38 deletions(-)
--
2.43.0
10 months, 3 weeks
[PATCH 0/4] Introduce SSH proxy
by Michal Privoznik
*** BLURB HERE ***
Michal Prívozník (4):
datatypes: Declare g_autoptr cleanup functions for more public objects
tools: Introduce SSH proxy
docs: Document SSH proxy
NEWS: Document SSH proxy feature
NEWS.rst | 5 +
docs/docs.rst | 3 +
docs/meson.build | 1 +
docs/nss.rst | 7 +
docs/ssh-proxy.rst | 60 +++++
libvirt.spec.in | 27 +++
meson.build | 16 +-
meson_options.txt | 2 +
po/POTFILES | 1 +
src/datatypes.h | 16 ++
tools/meson.build | 2 +
tools/ssh-proxy/30-libvirt-ssh-proxy.conf.in | 10 +
tools/ssh-proxy/meson.build | 25 ++
tools/ssh-proxy/ssh-proxy.c | 233 +++++++++++++++++++
14 files changed, 407 insertions(+), 1 deletion(-)
create mode 100644 docs/ssh-proxy.rst
create mode 100644 tools/ssh-proxy/30-libvirt-ssh-proxy.conf.in
create mode 100644 tools/ssh-proxy/meson.build
create mode 100644 tools/ssh-proxy/ssh-proxy.c
--
2.43.2
10 months, 3 weeks
[PATCH 0/2] interface: Refactor code and fix old listing API when interface is unbound
by Peter Krempa
Patch 1/2 removes a pointless helper in favor of making an almost
identical function more universal, so that patch 2/2 then fixes all
cases in one place.
Peter Krempa (2):
interface_udev: Replace udevNumOfInterfacesByStatus by
udevListInterfacesByStatus
udevListInterfacesByStatus: Don't try to return NULL names
src/interface/interface_backend_udev.c | 84 +++++++++-----------------
1 file changed, 30 insertions(+), 54 deletions(-)
--
2.44.0
10 months, 3 weeks
[PATCH] qemu_saveimage: add zstd to supported compression formats
by Adam Julis
Extend the list of supported formats, update and clarify comment
in qemu.conf.in (removed misleading sentence about the order of
compression format types).
Signed-off-by: Adam Julis <ajulis(a)redhat.com>
---
libvirt.spec.in | 1 +
src/qemu/qemu.conf.in | 7 +++----
src/qemu/qemu_saveimage.c | 2 ++
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 64018192b6..88c62f6d92 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -815,6 +815,7 @@ Requires: gzip
Requires: bzip2
Requires: lzop
Requires: xz
+Requires: zstd
Requires: systemd-container
Requires: swtpm-tools
%if %{with_numad}
diff --git a/src/qemu/qemu.conf.in b/src/qemu/qemu.conf.in
index f406df8749..6bc2140dcb 100644
--- a/src/qemu/qemu.conf.in
+++ b/src/qemu/qemu.conf.in
@@ -582,10 +582,9 @@
# memory from the domain is dumped out directly to a file. If you have
# guests with a large amount of memory, however, this can take up quite
# a bit of space. If you would like to compress the images while they
-# are being saved to disk, you can also set "lzop", "gzip", "bzip2", or "xz"
-# for save_image_format. Note that this means you slow down the process of
-# saving a domain in order to save disk space; the list above is in descending
-# order by performance and ascending order by compression ratio.
+# are being saved to disk, you can also set "zstd", "lzop", "gzip", "bzip2",
+# or "xz" for save_image_format. Note that this means you slow down the process
+# of saving a domain in order to save disk space.
#
# save_image_format is used when you use 'virsh save' or 'virsh managedsave'
# at scheduled saving, and it is an error if the specified save_image_format
diff --git a/src/qemu/qemu_saveimage.c b/src/qemu/qemu_saveimage.c
index 89112e3e44..018ab5a222 100644
--- a/src/qemu/qemu_saveimage.c
+++ b/src/qemu/qemu_saveimage.c
@@ -47,6 +47,7 @@ typedef enum {
*/
QEMU_SAVE_FORMAT_XZ = 3,
QEMU_SAVE_FORMAT_LZOP = 4,
+ QEMU_SAVE_FORMAT_ZSTD = 5,
/* Note: add new members only at the end.
These values are used in the on-disk format.
Do not change or re-use numbers. */
@@ -62,6 +63,7 @@ VIR_ENUM_IMPL(qemuSaveCompression,
"bzip2",
"xz",
"lzop",
+ "zstd",
);
static inline void
--
2.44.0
10 months, 3 weeks
[PATCH v2 0/4] qemu: Substract isolcpus from all online affinity
by Michal Privoznik
v2 of:
https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/thread/4V...
diff to v1:
- Don't error out on systems where /sys/devices/system/cpu/isolated is
unavailable.
- Don't error out on systems where /sys/devices/system/cpu/isolated is
empty.
Both of these resulted in new patches.
Michal Prívozník (4):
virbitmap: Introduce virBitmapParseUnlimitedAllowEmpty()
virfile: Introduce virFileReadValueBitmapAllowEmpty()
virhostcpu: Introduce virHostCPUGetIsolated()
qemu: Substract isolcpus from all online affinity
src/libvirt_private.syms | 3 ++
src/qemu/qemu_process.c | 9 +++++
src/util/virbitmap.c | 40 +++++++++++++++++---
src/util/virbitmap.h | 3 ++
src/util/virfile.c | 81 ++++++++++++++++++++++++++++++----------
src/util/virfile.h | 2 +
src/util/virhostcpu.c | 31 +++++++++++++++
src/util/virhostcpu.h | 1 +
tests/virbitmaptest.c | 40 ++++++++++++++++++++
9 files changed, 186 insertions(+), 24 deletions(-)
--
2.43.2
10 months, 3 weeks
[PATCH] NEWS: document qemu: ras as a new feature
by Kristina Hanicova
Signed-off-by: Kristina Hanicova <khanicov(a)redhat.com>
---
NEWS.rst | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/NEWS.rst b/NEWS.rst
index 5a771b4b2f..d72c15bf10 100644
--- a/NEWS.rst
+++ b/NEWS.rst
@@ -17,6 +17,11 @@ v10.4.0 (unreleased)
* **New features**
+ * qemu: Support for ras feature for virt machine type
+
+ It is now possible to set on/off ``ras`` feature in the domain XML for virt
+ (Arm) machine type as ``<ras state='on'/>``.
+
* **Improvements**
* **Bug fixes**
--
2.42.0
10 months, 3 weeks
[PATCH] vsh: Don't init history in cmdComplete()
by Michal Privoznik
Recent rework of virshtest uncovered a subtle bug that was
dormant in now vsh but before that even in monolithic virsh.
In vsh.c there's this vshReadlineInit() function that's supposed
to initialize readline library, i.e. set those global rl_*
pointers. But it also initializes history library. Then, when
virsh/virt-admin quits, vshReadlineDeinit() is called which
writes history into a file (ensuring the parent directory
exists). So far no problem.
Problem arises when cmdComplete() is called (from a bash
completer, for instance). It does not guard call to
vshReadlineInit() with check for interactive shell (and it should
not), but it sets ctl->historyfile which signals to
vshReadlineDeinit() the history should be written.
Now, no real history is written, because nothing was entered on
the stdin, but the parent directory is created nevertheless. With
recent movement in virshtest.c this means some test cases might
create virsh history file which breaks our promise of not
touching user's data in test suite.
Resolves: https://bugs.gentoo.org/931109
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
tools/vsh.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/tools/vsh.c b/tools/vsh.c
index 58855f63ba..e74045c24e 100644
--- a/tools/vsh.c
+++ b/tools/vsh.c
@@ -2973,7 +2973,7 @@ vshReadlineInit(vshControl *ctl)
const char *quote_characters = "\"'";
/* initialize readline stuff only once */
- if (ctl->historydir)
+ if (autoCompleteOpaque)
return 0;
/* Opaque data for autocomplete callbacks. */
@@ -2989,6 +2989,11 @@ vshReadlineInit(vshControl *ctl)
rl_completer_quote_characters = quote_characters;
rl_char_is_quoted_p = vshReadlineCharIsQuoted;
+ /* Stuff below is needed only for interactive mode. */
+ if (!ctl->imode) {
+ return 0;
+ }
+
histsize_env = g_strdup_printf("%s_HISTSIZE", ctl->env_prefix);
/* Limit the total size of the history buffer */
@@ -3149,7 +3154,7 @@ vshInit(vshControl *ctl, const vshCmdGrp *groups)
cmdGroups = groups;
if (vshInitDebug(ctl) < 0 ||
- (ctl->imode && vshReadlineInit(ctl) < 0))
+ vshReadlineInit(ctl) < 0)
return false;
return true;
@@ -3168,7 +3173,7 @@ vshInitReload(vshControl *ctl)
if (ctl->imode)
vshReadlineDeinit(ctl);
- if (ctl->imode && vshReadlineInit(ctl) < 0)
+ if (vshReadlineInit(ctl) < 0)
return false;
return true;
--
2.43.2
10 months, 3 weeks
[PATCH] hyperv: prevent potential NULL dereference
by Oleg Sviridov
Return value of a function 'virDomainChrDefNew' is dereferenced
at hyperv_driver.c without checking for NULL, which can lead to
NULL dereference immediatly after.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Oleg Sviridov <oleg.sviridov(a)red-soft.ru>
---
src/hyperv/hyperv_driver.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c
index 414274fdfd..7580c6a06c 100644
--- a/src/hyperv/hyperv_driver.c
+++ b/src/hyperv/hyperv_driver.c
@@ -1534,7 +1534,8 @@ hypervDomainDefParseSerial(virDomainDef *def, Msvm_ResourceAllocationSettingData
continue;
}
- serial = virDomainChrDefNew(NULL);
+ if (!(serial = virDomainChrDefNew(NULL)))
+ return -1;
serial->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL;
serial->source->type = VIR_DOMAIN_CHR_TYPE_PIPE;
--
2.44.0
10 months, 3 weeks
[PATCH] libxl: Fix domxml-to-native conversion
by Jim Fehlig
Similar to commit 57d084febe, another case of the libxl driver not
adapting to modular daemons. When converting configuration that
contains a type='network' interface, the converter calls
virNetworkLookupByName, passing the hypervisor connection object
instead of a connection to virtnetworkd. E.g.
> cat dom.xml
...
<interface type='network'>
<source network='default'/>
</interface>
...
> virsh net-info default
Name: default
UUID: 25a5b089-1e71-4956-99aa-df2213bbb407
Active: yes
Persistent: no
Autostart: no
Bridge: virbr0
> virsh domxml-to-native xen-xl dom.xml
error: Network not found: default
Acquire a connection to virtnetworkd and use it when calling
virNetwork* APIs.
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
src/libxl/libxl_driver.c | 4 ++--
src/libxl/xen_common.c | 25 +++++++++++++++----------
src/libxl/xen_common.h | 1 -
src/libxl/xen_xl.c | 4 ++--
src/libxl/xen_xl.h | 2 +-
src/libxl/xen_xm.c | 5 ++---
src/libxl/xen_xm.h | 2 +-
tests/xlconfigtest.c | 7 +------
tests/xmconfigtest.c | 7 +------
9 files changed, 25 insertions(+), 32 deletions(-)
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index e42a3dc0a9..4d5eb920bf 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -2709,10 +2709,10 @@ libxlConnectDomainXMLToNative(virConnectPtr conn, const char * nativeFormat,
goto cleanup;
if (STREQ(nativeFormat, XEN_CONFIG_FORMAT_XL)) {
- if (!(conf = xenFormatXL(def, conn)))
+ if (!(conf = xenFormatXL(def)))
goto cleanup;
} else if (STREQ(nativeFormat, XEN_CONFIG_FORMAT_XM)) {
- if (!(conf = xenFormatXM(conn, def)))
+ if (!(conf = xenFormatXM(def)))
goto cleanup;
} else {
diff --git a/src/libxl/xen_common.c b/src/libxl/xen_common.c
index 79eb593432..0b2346d8b5 100644
--- a/src/libxl/xen_common.c
+++ b/src/libxl/xen_common.c
@@ -24,6 +24,7 @@
#include <config.h>
+#include "driver.h"
#include "internal.h"
#include "virerror.h"
#include "virconf.h"
@@ -1586,8 +1587,7 @@ xenMakeIPList(virNetDevIPInfo *guestIP)
}
static int
-xenFormatNet(virConnectPtr conn,
- virConfValue *list,
+xenFormatNet(virConfValue *list,
virDomainNetDef *net,
int hvm,
const char *vif_typename)
@@ -1649,13 +1649,21 @@ xenFormatNet(virConnectPtr conn,
case VIR_DOMAIN_NET_TYPE_NETWORK:
{
- virNetworkPtr network = virNetworkLookupByName(conn, net->data.network.name);
+ virConnectPtr conn = NULL;
+ virNetworkPtr network;
char *bridge;
- if (!network) {
+
+ if (!(conn = virGetConnectNetwork()))
+ return -1;
+
+ if (!(network = virNetworkLookupByName(conn, net->data.network.name))) {
virReportError(VIR_ERR_NO_NETWORK, "%s",
net->data.network.name);
+ virObjectUnref(conn);
return -1;
}
+ virObjectUnref(conn);
+
bridge = virNetworkGetBridgeName(network);
virObjectUnref(network);
if (!bridge) {
@@ -2304,7 +2312,6 @@ xenFormatSound(virConf *conf, virDomainDef *def)
static int
xenFormatVif(virConf *conf,
- virConnectPtr conn,
virDomainDef *def,
const char *vif_typename)
{
@@ -2317,8 +2324,7 @@ xenFormatVif(virConf *conf,
netVal->list = NULL;
for (i = 0; i < def->nnets; i++) {
- if (xenFormatNet(conn, netVal, def->nets[i],
- hvm, vif_typename) < 0)
+ if (xenFormatNet(netVal, def->nets[i], hvm, vif_typename) < 0)
return -1;
}
@@ -2336,7 +2342,6 @@ xenFormatVif(virConf *conf,
int
xenFormatConfigCommon(virConf *conf,
virDomainDef *def,
- virConnectPtr conn,
const char *nativeFormat)
{
if (xenFormatGeneralMeta(conf, def) < 0)
@@ -2364,10 +2369,10 @@ xenFormatConfigCommon(virConf *conf,
return -1;
if (STREQ(nativeFormat, XEN_CONFIG_FORMAT_XL)) {
- if (xenFormatVif(conf, conn, def, "vif") < 0)
+ if (xenFormatVif(conf, def, "vif") < 0)
return -1;
} else if (STREQ(nativeFormat, XEN_CONFIG_FORMAT_XM)) {
- if (xenFormatVif(conf, conn, def, "netfront") < 0)
+ if (xenFormatVif(conf, def, "netfront") < 0)
return -1;
} else {
virReportError(VIR_ERR_INVALID_ARG,
diff --git a/src/libxl/xen_common.h b/src/libxl/xen_common.h
index b21046e959..95408fa896 100644
--- a/src/libxl/xen_common.h
+++ b/src/libxl/xen_common.h
@@ -61,7 +61,6 @@ int xenParseConfigCommon(virConf *conf,
int xenFormatConfigCommon(virConf *conf,
virDomainDef *def,
- virConnectPtr conn,
const char *nativeFormat);
char *xenMakeIPList(virNetDevIPInfo *guestIP);
diff --git a/src/libxl/xen_xl.c b/src/libxl/xen_xl.c
index f175359307..53f6871efc 100644
--- a/src/libxl/xen_xl.c
+++ b/src/libxl/xen_xl.c
@@ -2041,14 +2041,14 @@ xenFormatXLDomainNamespaceData(virConf *conf, virDomainDef *def)
}
virConf *
-xenFormatXL(virDomainDef *def, virConnectPtr conn)
+xenFormatXL(virDomainDef *def)
{
g_autoptr(virConf) conf = NULL;
if (!(conf = virConfNew()))
return NULL;
- if (xenFormatConfigCommon(conf, def, conn, XEN_CONFIG_FORMAT_XL) < 0)
+ if (xenFormatConfigCommon(conf, def, XEN_CONFIG_FORMAT_XL) < 0)
return NULL;
if (xenFormatXLOS(conf, def) < 0)
diff --git a/src/libxl/xen_xl.h b/src/libxl/xen_xl.h
index f8b1ebfde9..028b359b76 100644
--- a/src/libxl/xen_xl.h
+++ b/src/libxl/xen_xl.h
@@ -29,6 +29,6 @@ virDomainDef *xenParseXL(virConf *conn,
virCaps *caps,
virDomainXMLOption *xmlopt);
-virConf *xenFormatXL(virDomainDef *def, virConnectPtr);
+virConf *xenFormatXL(virDomainDef *def);
const char *xenTranslateCPUFeature(const char *feature_name, bool from_libxl);
diff --git a/src/libxl/xen_xm.c b/src/libxl/xen_xm.c
index 5705a5ec0c..274b35153b 100644
--- a/src/libxl/xen_xm.c
+++ b/src/libxl/xen_xm.c
@@ -543,15 +543,14 @@ G_STATIC_ASSERT(MAX_VIRT_CPUS <= sizeof(1UL) * CHAR_BIT);
* Convert a virDomainDef object into an XM config record.
*/
virConf *
-xenFormatXM(virConnectPtr conn,
- virDomainDef *def)
+xenFormatXM(virDomainDef *def)
{
g_autoptr(virConf) conf = NULL;
if (!(conf = virConfNew()))
return NULL;
- if (xenFormatConfigCommon(conf, def, conn, XEN_CONFIG_FORMAT_XM) < 0)
+ if (xenFormatConfigCommon(conf, def, XEN_CONFIG_FORMAT_XM) < 0)
return NULL;
if (xenFormatXMOS(conf, def) < 0)
diff --git a/src/libxl/xen_xm.h b/src/libxl/xen_xm.h
index afb4f51ff7..db2ae52581 100644
--- a/src/libxl/xen_xm.h
+++ b/src/libxl/xen_xm.h
@@ -26,7 +26,7 @@
#include "virconf.h"
#include "domain_conf.h"
-virConf *xenFormatXM(virConnectPtr conn, virDomainDef *def);
+virConf *xenFormatXM(virDomainDef *def);
virDomainDef *xenParseXM(virConf *conf,
virCaps *caps, virDomainXMLOption *xmlopt);
diff --git a/tests/xlconfigtest.c b/tests/xlconfigtest.c
index 962a1f2c4b..00b6a355eb 100644
--- a/tests/xlconfigtest.c
+++ b/tests/xlconfigtest.c
@@ -65,17 +65,12 @@ testCompareParseXML(const char *xlcfg, const char *xml, bool replaceVars)
{
g_autofree char *gotxlcfgData = NULL;
g_autoptr(virConf) conf = NULL;
- g_autoptr(virConnect) conn = NULL;
int wrote = 4096;
g_autoptr(virDomainDef) def = NULL;
g_autofree char *replacedXML = NULL;
gotxlcfgData = g_new0(char, wrote);
- conn = virGetConnect();
- if (!conn)
- return -1;
-
if (replaceVars) {
if (!(replacedXML = testReplaceVarsXML(xml)))
return -1;
@@ -93,7 +88,7 @@ testCompareParseXML(const char *xlcfg, const char *xml, bool replaceVars)
return -1;
}
- if (!(conf = xenFormatXL(def, conn)))
+ if (!(conf = xenFormatXL(def)))
return -1;
if (virConfWriteMem(gotxlcfgData, &wrote, conf) < 0)
diff --git a/tests/xmconfigtest.c b/tests/xmconfigtest.c
index dbf9f7a4c7..30ad49f8b1 100644
--- a/tests/xmconfigtest.c
+++ b/tests/xmconfigtest.c
@@ -39,16 +39,11 @@ testCompareParseXML(const char *xmcfg, const char *xml)
{
g_autofree char *gotxmcfgData = NULL;
g_autoptr(virConf) conf = NULL;
- g_autoptr(virConnect) conn = NULL;
int wrote = 4096;
g_autoptr(virDomainDef) def = NULL;
gotxmcfgData = g_new0(char, wrote);
- conn = virGetConnect();
- if (!conn)
- return -1;
-
if (!(def = virDomainDefParseFile(xml, driver->xmlopt, NULL,
VIR_DOMAIN_DEF_PARSE_INACTIVE)))
return -1;
@@ -58,7 +53,7 @@ testCompareParseXML(const char *xmcfg, const char *xml)
return -1;
}
- if (!(conf = xenFormatXM(conn, def)))
+ if (!(conf = xenFormatXM(def)))
return -1;
if (virConfWriteMem(gotxmcfgData, &wrote, conf) < 0)
--
2.44.0
10 months, 4 weeks