[PATCH] tools: avoid unused parameter warning when readline is disabled
by Daniel P. Berrangé
The vshReadlineHistoryAdd stub method does not use its parameter.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
Pushed to fix minimal build used by layered repo CI
tools/vsh.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/vsh.c b/tools/vsh.c
index ef2a3f62d7..0e8edcd78c 100644
--- a/tools/vsh.c
+++ b/tools/vsh.c
@@ -2971,7 +2971,7 @@ vshReadline(vshControl *ctl G_GNUC_UNUSED,
}
void
-vshReadlineHistoryAdd(const char *cmd)
+vshReadlineHistoryAdd(const char *cmd G_GNUC_UNUSED)
{
/* empty */
}
--
2.26.2
4 years, 2 months
[PATCH 0/3] Some random fixes
by Michal Privoznik
I've tried to run libvirt under valgrind and found two issues. Here are
the fixes.
Michal Prívozník (3):
qemu_interface: Fix @cfg refcounting in qemuInterfacePrepareSlirp()
lib: Prefer g_autoptr() declaration of virQEMUDriverConfigPtr
qemu_namespace: Don't leak mknod items that are being skipped over
src/qemu/qemu_conf.h | 6 +----
src/qemu/qemu_hostdev.c | 4 +--
src/qemu/qemu_interface.c | 11 +++------
src/qemu/qemu_migration.c | 8 ++----
src/qemu/qemu_migration_cookie.c | 4 +--
src/qemu/qemu_namespace.c | 42 +++++++++++++++++++++++---------
tests/domaincapstest.c | 4 +--
tests/qemuxml2xmltest.c | 2 +-
8 files changed, 42 insertions(+), 39 deletions(-)
--
2.26.2
4 years, 2 months
[libvirt PATCH] cpu_map: Use g_auto* in cpuMapLoad
by Tim Wiederhake
Signed-off-by: Tim Wiederhake <twiederh(a)redhat.com>
---
src/cpu/cpu_map.c | 33 ++++++++++++---------------------
1 file changed, 12 insertions(+), 21 deletions(-)
diff --git a/src/cpu/cpu_map.c b/src/cpu/cpu_map.c
index 913e34a067..cbf90d1395 100644
--- a/src/cpu/cpu_map.c
+++ b/src/cpu/cpu_map.c
@@ -169,12 +169,11 @@ int cpuMapLoad(const char *arch,
cpuMapLoadCallback modelCB,
void *data)
{
- xmlDocPtr xml = NULL;
- xmlXPathContextPtr ctxt = NULL;
+ g_autoptr(xmlDoc) xml = NULL;
+ g_autoptr(xmlXPathContext) ctxt = NULL;
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
- char *xpath = NULL;
- int ret = -1;
- char *mapfile;
+ g_autofree char *xpath = NULL;
+ g_autofree char *mapfile = NULL;
if (!(mapfile = virFileFindResource("index.xml",
abs_top_srcdir "/src/cpu_map",
@@ -186,11 +185,11 @@ int cpuMapLoad(const char *arch,
if (arch == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("undefined hardware architecture"));
- goto cleanup;
+ return -1;
}
if (!(xml = virXMLParseFileCtxt(mapfile, &ctxt)))
- goto cleanup;
+ return -1;
virBufferAsprintf(&buf, "./arch[@name='%s']", arch);
@@ -201,28 +200,20 @@ int cpuMapLoad(const char *arch,
if ((ctxt->node = virXPathNode(xpath, ctxt)) == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot find CPU map for %s architecture"), arch);
- goto cleanup;
+ return -1;
}
if (loadData(mapfile, ctxt, "vendor", vendorCB, data) < 0)
- goto cleanup;
+ return -1;
if (loadData(mapfile, ctxt, "feature", featureCB, data) < 0)
- goto cleanup;
+ return -1;
if (loadData(mapfile, ctxt, "model", modelCB, data) < 0)
- goto cleanup;
+ return -1;
if (loadIncludes(ctxt, vendorCB, featureCB, modelCB, data) < 0)
- goto cleanup;
-
- ret = 0;
-
- cleanup:
- xmlXPathFreeContext(ctxt);
- xmlFreeDoc(xml);
- VIR_FREE(xpath);
- VIR_FREE(mapfile);
+ return -1;
- return ret;
+ return 0;
}
--
2.26.2
4 years, 2 months
[libvirt PATCH] Add FreeBSD 11.4 CI job on Cirrus
by Daniel P. Berrangé
The previous 11.3 image provided by Cirrus did not boot, but they have
now provided a working 11.4 image
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
NB, as expected this CI job fails due to the bug that Roman
identified here:
https://www.redhat.com/archives/libvir-list/2020-September/msg00151.html
.gitlab-ci.yml | 9 +++++++++
ci/cirrus/libvirt-freebsd-11.vars | 9 +++++++++
2 files changed, 18 insertions(+)
create mode 100644 ci/cirrus/libvirt-freebsd-11.vars
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 4a42eb479f..ee404bf50a 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -383,6 +383,15 @@ x64-ubuntu-2004:
variables:
NAME: ubuntu-2004
+x64-freebsd-11-build:
+ <<: *cirrus_build_job_definition
+ variables:
+ NAME: freebsd-11
+ CIRRUS_VM_INSTANCE_TYPE: freebsd_instance
+ CIRRUS_VM_IMAGE_SELECTOR: image_family
+ CIRRUS_VM_IMAGE_NAME: freebsd-11-4
+ INSTALL_COMMAND: pkg install -y
+
x64-freebsd-12-build:
<<: *cirrus_build_job_definition
variables:
diff --git a/ci/cirrus/libvirt-freebsd-11.vars b/ci/cirrus/libvirt-freebsd-11.vars
new file mode 100644
index 0000000000..7c29c6f899
--- /dev/null
+++ b/ci/cirrus/libvirt-freebsd-11.vars
@@ -0,0 +1,9 @@
+PACKAGING_COMMAND='pkg'
+CC='/usr/bin/clang'
+CCACHE='/usr/local/bin/ccache'
+MAKE='/usr/local/bin/gmake'
+NINJA='/usr/local/bin/ninja'
+PYTHON='/usr/local/bin/python3'
+PIP='/usr/local/bin/pip-3.7'
+PKGS='augeas autoconf automake avahi bash bash-completion ca_root_nss ccache chrony cppi curl cyrus-sasl dbus diskscrub dnsmasq fusefs-libs gdb gettext gettext-tools git glib gmake gnutls hal libpcap libpciaccess libssh libssh2 libtool libxml2 libxslt lsof ncurses ninja p5-App-cpanminus patch perl5 pkgconf polkit py37-docutils py37-flake8 py37-pip py37-setuptools py37-wheel python3 qemu-utils radvd readline screen sudo vim yajl'
+PYPI_PKGS='meson==0.54.0'
--
2.26.2
4 years, 2 months
[PATCH] util: re-add conditional for ifi_iqdrops field for macOS
by Daniel P. Berrangé
The conditional was removed in
commit ebbf8ebe4fa6f9d43b40673f0f2dad6bf50e2085
Author: Ján Tomko <jtomko(a)redhat.com>
Date: Tue Sep 1 22:56:37 2020 +0200
util: virnetdevtap: stats: fix txdrop on FreeBSD
That commit was correct about this no longer being required for FreeBSD,
but missed that the code is also built on macOS.
Rather than testing for this field in meson though, we can simply use
a platform conditional test in the code.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
Pushed to fix macOS CI build jobs
src/util/virnetdevtap.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/util/virnetdevtap.c b/src/util/virnetdevtap.c
index cc6f254aa1..ab5959c646 100644
--- a/src/util/virnetdevtap.c
+++ b/src/util/virnetdevtap.c
@@ -974,12 +974,20 @@ virNetDevTapInterfaceStats(const char *ifname,
stats->rx_bytes = ifd->ifi_obytes;
stats->rx_packets = ifd->ifi_opackets;
stats->rx_errs = ifd->ifi_oerrors;
+# ifndef __APPLE__
stats->rx_drop = ifd->ifi_oqdrops;
+# else
+ stats->rx_drop = 0;
+# endif
} else {
stats->tx_bytes = ifd->ifi_obytes;
stats->tx_packets = ifd->ifi_opackets;
stats->tx_errs = ifd->ifi_oerrors;
+# ifndef __APPLE__
stats->tx_drop = ifd->ifi_oqdrops;
+# else
+ stats->tx_drop = 0;
+# endif
stats->rx_bytes = ifd->ifi_ibytes;
stats->rx_packets = ifd->ifi_ipackets;
stats->rx_errs = ifd->ifi_ierrors;
--
2.26.2
4 years, 2 months
[PATCH] tests: add FreeBSD dependencies
by Roman Bogorodskiy
Add some FreeBSD-specific libraries (-lutil, -lkvm) to tests dependencies.
Without that, FreeBSD 11.x, which uses the GNU ld, fails to link tests.
Interestingly, newer FreeBSD versions that use LLVM ld tolerate this
behaviour and builds successfully as is.
Signed-off-by: Roman Bogorodskiy <bogorodskiy(a)gmail.com>
---
tests/meson.build | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tests/meson.build b/tests/meson.build
index ad13e2de60..ea2458efbc 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -10,11 +10,13 @@ tests_dep = declare_dependency(
dlopen_dep,
glib_dep,
gnutls_dep,
+ kvm_dep,
libnl_dep,
libxml_dep,
rpc_dep,
sasl_dep,
selinux_dep,
+ util_dep,
xdr_dep,
yajl_dep,
],
--
2.27.0
4 years, 2 months
[libvirt PATCH] ci: Disable verbose mode for cirrus-run
by Andrea Bolognani
It was temporarily enabled to help the upstream author validate
some changes, but now that 0.3.0 is out we can safely disable it
again.
This reverts commit 9b5622d31f8c3036425721ab9c6b23067aa87034.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
.gitlab-ci.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 4a42eb479f..bd42c95602 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -104,7 +104,7 @@ stages:
-e "s|[@]PYPI_PKGS@|$PYPI_PKGS|g"
<ci/cirrus/build.yml >ci/cirrus/$NAME.yml
- cat ci/cirrus/$NAME.yml
- - cirrus-run -v --show-build-log always ci/cirrus/$NAME.yml
+ - cirrus-run --show-build-log always ci/cirrus/$NAME.yml
only:
variables:
- $CIRRUS_GITHUB_REPO
--
2.26.2
4 years, 2 months
[libvirt PATCH v2 0/3] Add support for vDPA network devices
by Jonathon Jongsma
vDPA network devices allow high-performance networking in a virtual
machine by providing a wire-speed data path. These devices require a
vendor-specific host driver but the data path follows the virtio
specification.
The support for vDPA devices was recently added to qemu. This allows
libvirt to support these devices. It requires that the device is
configured on the host with the appropriate vendor-specific driver.
This will create a chardev on the host at e.g. /dev/vhost-vdpa-0. That
chardev path can then be used to define a new interface with
type='vdpa'.
Changes in v2:
- split patches
- add qemu capability
- disallow migration for vdpa devices
Jonathon Jongsma (3):
conf: Add support for vDPA network devices
qemu: add vhost-vdpa capability
qemu: add vdpa support
docs/formatdomain.rst | 23 ++++++++++++
docs/schemas/domaincommon.rng | 15 ++++++++
src/conf/domain_conf.c | 32 ++++++++++++++++
src/conf/domain_conf.h | 4 ++
src/conf/netdev_bandwidth_conf.c | 1 +
src/libxl/libxl_conf.c | 1 +
src/libxl/xen_common.c | 1 +
src/lxc/lxc_controller.c | 1 +
src/lxc/lxc_driver.c | 3 ++
src/lxc/lxc_process.c | 1 +
src/qemu/qemu_capabilities.c | 4 ++
src/qemu/qemu_capabilities.h | 3 ++
src/qemu/qemu_command.c | 29 ++++++++++++++-
src/qemu/qemu_command.h | 3 +-
src/qemu/qemu_domain.c | 10 ++++-
src/qemu/qemu_hotplug.c | 15 +++++---
src/qemu/qemu_interface.c | 25 +++++++++++++
src/qemu/qemu_interface.h | 2 +
src/qemu/qemu_migration.c | 10 ++++-
src/qemu/qemu_process.c | 1 +
src/qemu/qemu_validate.c | 1 +
src/vmx/vmx.c | 1 +
.../caps_5.1.0.x86_64.xml | 1 +
.../net-vdpa.x86_64-latest.args | 37 +++++++++++++++++++
tests/qemuxml2argvdata/net-vdpa.xml | 28 ++++++++++++++
tests/qemuxml2argvmock.c | 11 +++++-
tests/qemuxml2argvtest.c | 1 +
tests/qemuxml2xmloutdata/net-vdpa.xml | 33 +++++++++++++++++
tests/qemuxml2xmltest.c | 1 +
tools/virsh-domain.c | 1 +
30 files changed, 288 insertions(+), 11 deletions(-)
create mode 100644 tests/qemuxml2argvdata/net-vdpa.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/net-vdpa.xml
create mode 100644 tests/qemuxml2xmloutdata/net-vdpa.xml
--
2.26.2
4 years, 2 months
[PATCH] qemu_namespace: Be tolerant to non-existent files when populating /dev
by Michal Privoznik
In 6.7.0 release I've changed how domain namespace is built and
populated. Previously it used to be done from a pre-exec hook
(ran in the forked off child, just before dropping all privileges
and exec()-ing QEMU), which not only meant we had to have two
different code paths for creating a node in domain's namespace
(one for this pre-exec hook, the other for hotplug ran from the
daemon), it also proved problematic because it was leaking FDs
into QEMU process. To mitigate this problem, we've not only
ditched libdevmapper from the NS population process, I've also
dropped the pre-exec code and let the NS be populated from the
daemon (using the hotplug code). But, I was not careful when
doing so, because the pre-exec code was tolerant to files that
doesn't exist, while this new code isn't. For instance, the very
first thing that is done when the new NS is created is it's
populated with @defaultDeviceACL which contain files like
/dev/null, /dev/zero, /dev/random and /dev/kvm (and others).
While the rest will probably exist every time, /dev/kvm might not
and thus the new code I wrote has to be tolerant to that.
Of course, users can override the @defaultDeviceACL (by setting
cgroup_device_acl in qemu.conf) and remove /dev/kvm (which is
acceptable workaround), but we definitely want libvirt to work
out of the box even on hosts without KVM.
Fixes: 9048dc4e627ddf33996084167bece7b5fb83b0bc
Reported-by: Daniel P. Berrangé <berrange(a)redhat.com>
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/qemu/qemu_namespace.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_namespace.c b/src/qemu/qemu_namespace.c
index 454d6a7b4d..87f4fd8d58 100644
--- a/src/qemu/qemu_namespace.c
+++ b/src/qemu/qemu_namespace.c
@@ -1094,6 +1094,9 @@ qemuNamespaceMknodItemInit(qemuNamespaceMknodItemPtr item,
item->file = file;
if (g_lstat(file, &item->sb) < 0) {
+ if (errno == ENOENT)
+ return -2;
+
virReportSystemError(errno,
_("Unable to access %s"), file);
return -1;
@@ -1168,9 +1171,16 @@ qemuNamespacePrepareOneItem(qemuNamespaceMknodDataPtr data,
while (1) {
qemuNamespaceMknodItem item = { 0 };
+ int rc;
- if (qemuNamespaceMknodItemInit(&item, cfg, vm, next) < 0)
+ rc = qemuNamespaceMknodItemInit(&item, cfg, vm, next);
+ if (rc == -2) {
+ /* @file doesn't exist. We can break here. */
+ break;
+ } else if (rc < 0) {
+ /* Some other (critical) error. */
return -1;
+ }
if (STRPREFIX(next, QEMU_DEVPREFIX)) {
for (i = 0; i < ndevMountsPath; i++) {
--
2.26.2
4 years, 2 months
[PATCH] util: add device name in errors from ethtool ioctls
by Daniel P. Berrangé
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/util/virnetdev.c | 40 ++++++++++++++++++++++------------------
1 file changed, 22 insertions(+), 18 deletions(-)
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index 3040f129d1..e1a4cc2bef 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -2849,7 +2849,7 @@ virNetDevRDMAFeature(const char *ifname,
* Returns 0 on success, -1 on failure.
*/
static int
-virNetDevSendEthtoolIoctl(int fd, struct ifreq *ifr)
+virNetDevSendEthtoolIoctl(const char *ifname, int fd, struct ifreq *ifr)
{
int ret = -1;
@@ -2857,13 +2857,13 @@ virNetDevSendEthtoolIoctl(int fd, struct ifreq *ifr)
if (ret != 0) {
switch (errno) {
case EINVAL: /* kernel doesn't support SIOCETHTOOL */
- VIR_DEBUG("ethtool ioctl: invalid request");
+ VIR_DEBUG("ethtool ioctl: invalid request on %s", ifname);
break;
case EOPNOTSUPP: /* kernel doesn't support specific feature */
- VIR_DEBUG("ethtool ioctl: request not supported");
+ VIR_DEBUG("ethtool ioctl: request not supported on %s", ifname);
break;
default:
- virReportSystemError(errno, "%s", _("ethtool ioctl error"));
+ virReportSystemError(errno, _("ethtool ioctl error on %s"), ifname);
break;
}
}
@@ -2888,10 +2888,10 @@ struct virNetDevEthtoolFeatureCmd {
* Returns true if the feature is available, false otherwise.
*/
static bool
-virNetDevFeatureAvailable(int fd, struct ifreq *ifr, struct ethtool_value *cmd)
+virNetDevFeatureAvailable(const char *ifname, int fd, struct ifreq *ifr, struct ethtool_value *cmd)
{
ifr->ifr_data = (void*)cmd;
- if (virNetDevSendEthtoolIoctl(fd, ifr) == 0 &&
+ if (virNetDevSendEthtoolIoctl(ifname, fd, ifr) == 0 &&
cmd->data > 0)
return true;
return false;
@@ -2899,7 +2899,8 @@ virNetDevFeatureAvailable(int fd, struct ifreq *ifr, struct ethtool_value *cmd)
static void
-virNetDevGetEthtoolFeatures(virBitmapPtr bitmap,
+virNetDevGetEthtoolFeatures(const char *ifname,
+ virBitmapPtr bitmap,
int fd,
struct ifreq *ifr)
{
@@ -2941,13 +2942,13 @@ virNetDevGetEthtoolFeatures(virBitmapPtr bitmap,
for (i = 0; i < G_N_ELEMENTS(ethtool_cmds); i++) {
cmd.cmd = ethtool_cmds[i].cmd;
- if (virNetDevFeatureAvailable(fd, ifr, &cmd))
+ if (virNetDevFeatureAvailable(ifname, fd, ifr, &cmd))
ignore_value(virBitmapSetBit(bitmap, ethtool_cmds[i].feat));
}
# if WITH_DECL_ETHTOOL_GFLAGS
cmd.cmd = ETHTOOL_GFLAGS;
- if (virNetDevFeatureAvailable(fd, ifr, &cmd)) {
+ if (virNetDevFeatureAvailable(ifname, fd, ifr, &cmd)) {
for (i = 0; i < G_N_ELEMENTS(flags); i++) {
if (cmd.data & flags[i].cmd)
ignore_value(virBitmapSetBit(bitmap, flags[i].feat));
@@ -3133,19 +3134,21 @@ virNetDevSwitchdevFeature(const char *ifname G_GNUC_UNUSED,
* Returns true if the feature is available, false otherwise.
*/
static bool
-virNetDevGFeatureAvailable(int fd,
+virNetDevGFeatureAvailable(const char *ifname,
+ int fd,
struct ifreq *ifr,
struct ethtool_gfeatures *cmd)
{
ifr->ifr_data = (void*)cmd;
- if (virNetDevSendEthtoolIoctl(fd, ifr) == 0)
+ if (virNetDevSendEthtoolIoctl(ifname, fd, ifr) == 0)
return !!FEATURE_BIT_IS_SET(cmd->features, TX_UDP_TNL, active);
return false;
}
static int
-virNetDevGetEthtoolGFeatures(virBitmapPtr bitmap,
+virNetDevGetEthtoolGFeatures(const char *ifname,
+ virBitmapPtr bitmap,
int fd,
struct ifreq *ifr)
{
@@ -3157,13 +3160,14 @@ virNetDevGetEthtoolGFeatures(virBitmapPtr bitmap,
g_cmd->cmd = ETHTOOL_GFEATURES;
g_cmd->size = GFEATURES_SIZE;
- if (virNetDevGFeatureAvailable(fd, ifr, g_cmd))
+ if (virNetDevGFeatureAvailable(ifname, fd, ifr, g_cmd))
ignore_value(virBitmapSetBit(bitmap, VIR_NET_DEV_FEAT_TXUDPTNL));
return 0;
}
# else
static int
-virNetDevGetEthtoolGFeatures(virBitmapPtr bitmap G_GNUC_UNUSED,
+virNetDevGetEthtoolGFeatures(const char *ifname G_GNUC_UNUSED,
+ virBitmapPtr bitmap G_GNUC_UNUSED,
int fd G_GNUC_UNUSED,
struct ifreq *ifr G_GNUC_UNUSED)
{
@@ -3228,7 +3232,7 @@ int virNetDevSetCoalesce(const char *ifname,
ifr.ifr_data = (void *) &coal;
- if (virNetDevSendEthtoolIoctl(fd, &ifr) < 0) {
+ if (virNetDevSendEthtoolIoctl(ifname, fd, &ifr) < 0) {
virReportSystemError(errno,
_("Cannot set coalesce info on '%s'"),
ifname);
@@ -3241,7 +3245,7 @@ int virNetDevSetCoalesce(const char *ifname,
};
/* Don't fail if the update itself fails */
- if (virNetDevSendEthtoolIoctl(fd, &ifr) == 0) {
+ if (virNetDevSendEthtoolIoctl(ifname, fd, &ifr) == 0) {
coalesce->rx_max_coalesced_frames = coal.rx_max_coalesced_frames;
coalesce->rx_coalesce_usecs_irq = coal.rx_coalesce_usecs_irq;
coalesce->rx_max_coalesced_frames_irq = coal.rx_max_coalesced_frames_irq;
@@ -3307,9 +3311,9 @@ virNetDevGetFeatures(const char *ifname,
if ((fd = virNetDevSetupControl(ifname, &ifr)) < 0)
return -1;
- virNetDevGetEthtoolFeatures(*out, fd, &ifr);
+ virNetDevGetEthtoolFeatures(ifname, *out, fd, &ifr);
- if (virNetDevGetEthtoolGFeatures(*out, fd, &ifr) < 0)
+ if (virNetDevGetEthtoolGFeatures(ifname, *out, fd, &ifr) < 0)
return -1;
if (virNetDevRDMAFeature(ifname, out) < 0)
--
2.25.4
4 years, 2 months