[libvirt PATCH] ci: jobs.sh: Add back '--no-suite syntax-check --print-errorlogs'
by Erik Skultety
Commit f688a53a converted .gitlab-ci.yml to the usage of ci/jobs.sh
functions, but in doing that our test options
'--no-suite syntax-check --print-errorlogs'
got lost in the process and since commit 8e660c52 didn't introduce them
in the first place, it caused a behavioral regression. This patch adds
them back.
Fixes: 8e660c5286d7e2d07dd61681074bf1555955552d
Signed-off-by: Erik Skultety <eskultet(a)redhat.com>
---
Technically this is a build breaker fix, but sending for review anyway to see
if there's an agreement on this approach.
ci/jobs.sh | 3 +++
1 file changed, 3 insertions(+)
diff --git a/ci/jobs.sh b/ci/jobs.sh
index abd695e231..eb4a4e29cf 100644
--- a/ci/jobs.sh
+++ b/ci/jobs.sh
@@ -39,7 +39,10 @@ run_dist() {
}
run_test() {
+ TEST_ARGS="${TEST_ARGS:=--no-suite syntax-check --print-errorlogs}"
+
test -f $GIT_ROOT/build/build.ninja || run_meson_setup
+
run_cmd meson test -C build $TEST_ARGS
}
--
2.41.0
1 year
[libvirt PATCH v2 0/5] Add support for vDPA block devices
by Jonathon Jongsma
see https://bugzilla.redhat.com/show_bug.cgi?id=1900770.
Changes in v2:
- Don't use virStorageSource->path for vdpa device path to avoid clashing with
existing path functionality
- Move vdpa device opening to the qemuProcessPrepareHostStorageSource()
function rather than the qemuDomainPrepareStorageSource() function. This
also required some additional support in the tests for setting up the
objects properly for testing.
- rebased to latest master branch
Jonathon Jongsma (5):
conf: add ability to configure a vdpa block disk device
qemu: add virtio-blk-vhost-vdpa capability
qemu: make vdpa connect function more generic
qemu: consider vdpa block devices for memlock limits
qemu: Implement support for vDPA block devices
docs/formatdomain.rst | 19 +++++++++-
src/ch/ch_monitor.c | 1 +
src/conf/domain_conf.c | 8 ++++
src/conf/schemas/domaincommon.rng | 13 +++++++
src/conf/storage_source_conf.c | 7 +++-
src/conf/storage_source_conf.h | 2 +
src/libxl/xen_xl.c | 1 +
src/qemu/qemu_block.c | 20 ++++++++++
src/qemu/qemu_capabilities.c | 2 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 24 +++++++++++-
src/qemu/qemu_command.h | 1 +
src/qemu/qemu_domain.c | 12 +++++-
src/qemu/qemu_interface.c | 23 ------------
src/qemu/qemu_interface.h | 2 -
src/qemu/qemu_migration.c | 2 +
src/qemu/qemu_process.c | 34 +++++++++++++++++
src/qemu/qemu_snapshot.c | 4 ++
src/qemu/qemu_validate.c | 33 +++++++++++++++--
src/storage_file/storage_source.c | 1 +
.../caps_8.1.0_x86_64.xml | 1 +
tests/qemuhotplugmock.c | 4 +-
.../disk-vhostvdpa.x86_64-latest.args | 37 +++++++++++++++++++
tests/qemuxml2argvdata/disk-vhostvdpa.xml | 21 +++++++++++
tests/qemuxml2argvmock.c | 2 +-
tests/qemuxml2argvtest.c | 34 +++++++++++++++++
tests/testutilsqemu.c | 11 ++++++
tests/testutilsqemu.h | 2 +
28 files changed, 285 insertions(+), 37 deletions(-)
create mode 100644 tests/qemuxml2argvdata/disk-vhostvdpa.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/disk-vhostvdpa.xml
--
2.41.0
1 year
[libvirt PATCH v2 00/35] ci: Unify the GitLab CI jobs with local executions && adopt lcitool container executions
by Erik Skultety
since v2 [1]:
- moved the custom meson.build directory check before running setup to
individual callers for better robustness, but actually let meson deal with an
existing setup directory most of the time
- drops the ci/Makefile
- only set our verbose env variables when running without a TTY
- switched the bright yellow (93m) color to green (32m)
- added KeyboardInterrupt handling in the ci/helper Python code
The changes above require the following lcitool MR to be merged first as
they're built on top of it [2]
[1] https://listman.redhat.com/archives/libvir-list/2023-August/241471.html
[2] https://gitlab.com/libvirt/libvirt-ci/-/merge_requests/431
Erik Skultety (35):
ci: build.sh: Add variables from .gitlab-ci.yml
ci: build.sh: Add GIT_ROOT env helper variable
ci: build.sh: Don't mention that MESON_ARGS are available via CLI
ci: build.sh: Add a wrapper function executing 'shell' commands
ci: build.sh: Add a wrapper function over meson's setup
ci: build.sh: Add a wrapper function over the 'build' job
ci: build.sh: Add a helper function to create the dist tarball
ci: build.sh: Add a wrapper function over the 'test' job
ci: build.sh: Add a wrapper function over the 'codestyle' job
ci: build.sh: Add a wrapper function over the 'potfile' job
ci: build.sh: Add a wrapper function over the 'rpmbuild' job
ci: build.sh: Add a wrapper function over the 'website' job
ci: build.sh: Drop changing working directory to CI_CONT_DIR
ci: build.sh: Drop direct invocation of meson/ninja commands
ci: build.sh: Drop MESON_ARGS definition from global level
ci: Rename build.sh -> jobs.sh
.gitlab-ci.yml: Add 'after_script' stage to prep for artifact
collection
.gitlab-ci.yml: Convert the native build job to the build.sh usage
.gitlab-ci.yml: Convert the cross build job to the build.sh usage
.gitlab-ci.yml: Convert the website build job to the build.sh usage
.gitlab-ci.yml: Convert the codestyle job to the build.sh usage
.gitlab-ci.yml: Convert the potfile job to the build.sh usage
ci: helper: Drop _lcitool_get_targets method
ci: helper: Don't make ':' literal a static part of the image tag
ci: helper: Add --lcitool-path CLI option
ci: helper: Add a required_deps higher order helper/decorator
ci: helper: Add Python code hangling git clones
ci: helper: Add a helper to create a local repo clone Pythonic way
ci: helper: Rework _lcitool_run method logic
ci: helper: Add an action to run the container workload via lcitool
ci: helper: Add a job argparse subparser
ci: helper: Drop original actions
ci: helper: Drop the --meson-args/--ninja-args CLI options
ci: helper: Drop the _make_run method
ci: Drop the now unused Makefile
.gitlab-ci.yml | 47 +++++-----
ci/Makefile | 245 -------------------------------------------------
ci/build.sh | 23 -----
ci/helper | 181 +++++++++++++++++++++---------------
ci/jobs.sh | 79 ++++++++++++++++
5 files changed, 211 insertions(+), 364 deletions(-)
delete mode 100644 ci/Makefile
delete mode 100644 ci/build.sh
create mode 100644 ci/jobs.sh
--
2.41.0
1 year
[PATCH (pushed)] virStorageSourceClear: Clear 'vdpadev' field
by Peter Krempa
Release memory for the recently added field.
Fixes: 1df106cc20a4cc6417cfbaf01860f465ec3dd915
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/conf/storage_source_conf.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/conf/storage_source_conf.c b/src/conf/storage_source_conf.c
index f57cb3241d..f7f62c3966 100644
--- a/src/conf/storage_source_conf.c
+++ b/src/conf/storage_source_conf.c
@@ -1143,6 +1143,7 @@ virStorageSourceClear(virStorageSource *def)
VIR_FREE(def->path);
VIR_FREE(def->fdgroup);
VIR_FREE(def->volume);
+ VIR_FREE(def->vdpadev);
VIR_FREE(def->snapshot);
VIR_FREE(def->configFile);
VIR_FREE(def->query);
--
2.41.0
1 year
[libvirt PATCH v4] ch: Fix cloud-hypervisor version processing
by Praveen K Paladugu
Refactor the version processing logic in ch driver to support versions
from non-release cloud-hypervisor binaries. This version also supports
versions with branch prefixes in them.
Signed-off-by: Praveen K Paladugu <prapal(a)linux.microsoft.com>
---
src/ch/ch_conf.c | 34 ++++++++++++++++++++++++++++++++--
1 file changed, 32 insertions(+), 2 deletions(-)
diff --git a/src/ch/ch_conf.c b/src/ch/ch_conf.c
index a8565d9537..f421af5121 100644
--- a/src/ch/ch_conf.c
+++ b/src/ch/ch_conf.c
@@ -172,6 +172,29 @@ virCHDriverConfigDispose(void *obj)
#define MIN_VERSION ((15 * 1000000) + (0 * 1000) + (0))
+/**
+ * chPreProcessVersionString:
+ *
+ * Returns: a pointer to numerical version without branch/commit info
+ */
+static char *
+chPreProcessVersionString(char *version)
+{
+ char *tmp = strrchr(version, '/');
+
+ if (tmp)
+ version = tmp + 1;
+
+ if (version[0] == 'v')
+ version++;
+
+ tmp = strchr(version, '-');
+ if (tmp)
+ *tmp = '\0';
+
+ return version;
+}
+
int
chExtractVersion(virCHDriver *driver)
{
@@ -193,13 +216,20 @@ chExtractVersion(virCHDriver *driver)
tmp = help;
- /* expected format: cloud-hypervisor v<major>.<minor>.<micro> */
- if ((tmp = STRSKIP(tmp, "cloud-hypervisor v")) == NULL) {
+ /* Below are example version formats and expected outputs:
+ * cloud-hypervisor v32.0.0 (expected: 32.0.0)
+ * cloud-hypervisor v33.0-104-ge0e3779e-dirty (expected: 33.0)
+ * cloud-hypervisor testing/v32.0.131-1-ga5d6db5c-dirty (expected: 32.0.131)
+ */
+ if ((tmp = STRSKIP(tmp, "cloud-hypervisor ")) == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Unexpected output of cloud-hypervisor binary"));
return -1;
}
+ tmp = chPreProcessVersionString(tmp);
+ VIR_DEBUG("Cloud-Hypervisor version detected: %s", tmp);
+
if (virStringParseVersion(&version, tmp, true) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Unable to parse cloud-hypervisor version: %1$s"), tmp);
--
2.41.0
1 year
[PATCH v2] interface: fix udev_device_get_sysattr_value return value check
by Dmitry Frolov
Reviewing the code I found that return value of function
udev_device_get_sysattr_value() is dereferenced without a check.
udev_device_get_sysattr_value() may return NULL by number of reasons.
v2: VIR_DEBUG added, replaced STREQ(NULLSTR()) with STREQ_NULLABLE()
Signed-off-by: Dmitry Frolov <frolov(a)swemel.ru>
---
src/interface/interface_backend_udev.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/src/interface/interface_backend_udev.c b/src/interface/interface_backend_udev.c
index a0485ddd21..df7066727e 100644
--- a/src/interface/interface_backend_udev.c
+++ b/src/interface/interface_backend_udev.c
@@ -23,6 +23,7 @@
#include <dirent.h>
#include <libudev.h>
+#include "virlog.h"
#include "virerror.h"
#include "virfile.h"
#include "datatypes.h"
@@ -40,6 +41,8 @@
#define VIR_FROM_THIS VIR_FROM_INTERFACE
+VIR_LOG_INIT("interface.interface_backend_udev");
+
struct udev_iface_driver {
struct udev *udev;
/* pid file FD, ensures two copies of the driver can't use the same root */
@@ -355,10 +358,13 @@ udevConnectListAllInterfaces(virConnectPtr conn,
g_autoptr(virInterfaceDef) def = NULL;
path = udev_list_entry_get_name(dev_entry);
- dev = udev_device_new_from_syspath(udev, path);
+ if (!(dev = udev_device_new_from_syspath(udev, path))) {
+ VIR_DEBUG("Skipping interface '%s'", NULLSTR(path));
+ continue;
+ }
name = udev_device_get_sysname(dev);
macaddr = udev_device_get_sysattr_value(dev, "address");
- status = STREQ(udev_device_get_sysattr_value(dev, "operstate"), "up");
+ status = STREQ_NULLABLE(udev_device_get_sysattr_value(dev, "operstate"), "up");
def = udevGetMinimalDefForDevice(dev);
if (!virConnectListAllInterfacesCheckACL(conn, def)) {
@@ -964,9 +970,9 @@ udevGetIfaceDef(struct udev *udev, const char *name)
/* MTU */
mtu_str = udev_device_get_sysattr_value(dev, "mtu");
- if (virStrToLong_ui(mtu_str, NULL, 10, &mtu) < 0) {
+ if (!mtu_str || virStrToLong_ui(mtu_str, NULL, 10, &mtu) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Could not parse MTU value '%1$s'"), mtu_str);
+ _("Could not parse MTU value '%1$s'"), NULLSTR(mtu_str));
goto error;
}
ifacedef->mtu = mtu;
@@ -1089,7 +1095,7 @@ udevInterfaceIsActive(virInterfacePtr ifinfo)
goto cleanup;
/* Check if it's active or not */
- status = STREQ(udev_device_get_sysattr_value(dev, "operstate"), "up");
+ status = STREQ_NULLABLE(udev_device_get_sysattr_value(dev, "operstate"), "up");
udev_device_unref(dev);
--
2.34.1
1 year
[libvirt PATCH 0/5] Add support for vDPA block devices
by Jonathon Jongsma
see https://bugzilla.redhat.com/show_bug.cgi?id=1900770.
Jonathon Jongsma (5):
conf: add ability to configure a vdpa block disk device
qemu: add virtio-blk-vhost-vdpa capability
qemu: make vdpa connect function more generic
qemu: consider vdpa block devices for memlock limits
qemu: Implement support for vDPA block devices
docs/formatdomain.rst | 19 ++++++++-
src/ch/ch_monitor.c | 1 +
src/conf/domain_conf.c | 7 ++++
src/conf/schemas/domaincommon.rng | 13 +++++++
src/conf/storage_source_conf.c | 6 ++-
src/conf/storage_source_conf.h | 1 +
src/libxl/xen_xl.c | 1 +
src/qemu/qemu_block.c | 20 ++++++++++
src/qemu/qemu_capabilities.c | 2 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 24 +++++++++++-
src/qemu/qemu_command.h | 1 +
src/qemu/qemu_domain.c | 37 +++++++++++++++++-
src/qemu/qemu_interface.c | 23 -----------
src/qemu/qemu_interface.h | 2 -
src/qemu/qemu_migration.c | 2 +
src/qemu/qemu_snapshot.c | 4 ++
src/qemu/qemu_validate.c | 45 +++++++++++++++++++---
src/storage_file/storage_source.c | 1 +
tests/qemuhotplugmock.c | 4 +-
tests/qemuxml2argvdata/disk-vhostvdpa.args | 35 +++++++++++++++++
tests/qemuxml2argvdata/disk-vhostvdpa.xml | 21 ++++++++++
tests/qemuxml2argvmock.c | 2 +-
tests/qemuxml2argvtest.c | 2 +
24 files changed, 235 insertions(+), 39 deletions(-)
create mode 100644 tests/qemuxml2argvdata/disk-vhostvdpa.args
create mode 100644 tests/qemuxml2argvdata/disk-vhostvdpa.xml
--
2.40.1
1 year, 1 month
[PATCH] interface: fix udev_device_get_sysattr_value return value check
by Dmitry Frolov
Reviewing the code I found that return value of function
udev_device_get_sysattr_value() is dereferenced without a check.
udev_device_get_sysattr_value() may return NULL by number of reasons.
Signed-off-by: Dmitry Frolov <frolov(a)swemel.ru>
---
src/interface/interface_backend_udev.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/interface/interface_backend_udev.c b/src/interface/interface_backend_udev.c
index a0485ddd21..c820b3ccdf 100644
--- a/src/interface/interface_backend_udev.c
+++ b/src/interface/interface_backend_udev.c
@@ -355,10 +355,11 @@ udevConnectListAllInterfaces(virConnectPtr conn,
g_autoptr(virInterfaceDef) def = NULL;
path = udev_list_entry_get_name(dev_entry);
- dev = udev_device_new_from_syspath(udev, path);
+ if (!(dev = udev_device_new_from_syspath(udev, path)))
+ continue;
name = udev_device_get_sysname(dev);
macaddr = udev_device_get_sysattr_value(dev, "address");
- status = STREQ(udev_device_get_sysattr_value(dev, "operstate"), "up");
+ status = STREQ(NULLSTR(udev_device_get_sysattr_value(dev, "operstate")), "up");
def = udevGetMinimalDefForDevice(dev);
if (!virConnectListAllInterfacesCheckACL(conn, def)) {
@@ -964,9 +965,9 @@ udevGetIfaceDef(struct udev *udev, const char *name)
/* MTU */
mtu_str = udev_device_get_sysattr_value(dev, "mtu");
- if (virStrToLong_ui(mtu_str, NULL, 10, &mtu) < 0) {
+ if (!mtu_str || virStrToLong_ui(mtu_str, NULL, 10, &mtu) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Could not parse MTU value '%1$s'"), mtu_str);
+ _("Could not parse MTU value '%1$s'"), NULLSTR(mtu_str));
goto error;
}
ifacedef->mtu = mtu;
@@ -1089,7 +1090,7 @@ udevInterfaceIsActive(virInterfacePtr ifinfo)
goto cleanup;
/* Check if it's active or not */
- status = STREQ(udev_device_get_sysattr_value(dev, "operstate"), "up");
+ status = STREQ(NULLSTR(udev_device_get_sysattr_value(dev, "operstate")), "up");
udev_device_unref(dev);
--
2.34.1
1 year, 1 month
[PATCH] virnetdevopenvswitch: Propagate OVS error messages
by Michal Privoznik
When configuring OVS interfaces/bridges we spawn 'ovs-vsctl' with
appropriate arguments and if it exited with a non-zero status we
report a generic error message, like "Unable to add port vnet0 to
OVS bridge ovsbr0". This is all cool, but the real reason why
operation failed is hidden in (debug) logs because that's where
virCommandRun() reports it unless caller requested otherwise.
This is a bit clumsy because then we have to ask users to turn on
debug logs and reproduce the problem again, e.g. [1].
Therefore, in cases where an error is reported to the user - just
read ovs-vsctl's stderr and include it in the error message. For
other cases (like VIR_DEBUG/VIR_WARN) - well they are meant to
end up in (debug) logs anyway.
1: https://mail.openvswitch.org/pipermail/ovs-discuss/2023-September/052640....
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/util/virnetdevopenvswitch.c | 93 ++++++++++++++++++++-------------
1 file changed, 58 insertions(+), 35 deletions(-)
diff --git a/src/util/virnetdevopenvswitch.c b/src/util/virnetdevopenvswitch.c
index 8dad6ed2bd..d836d05845 100644
--- a/src/util/virnetdevopenvswitch.c
+++ b/src/util/virnetdevopenvswitch.c
@@ -54,10 +54,14 @@ virNetDevOpenvswitchSetTimeout(unsigned int timeout)
}
static virCommand *
-virNetDevOpenvswitchCreateCmd(void)
+virNetDevOpenvswitchCreateCmd(char **errbuf)
{
virCommand *cmd = virCommandNew(OVS_VSCTL);
+
virCommandAddArgFormat(cmd, "--timeout=%u", virNetDevOpenvswitchTimeout);
+ if (errbuf)
+ virCommandSetErrorBuffer(cmd, errbuf);
+
return cmd;
}
@@ -137,6 +141,7 @@ int virNetDevOpenvswitchAddPort(const char *brname, const char *ifname,
char ifuuidstr[VIR_UUID_STRING_BUFLEN];
char vmuuidstr[VIR_UUID_STRING_BUFLEN];
g_autoptr(virCommand) cmd = NULL;
+ g_autofree char *errbuf = NULL;
g_autofree char *attachedmac_ex_id = NULL;
g_autofree char *ifaceid_ex_id = NULL;
g_autofree char *profile_ex_id = NULL;
@@ -157,7 +162,7 @@ int virNetDevOpenvswitchAddPort(const char *brname, const char *ifname,
ovsport->profileID);
}
- cmd = virNetDevOpenvswitchCreateCmd();
+ cmd = virNetDevOpenvswitchCreateCmd(&errbuf);
virCommandAddArgList(cmd, "--", "--may-exist",
"add-port", brname, ifname, NULL);
@@ -185,8 +190,8 @@ int virNetDevOpenvswitchAddPort(const char *brname, const char *ifname,
if (virCommandRun(cmd, NULL) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Unable to add port %1$s to OVS bridge %2$s"),
- ifname, brname);
+ _("Unable to add port %1$s to OVS bridge %2$s: %3$s"),
+ ifname, brname, NULLSTR(errbuf));
return -1;
}
@@ -203,13 +208,15 @@ int virNetDevOpenvswitchAddPort(const char *brname, const char *ifname,
*/
int virNetDevOpenvswitchRemovePort(const char *brname G_GNUC_UNUSED, const char *ifname)
{
- g_autoptr(virCommand) cmd = virNetDevOpenvswitchCreateCmd();
+ g_autofree char *errbuf = NULL;
+ g_autoptr(virCommand) cmd = virNetDevOpenvswitchCreateCmd(&errbuf);
virCommandAddArgList(cmd, "--", "--if-exists", "del-port", ifname, NULL);
if (virCommandRun(cmd, NULL) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Unable to delete port %1$s from OVS"), ifname);
+ _("Unable to delete port %1$s from OVS: %2$s"),
+ ifname, NULLSTR(errbuf));
return -1;
}
@@ -228,7 +235,8 @@ int virNetDevOpenvswitchRemovePort(const char *brname G_GNUC_UNUSED, const char
int virNetDevOpenvswitchGetMigrateData(char **migrate, const char *ifname)
{
size_t len;
- g_autoptr(virCommand) cmd = virNetDevOpenvswitchCreateCmd();
+ g_autofree char *errbuf = NULL;
+ g_autoptr(virCommand) cmd = virNetDevOpenvswitchCreateCmd(&errbuf);
virCommandAddArgList(cmd, "--if-exists", "get", "Interface",
ifname, "external_ids:PortData", NULL);
@@ -238,8 +246,8 @@ int virNetDevOpenvswitchGetMigrateData(char **migrate, const char *ifname)
/* Run the command */
if (virCommandRun(cmd, NULL) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Unable to run command to get OVS port data for interface %1$s"),
- ifname);
+ _("Unable to run command to get OVS port data for interface %1$s: %2$s"),
+ ifname, NULLSTR(errbuf));
return -1;
}
@@ -263,21 +271,22 @@ int virNetDevOpenvswitchGetMigrateData(char **migrate, const char *ifname)
int virNetDevOpenvswitchSetMigrateData(char *migrate, const char *ifname)
{
g_autoptr(virCommand) cmd = NULL;
+ g_autofree char *errbuf = NULL;
if (!migrate) {
VIR_DEBUG("No OVS port data for interface %s", ifname);
return 0;
}
- cmd = virNetDevOpenvswitchCreateCmd();
+ cmd = virNetDevOpenvswitchCreateCmd(&errbuf);
virCommandAddArgList(cmd, "set", "Interface", ifname, NULL);
virCommandAddArgFormat(cmd, "external_ids:PortData=%s", migrate);
/* Run the command */
if (virCommandRun(cmd, NULL) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Unable to run command to set OVS port data for interface %1$s"),
- ifname);
+ _("Unable to run command to set OVS port data for interface %1$s: %2$s"),
+ ifname, NULLSTR(errbuf));
return -1;
}
@@ -371,7 +380,8 @@ int
virNetDevOpenvswitchInterfaceStats(const char *ifname,
virDomainInterfaceStatsPtr stats)
{
- g_autoptr(virCommand) cmd = virNetDevOpenvswitchCreateCmd();
+ g_autofree char *errbuf = NULL;
+ g_autoptr(virCommand) cmd = virNetDevOpenvswitchCreateCmd(&errbuf);
g_autofree char *output = NULL;
virCommandAddArgList(cmd, "--if-exists", "--format=list", "--data=json",
@@ -390,8 +400,9 @@ virNetDevOpenvswitchInterfaceStats(const char *ifname,
if (virCommandRun(cmd, NULL) < 0 ||
STREQ_NULLABLE(output, "")) {
/* no ovs-vsctl or interface 'ifname' doesn't exists in ovs */
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Interface not found"));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Interface not found: %1$s"),
+ NULLSTR(errbuf));
return -1;
}
@@ -433,7 +444,8 @@ virNetDevOpenvswitchInterfaceStats(const char *ifname,
int
virNetDevOpenvswitchInterfaceGetMaster(const char *ifname, char **master)
{
- g_autoptr(virCommand) cmd = virNetDevOpenvswitchCreateCmd();
+ g_autofree char *errbuf = NULL;
+ g_autoptr(virCommand) cmd = virNetDevOpenvswitchCreateCmd(&errbuf);
int exitstatus;
*master = NULL;
@@ -443,8 +455,8 @@ virNetDevOpenvswitchInterfaceGetMaster(const char *ifname, char **master)
if (virCommandRun(cmd, &exitstatus) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Unable to run command to get OVS master for interface %1$s"),
- ifname);
+ _("Unable to run command to get OVS master for interface %1$s: %2$s"),
+ ifname, NULLSTR(errbuf));
return -1;
}
@@ -546,7 +558,7 @@ virNetDevOpenvswitchGetVhostuserIfname(const char *path,
return 0;
}
- cmd = virNetDevOpenvswitchCreateCmd();
+ cmd = virNetDevOpenvswitchCreateCmd(NULL);
if (server) {
virCommandAddArgList(cmd, "--no-headings", "--columns=name", "find",
@@ -600,7 +612,8 @@ virNetDevOpenvswitchGetVhostuserIfname(const char *path,
int virNetDevOpenvswitchUpdateVlan(const char *ifname,
const virNetDevVlan *virtVlan)
{
- g_autoptr(virCommand) cmd = virNetDevOpenvswitchCreateCmd();
+ g_autofree char *errbuf = NULL;
+ g_autoptr(virCommand) cmd = virNetDevOpenvswitchCreateCmd(&errbuf);
virCommandAddArgList(cmd,
"--", "--if-exists", "clear", "Port", ifname, "tag",
@@ -614,7 +627,8 @@ int virNetDevOpenvswitchUpdateVlan(const char *ifname,
if (virCommandRun(cmd, NULL) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Unable to set vlan configuration on port %1$s"), ifname);
+ _("Unable to set vlan configuration on port %1$s: %2$s"),
+ ifname, NULLSTR(errbuf));
return -1;
}
@@ -629,7 +643,7 @@ virNetDevOpenvswitchFindUUID(const char *table,
g_autoptr(virCommand) cmd = NULL;
char *uuid = NULL;
- cmd = virNetDevOpenvswitchCreateCmd();
+ cmd = virNetDevOpenvswitchCreateCmd(NULL);
virCommandAddArgList(cmd, "--no-heading", "--columns=_uuid", "find", table,
vmid_ex_id, ifname_ex_id, NULL);
virCommandSetOutputBuffer(cmd, &uuid);
@@ -673,7 +687,7 @@ virNetDevOpenvswitchInterfaceClearTxQos(const char *ifname,
if (!*line) {
continue;
}
- listcmd = virNetDevOpenvswitchCreateCmd();
+ listcmd = virNetDevOpenvswitchCreateCmd(NULL);
virCommandAddArgList(listcmd, "--no-heading", "--columns=_uuid", "--if-exists",
"list", "port", ifname, "qos", NULL);
virCommandSetOutputBuffer(listcmd, &port_qos);
@@ -681,13 +695,13 @@ virNetDevOpenvswitchInterfaceClearTxQos(const char *ifname,
VIR_WARN("Unable to remove port qos on port %s", ifname);
}
if (port_qos && *port_qos) {
- g_autoptr(virCommand) cmd = virNetDevOpenvswitchCreateCmd();
+ g_autoptr(virCommand) cmd = virNetDevOpenvswitchCreateCmd(NULL);
virCommandAddArgList(cmd, "remove", "port", ifname, "qos", line, NULL);
if (virCommandRun(cmd, NULL) < 0) {
VIR_WARN("Unable to remove port qos on port %s", ifname);
}
}
- destroycmd = virNetDevOpenvswitchCreateCmd();
+ destroycmd = virNetDevOpenvswitchCreateCmd(NULL);
virCommandAddArgList(destroycmd, "destroy", "qos", line, NULL);
if (virCommandRun(destroycmd, NULL) < 0) {
VIR_WARN("Unable to destroy qos on port %s", ifname);
@@ -706,7 +720,7 @@ virNetDevOpenvswitchInterfaceClearTxQos(const char *ifname,
continue;
}
- cmd = virNetDevOpenvswitchCreateCmd();
+ cmd = virNetDevOpenvswitchCreateCmd(NULL);
virCommandAddArgList(cmd, "destroy", "queue", line, NULL);
if (virCommandRun(cmd, NULL) < 0) {
VIR_WARN("Unable to destroy queue on port %s", ifname);
@@ -722,15 +736,17 @@ static int
virNetDevOpenvswitchInterfaceClearRxQos(const char *ifname)
{
g_autoptr(virCommand) cmd = NULL;
+ g_autofree char *errbuf = NULL;
- cmd = virNetDevOpenvswitchCreateCmd();
+ cmd = virNetDevOpenvswitchCreateCmd(&errbuf);
virCommandAddArgList(cmd, "set", "Interface", ifname, NULL);
virCommandAddArgFormat(cmd, "ingress_policing_rate=%llu", 0llu);
virCommandAddArgFormat(cmd, "ingress_policing_burst=%llu", 0llu);
if (virCommandRun(cmd, NULL) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Unable to reset ingress on port %1$s"), ifname);
+ _("Unable to reset ingress on port %1$s: %2$s"),
+ ifname, NULLSTR(errbuf));
return -1;
}
@@ -754,6 +770,7 @@ virNetDevOpenvswitchInterfaceSetTxQos(const char *ifname,
{
char vmuuidstr[VIR_UUID_STRING_BUFLEN];
g_autoptr(virCommand) cmd = NULL;
+ g_autofree char *errbuf = NULL;
g_autofree char *vmid_ex_id = NULL;
g_autofree char *ifname_ex_id = NULL;
g_autofree char *average = NULL;
@@ -777,7 +794,7 @@ virNetDevOpenvswitchInterfaceSetTxQos(const char *ifname,
qos_uuid = virNetDevOpenvswitchFindUUID("qos", vmid_ex_id, ifname_ex_id);
/* create qos and set */
- cmd = virNetDevOpenvswitchCreateCmd();
+ cmd = virNetDevOpenvswitchCreateCmd(&errbuf);
if (queue_uuid && *queue_uuid) {
g_auto(GStrv) lines = g_strsplit(queue_uuid, "\n", 0);
virCommandAddArgList(cmd, "set", "queue", lines[0], NULL);
@@ -806,17 +823,20 @@ virNetDevOpenvswitchInterfaceSetTxQos(const char *ifname,
if (virCommandRun(cmd, NULL) < 0) {
if (queue_uuid && *queue_uuid) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Unable to set queue configuration on port %1$s"), ifname);
+ _("Unable to set queue configuration on port %1$s: %2$s"),
+ ifname, NULLSTR(errbuf));
} else {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Unable to create and set qos configuration on port %1$s"), ifname);
+ _("Unable to create and set qos configuration on port %1$s: %2$s"),
+ ifname, NULLSTR(errbuf));
}
return -1;
}
if (qos_uuid && *qos_uuid) {
g_auto(GStrv) lines = g_strsplit(qos_uuid, "\n", 0);
- g_autoptr(virCommand) qoscmd = virNetDevOpenvswitchCreateCmd();
+ g_autofree char *qoserrbuf = NULL;
+ g_autoptr(virCommand) qoscmd = virNetDevOpenvswitchCreateCmd(&qoserrbuf);
virCommandAddArgList(qoscmd, "set", "qos", lines[0], NULL);
virCommandAddArgFormat(qoscmd, "other_config:min-rate=%s", average);
@@ -829,7 +849,8 @@ virNetDevOpenvswitchInterfaceSetTxQos(const char *ifname,
virCommandAddArgList(qoscmd, vmid_ex_id, ifname_ex_id, NULL);
if (virCommandRun(qoscmd, NULL) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Unable to set qos configuration on port %1$s"), ifname);
+ _("Unable to set qos configuration on port %1$s: %2$s"),
+ ifname, NULLSTR(qoserrbuf));
return -1;
}
}
@@ -842,8 +863,9 @@ virNetDevOpenvswitchInterfaceSetRxQos(const char *ifname,
const virNetDevBandwidthRate *rx)
{
g_autoptr(virCommand) cmd = NULL;
+ g_autofree char *errbuf = NULL;
- cmd = virNetDevOpenvswitchCreateCmd();
+ cmd = virNetDevOpenvswitchCreateCmd(&errbuf);
virCommandAddArgList(cmd, "set", "Interface", ifname, NULL);
virCommandAddArgFormat(cmd, "ingress_policing_rate=%llu",
rx->average * VIR_NETDEV_RX_TO_OVS);
@@ -853,7 +875,8 @@ virNetDevOpenvswitchInterfaceSetRxQos(const char *ifname,
if (virCommandRun(cmd, NULL) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Unable to set vlan configuration on port %1$s"), ifname);
+ _("Unable to set vlan configuration on port %1$s: %2$s"),
+ ifname, NULLSTR(errbuf));
return -1;
}
--
2.41.0
1 year, 1 month