[libvirt PATCH v2] rpc: don't try to spawn non-existant daemon
by Daniel P. Berrangé
If libvirt is built in client only mode, the libvirtd/virtqemud/etc
daemons won't exist. If the client is told to connect to a local
hypervisor, it'll see the socket doesn't exist, try to spawn the
daemon and then re-try connecting to the socket for a few seconds.
Ultimately this will fail because the daemon doesn't exist and the
user gets an error message
error: Failed to connect socket to '/run/user/1000/libvirt/virtqemud-sock': No such file or directory
technically this is accurate, but it doesn't help identify the root
cause. With this change it will now report
error: binary 'virtqemud' does not exist in $PATH: No such file or directory
and will skip all the socket connect retries
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
Last time it was suggested that virCommandGetBinaryPath could be
extended to always check whether the binary exists. I started
doing that and realized it was a bad idea as this method runs in
a context which might not have permission to access to the binary
we are about to run, as we've not changed user/group ID yet. So
I'm re-posting this targetted fix, with format string fixup.
src/rpc/virnetsocket.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
index b58f7a6b8f..0215c99c73 100644
--- a/src/rpc/virnetsocket.c
+++ b/src/rpc/virnetsocket.c
@@ -123,9 +123,19 @@ VIR_ONCE_GLOBAL_INIT(virNetSocket);
#ifndef WIN32
static int virNetSocketForkDaemon(const char *binary)
{
- g_autoptr(virCommand) cmd = virCommandNewArgList(binary,
- "--timeout=120",
- NULL);
+ g_autofree char *binarypath = virFindFileInPath(binary);
+ g_autoptr(virCommand) cmd = NULL;
+
+ if (!binarypath) {
+ virReportSystemError(ENOENT,
+ _("binary '%1$s' does not exist in $PATH"),
+ binary);
+ return -1;
+ }
+
+ cmd = virCommandNewArgList(binarypath,
+ "--timeout=120",
+ NULL);
virCommandAddEnvPassCommon(cmd);
virCommandAddEnvPass(cmd, "XDG_CACHE_HOME");
--
2.41.0
11 months, 3 weeks
[PATCH 0/2] Report better error message with no socket to connect to
by Martin Kletzander
When opening a libvirt connection with no URI set and no daemon running the
error message might be confusing at times, so these patches are trying to
mitigate such confusion.
Martin Kletzander (2):
Report first tried socket from remoteProbeSystemDriverFromSocket
Report better error message in remoteGetUNIXSocket
src/remote/remote_daemon_dispatch.c | 2 +-
src/remote/remote_sockets.c | 22 ++++++++++++++++++----
src/remote/remote_sockets.h | 2 +-
3 files changed, 20 insertions(+), 6 deletions(-)
--
2.43.0
11 months, 4 weeks
[libvirt PATCH v2] scripts/rpcgen: fix 64 unsigned int test on macOS
by Daniel P. Berrangé
macOS XDR library is an oddball using xdr_u_int64_t instead of
xdr_uint64_t which everyone else has.
The code generator already does the right thing, but the test
program previously generated with the Linux rpcgen program
does not compile on macOS due to this.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
Changed in v2:
- Put compat logic in test_demo.c instead of demo.c,
since the latter is liable to be re-generated
scripts/rpcgen/tests/test_demo.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/scripts/rpcgen/tests/test_demo.c b/scripts/rpcgen/tests/test_demo.c
index d6be9e236d..94f1002ac8 100644
--- a/scripts/rpcgen/tests/test_demo.c
+++ b/scripts/rpcgen/tests/test_demo.c
@@ -3,6 +3,10 @@
#include <rpc/xdr.h>
#include <stdbool.h>
+#ifdef __APPLE__
+# define xdr_uint64_t xdr_u_int64_t
+#endif
+
#include "demo.h"
#include "demo.c"
--
2.41.0
11 months, 4 weeks
[libvirt PATCH] scripts/rpcgen: fix 64 unsigned int test on macOS
by Daniel P. Berrangé
macOS XDR library is an oddball using xdr_u_int64_t instead of
xdr_uint64_t which everyone else has.
The code generator already does the right thing, but the test
program previously generated with the Linux rpcgen program
does not compile on macOS due to this.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
scripts/rpcgen/tests/demo.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/scripts/rpcgen/tests/demo.c b/scripts/rpcgen/tests/demo.c
index 182ed448f0..56a50239dc 100644
--- a/scripts/rpcgen/tests/demo.c
+++ b/scripts/rpcgen/tests/demo.c
@@ -1,4 +1,8 @@
+#ifdef __APPLE__
+# define xdr_uint64_t xdr_u_int64_t
+#endif
+
void xdr_TestStruct_clear(TestStruct *objp)
{
xdr_free((xdrproc_t)xdr_TestStruct, (char *)objp);
--
2.41.0
11 months, 4 weeks
[libvirt PATCH] rpcgen: Pass 3 arguments to xdrproc_t calls
by Andrea Bolognani
The test_demo program currently fails to compile on macOS with
too few arguments to function call, expected 3, have 2
ret = !!proc(&xdr, vorig);
~~~~ ^
Way back in 2013, commit 9fa3a8ab6fd8 handled this situation
for the main library code. Apply the same fix here.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
scripts/rpcgen/tests/test_demo.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/rpcgen/tests/test_demo.c b/scripts/rpcgen/tests/test_demo.c
index a48ceccd58..931f25f982 100644
--- a/scripts/rpcgen/tests/test_demo.c
+++ b/scripts/rpcgen/tests/test_demo.c
@@ -22,7 +22,7 @@ static void test_xdr(xdrproc_t proc, void *vorig, void *vnew, const char *testna
/* Step 1: serialize the vorig and compare to the data in test .bin files */
xdrmem_create(&xdr, buf, buflen, XDR_ENCODE);
- ret = !!proc(&xdr, vorig);
+ ret = !!proc(&xdr, vorig, 0);
g_assert_cmpint(ret, ==, !fail);
if (fail)
@@ -49,7 +49,7 @@ static void test_xdr(xdrproc_t proc, void *vorig, void *vnew, const char *testna
/* Step 2: de-serialize the state to create a new object */
xdrmem_create(&xdr, buf, buflen, XDR_DECODE);
- ret = !!proc(&xdr, vnew);
+ ret = !!proc(&xdr, vnew, 0);
g_assert_cmpint(ret, ==, true);
actlen = xdr_getpos(&xdr);
@@ -63,7 +63,7 @@ static void test_xdr(xdrproc_t proc, void *vorig, void *vnew, const char *testna
xdrmem_create(&xdr, buf, buflen, XDR_ENCODE);
- ret = !!proc(&xdr, vnew);
+ ret = !!proc(&xdr, vnew, 0);
g_assert_cmpint(ret, ==, true);
actlen = xdr_getpos(&xdr);
--
2.43.0
11 months, 4 weeks
[libvirt PATCH 0/5] rpcgen: Fix test coverage
by Andrea Bolognani
Right now we don't have pytest installed in any of the CI build
environments, and tests are only executed when pytest is present, so
the test coverage is exactly zero.
This series changes things so that we actually run the test suite as
part of the CI pipeline, which immediately triggers a build failure
on macOS:
In file included from ../scripts/rpcgen/tests/test_demo.c:7:
../scripts/rpcgen/tests/demo.c:402:10: error: call to undeclared function 'xdr_uint64_t'; ISO C99 and later
do not support implicit function declarations [-Wimplicit-function-declaration]
if (!xdr_uint64_t(xdrs, &objp->suh))
^
../scripts/rpcgen/tests/test_demo.c:25:29: error: too few arguments to function call, expected 3, have 2
ret = !!proc(&xdr, vorig);
~~~~ ^
../scripts/rpcgen/tests/test_demo.c:52:28: error: too few arguments to function call, expected 3, have 2
ret = !!proc(&xdr, vnew);
~~~~ ^
../scripts/rpcgen/tests/test_demo.c:66:28: error: too few arguments to function call, expected 3, have 2
ret = !!proc(&xdr, vnew);
~~~~ ^
4 errors generated.
I haven't looked into that failure at all, but it looks like
something that we might want to fix before 9.10.0 is released?
libvirt itself seems to build fine, so perhaps it's just the test
suite that needs fixing. I leave the call to people who are more
familiar with the rpcgen situation.
Andrea Bolognani (5):
rpcgen: Don't skip all tests when pytest is missing
rpcgen: Organize meson tests into suites
rpcgen: Skip tests if tests are disabled
rpcgen: Reformat meson files
ci: Refresh generated files
ci/buildenv/almalinux-8.sh | 1 +
ci/buildenv/alpine-317.sh | 1 +
ci/buildenv/alpine-edge.sh | 1 +
ci/buildenv/centos-stream-8.sh | 1 +
ci/buildenv/centos-stream-9.sh | 1 +
ci/buildenv/debian-11-cross-aarch64.sh | 1 +
ci/buildenv/debian-11-cross-armv6l.sh | 1 +
ci/buildenv/debian-11-cross-armv7l.sh | 1 +
ci/buildenv/debian-11-cross-i686.sh | 1 +
ci/buildenv/debian-11-cross-mips64el.sh | 1 +
ci/buildenv/debian-11-cross-mipsel.sh | 1 +
ci/buildenv/debian-11-cross-ppc64le.sh | 1 +
ci/buildenv/debian-11-cross-s390x.sh | 1 +
ci/buildenv/debian-11.sh | 1 +
ci/buildenv/debian-12-cross-aarch64.sh | 1 +
ci/buildenv/debian-12-cross-armv6l.sh | 1 +
ci/buildenv/debian-12-cross-armv7l.sh | 1 +
ci/buildenv/debian-12-cross-i686.sh | 1 +
ci/buildenv/debian-12-cross-mips64el.sh | 1 +
ci/buildenv/debian-12-cross-mipsel.sh | 1 +
ci/buildenv/debian-12-cross-ppc64le.sh | 1 +
ci/buildenv/debian-12-cross-s390x.sh | 1 +
ci/buildenv/debian-12.sh | 1 +
ci/buildenv/debian-sid-cross-aarch64.sh | 1 +
ci/buildenv/debian-sid-cross-armv6l.sh | 1 +
ci/buildenv/debian-sid-cross-armv7l.sh | 1 +
ci/buildenv/debian-sid-cross-i686.sh | 1 +
ci/buildenv/debian-sid-cross-mips64el.sh | 1 +
ci/buildenv/debian-sid-cross-ppc64le.sh | 1 +
ci/buildenv/debian-sid-cross-s390x.sh | 1 +
ci/buildenv/debian-sid.sh | 1 +
ci/buildenv/fedora-37.sh | 1 +
ci/buildenv/fedora-38-cross-mingw32.sh | 1 +
ci/buildenv/fedora-38-cross-mingw64.sh | 1 +
ci/buildenv/fedora-38.sh | 1 +
ci/buildenv/fedora-rawhide-cross-mingw32.sh | 1 +
ci/buildenv/fedora-rawhide-cross-mingw64.sh | 1 +
ci/buildenv/fedora-rawhide.sh | 1 +
ci/buildenv/opensuse-leap-15.sh | 1 +
ci/buildenv/opensuse-tumbleweed.sh | 1 +
ci/buildenv/ubuntu-2004.sh | 1 +
ci/buildenv/ubuntu-2204.sh | 1 +
ci/cirrus/freebsd-12.vars | 2 +-
ci/cirrus/freebsd-13.vars | 2 +-
ci/cirrus/macos-13.vars | 2 +-
ci/cirrus/macos-14.vars | 2 +-
ci/containers/almalinux-8.Dockerfile | 1 +
ci/containers/alpine-317.Dockerfile | 1 +
ci/containers/alpine-edge.Dockerfile | 1 +
ci/containers/centos-stream-8.Dockerfile | 1 +
ci/containers/centos-stream-9.Dockerfile | 1 +
.../debian-11-cross-aarch64.Dockerfile | 1 +
.../debian-11-cross-armv6l.Dockerfile | 1 +
.../debian-11-cross-armv7l.Dockerfile | 1 +
ci/containers/debian-11-cross-i686.Dockerfile | 1 +
.../debian-11-cross-mips64el.Dockerfile | 1 +
.../debian-11-cross-mipsel.Dockerfile | 1 +
.../debian-11-cross-ppc64le.Dockerfile | 1 +
.../debian-11-cross-s390x.Dockerfile | 1 +
ci/containers/debian-11.Dockerfile | 1 +
.../debian-12-cross-aarch64.Dockerfile | 1 +
.../debian-12-cross-armv6l.Dockerfile | 1 +
.../debian-12-cross-armv7l.Dockerfile | 1 +
ci/containers/debian-12-cross-i686.Dockerfile | 1 +
.../debian-12-cross-mips64el.Dockerfile | 1 +
.../debian-12-cross-mipsel.Dockerfile | 1 +
.../debian-12-cross-ppc64le.Dockerfile | 1 +
.../debian-12-cross-s390x.Dockerfile | 1 +
ci/containers/debian-12.Dockerfile | 1 +
.../debian-sid-cross-aarch64.Dockerfile | 1 +
.../debian-sid-cross-armv6l.Dockerfile | 1 +
.../debian-sid-cross-armv7l.Dockerfile | 1 +
.../debian-sid-cross-i686.Dockerfile | 1 +
.../debian-sid-cross-mips64el.Dockerfile | 1 +
.../debian-sid-cross-ppc64le.Dockerfile | 1 +
.../debian-sid-cross-s390x.Dockerfile | 1 +
ci/containers/debian-sid.Dockerfile | 1 +
ci/containers/fedora-37.Dockerfile | 1 +
.../fedora-38-cross-mingw32.Dockerfile | 1 +
.../fedora-38-cross-mingw64.Dockerfile | 1 +
ci/containers/fedora-38.Dockerfile | 1 +
.../fedora-rawhide-cross-mingw32.Dockerfile | 1 +
.../fedora-rawhide-cross-mingw64.Dockerfile | 1 +
ci/containers/fedora-rawhide.Dockerfile | 1 +
ci/containers/opensuse-leap-15.Dockerfile | 1 +
ci/containers/opensuse-tumbleweed.Dockerfile | 1 +
ci/containers/ubuntu-2004.Dockerfile | 1 +
ci/containers/ubuntu-2204.Dockerfile | 1 +
scripts/rpcgen/meson.build | 17 ++++++-----
scripts/rpcgen/rpcgen/meson.build | 10 +++----
scripts/rpcgen/tests/meson.build | 29 ++++++++++---------
91 files changed, 118 insertions(+), 30 deletions(-)
--
2.43.0
11 months, 4 weeks
[RFC v2: vf-token 0/7] Introduce vf-token when using userspace PF
by Vivek Kashyap
vf token is set by a vfio-pci based PF driver and it must be known to the
vfio-pci based VF driver. This vf-token is set by the PF driver before VF
drivers can access the device. vfio-pci driver and qemu support vf-token. This
RFC patch series adds support to provide the vf-token (uuid format) in the
domain XML and to generate the qemu commandline including the vf-token.
To support vf-token the new element will be used as follows:
<hostdev mode='subsystem' type='pci' managed='yes'>
<driver name='vfio'/>
<source>
<address domain='0x0000' bus='0x0' slot='0x00' function='0x1'>
<vf-token uuid='00112233-4455-6677-8899-aabbccddeeff'/>
</address>
</source>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
</hostdev>
The generated commandline will include the following:
-device {"driver":"vfio-pci","host":"0000:00:0.1",
"vf-token":"00112233-4455-6677-8899-aabbccddeeff",
"id":"hostdev0","bus":"pci.0","addr":"0x1"}
Changes since initial RFC:
1. Added documentation
2. Added test cases and ran test suite
- virtsocketest fails when run with 'ninja test'
3. fixed spaces and uuid string format
4. Used S:vftoken in virJSONValueObjectAdd instead of introducing a conditional
Vivek Kashyap (7):
virpci: Define vf-token
qemu: vf-token capability
conf: vf-token flag
conf: vf-token parsing and formatting
conf: test cases
qemu: validate & generate command line
doc: doc and news
NEWS.rst | 8 +++++
docs/formatdomain.rst | 4 +++
src/conf/device_conf.c | 32 +++++++++++++++--
src/conf/device_conf.h | 3 ++
src/conf/domain_addr.h | 1 +
src/conf/domain_conf.c | 8 +++++
src/conf/schemas/basictypes.rng | 7 ++++
src/libvirt_private.syms | 1 +
src/qemu/qemu_capabilities.c | 3 ++
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 13 +++++++
src/qemu/qemu_domain_address.c | 3 ++
src/qemu/qemu_validate.c | 20 +++++++++++
src/util/virpci.c | 7 ++++
src/util/virpci.h | 12 +++++++
.../qemucapabilitiesdata/caps_8.1.0_s390x.xml | 1 +
.../caps_8.1.0_x86_64.xml | 1 +
.../caps_8.2.0_x86_64.xml | 1 +
.../hostdev-vfio-vf-token.x86_64-latest.args | 34 +++++++++++++++++++
.../hostdev-vfio-vf-token.xml | 22 ++++++++++++
tests/qemuxml2argvtest.c | 1 +
21 files changed, 181 insertions(+), 2 deletions(-)
create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-vf-token.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-vf-token.xml
--
2.25.1
11 months, 4 weeks
[PATCH 0/4] Support for dirty-limit live migration
by Hyman Huang
The dirty-limit functionality for live migration was
introduced since qemu>=8.1.
In the live migration scenario, it implements the force
convergence using the dirty-limit approach, which results
in better reliable read performance.
A straightforward dirty-limit capability for live migration
is added by this patchset. Users might not care about other
dirty-limit arguments like "x-vcpu-dirty-limit-period"
or "vcpu-dirty-limit," thus do not expose them to Libvirt
and Keep the default configurations and values in place.
For more details about dirty-limit, please see the following
reference:
https://lore.kernel.org/qemu-
devel/169024923116.19090.10825599068950039132-0(a)git.sr.ht/
Hyman Huang (4):
Add VIR_MIGRATE_DIRTY_LIMIT flag
qemu_migration: Implement VIR_MIGRATE_DIRTY_LIMIT flag
virsh: Add support for VIR_MIGRATE_DIRTY_LIMIT flag
NEWS: document support for dirty-limit live migration
NEWS.rst | 8 ++++++++
docs/manpages/virsh.rst | 10 +++++++++-
include/libvirt/libvirt-domain.h | 5 +++++
src/libvirt-domain.c | 8 ++++++++
src/qemu/qemu_migration.c | 8 ++++++++
src/qemu/qemu_migration.h | 1 +
src/qemu/qemu_migration_params.c | 6 ++++++
src/qemu/qemu_migration_params.h | 1 +
tools/virsh-domain.c | 10 ++++++++++
9 files changed, 56 insertions(+), 1 deletion(-)
--
2.39.1
11 months, 4 weeks
Entering freeze for libvirt-9.10.0
by Jiri Denemark
I have just tagged v9.10.0-rc1 in the repository and pushed signed
tarballs and source RPMs to https://download.libvirt.org/
Please give the release candidate some testing and in case you find a
serious issue which should have a fix in the upcoming release, feel
free to reply to this thread to make sure the issue is more visible.
If you have not done so yet, please update NEWS.rst to document any
significant change you made since the last release.
Thanks,
Jirka
12 months