[PATCH 0/2] fix crash on invalid construction of a gvariant
by Peter Krempa
Peter Krempa (2):
virSystemdCreateMachine: Use proper format string for uint64_t when
constructing gvariant
virsystemdtest: Call at least one virSystemdCreateMachine with
'maxthreads' > 0
src/util/virsystemd.c | 5 +++--
tests/virsystemdtest.c | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)
--
2.29.2
3 years, 8 months
Libvirt has been accepted into GSoC 2021
by Michal Privoznik
Dear list,
let me share great news: just like in the past years, libvirt is going
to be part of Google Summer of Code also this year [1]. We can expect
interested students to show up and discuss possible projects to work on.
However, there are some changes made to this year's run [2]:
1) Smaller projects - with everything going on one can hardly expect
students to commit to 350 hours of coding over three months. This is now
reduced to 175 hours over 10 weeks,
2) More elligible students - now even PhD students and licensed coding
school students can apply,
2) Halved stipends - since the amount of work is halved, so are the
stipends,
3) Two evaluations - again, shorted time period requires less evaluations.
Happy hacking,
Michal
1: https://summerofcode.withgoogle.com/organizations/5771368592834560/
2:
https://opensource.googleblog.com/2020/10/google-summer-of-code-2021-is-b...
3 years, 8 months
[PULL 05/17] utils: Deprecate hex-with-suffix sizes
by Eric Blake
Supporting '0x20M' looks odd, particularly since we have a 'B' suffix
that is ambiguous for bytes, as well as a less-frequently-used 'E'
suffix for extremely large exibytes. In practice, people using hex
inputs are specifying values in bytes (and would have written
0x2000000, or possibly relied on default_suffix in the case of
qemu_strtosz_MiB), and the use of scaling suffixes makes the most
sense for inputs in decimal (where the user would write 32M). But
rather than outright dropping support for hex-with-suffix, let's
follow our deprecation policy. Sadly, since qemu_strtosz() does not
have an Err** parameter, and plumbing that in would be a much larger
task, we instead go with just directly emitting the deprecation
warning to stderr.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
Message-Id: <20210211204438.1184395-4-eblake(a)redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
docs/system/deprecated.rst | 8 ++++++++
util/cutils.c | 10 +++++++++-
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst
index cfabe6984677..ecff6bf8c633 100644
--- a/docs/system/deprecated.rst
+++ b/docs/system/deprecated.rst
@@ -166,6 +166,14 @@ Using ``-M kernel-irqchip=off`` with x86 machine types that include a local
APIC is deprecated. The ``split`` setting is supported, as is using
``-M kernel-irqchip=off`` with the ISA PC machine type.
+hexadecimal sizes with scaling multipliers (since 6.0)
+''''''''''''''''''''''''''''''''''''''''''''''''''''''
+
+Input parameters that take a size value should only use a size suffix
+(such as 'k' or 'M') when the base is written in decimal, and not when
+the value is hexadecimal. That is, '0x20M' is deprecated, and should
+be written either as '32M' or as '0x2000000'.
+
QEMU Machine Protocol (QMP) commands
------------------------------------
diff --git a/util/cutils.c b/util/cutils.c
index 189a184859c0..d89a40a8c325 100644
--- a/util/cutils.c
+++ b/util/cutils.c
@@ -250,6 +250,9 @@ static int64_t suffix_mul(char suffix, int64_t unit)
* fractional portion is truncated to byte
* - 0x7fEE - hexadecimal, unit determined by @default_suffix
*
+ * The following cause a deprecation warning, and may be removed in the future
+ * - 0xabc{kKmMgGtTpP} - hex with scaling suffix
+ *
* The following are intentionally not supported
* - octal, such as 08
* - fractional hex, such as 0x1.8
@@ -272,7 +275,7 @@ static int do_strtosz(const char *nptr, const char **end,
int retval;
const char *endptr, *f;
unsigned char c;
- bool mul_required = false;
+ bool mul_required = false, hex = false;
uint64_t val;
int64_t mul;
double fraction = 0.0;
@@ -298,6 +301,7 @@ static int do_strtosz(const char *nptr, const char **end,
retval = -EINVAL;
goto out;
}
+ hex = true;
} else if (*endptr == '.') {
/*
* Input looks like a fraction. Make sure even 1.k works
@@ -320,6 +324,10 @@ static int do_strtosz(const char *nptr, const char **end,
c = *endptr;
mul = suffix_mul(c, unit);
if (mul > 0) {
+ if (hex) {
+ warn_report("Using a multiplier suffix on hex numbers "
+ "is deprecated: %s", nptr);
+ }
endptr++;
} else {
mul = suffix_mul(default_suffix, unit);
--
2.30.1
3 years, 8 months
[PATCH v4 0/1] qemu: add per-vcpu delay stats
by Aleksei Zakharov
Fixed since v3:
- Report error if cannot read stats.
- Don't fail if cannot read stats.
- Add documentation.
- Drop unnecessary checks.
- Don't delete unrelated whitespace.
- Make sure schedstat file is closed before returning.
Fixed since v2:
- Close schedstat file after use.
Fixes since v1:
- Collect per-vcpu stats.
- Coding style errors
- Use glib functions.
Aleksei Zakharov (1):
qemu: add per-vcpu delay stats
docs/manpages/virsh.rst | 4 ++++
src/libvirt-domain.c | 4 ++++
src/qemu/qemu_driver.c | 44 +++++++++++++++++++++++++++++++++++++++--
3 files changed, 50 insertions(+), 2 deletions(-)
--
2.17.1
3 years, 8 months
[libvirt PATCH 00/17] qemu: Implement external limit manager feature
by Andrea Bolognani
This feature has been requested by KubeVirt developers and will make
it possible for them to make some VFIO-related features, such as
migration and hotplug, work correctly.
https://bugzilla.redhat.com/show_bug.cgi?id=1916346
The first part of the series, especially the first 9 patches, is
preparation work: it addresses a few annoying issues with our APIs
that deal with process limits, and makes them all nice, consistent
and easy to reason about while moving policy code from the generic
code to the QEMU driver where it belongs.
Andrea Bolognani (17):
util: Document limit-related functions
util: Simplify stubs
util: Always pass a pid to virProcessSetMax*()
util: Introduce virProcess{Get,Set}Limit()
qemu: Make some minor tweaks
qemu: Set all limits at the same time
util: Have virCommand remember whether limits are set
qemu: Set limits only when explicitly asked to do so
util: Don't special-case setting a limit to zero
conf: Rename original_memlock -> originalMemlock
tests: Mock virProcessGetMaxMemLock()
util: Try to get limits from /proc
qemu: Don't ignore virProcessGetMaxMemLock() errors
qemu: Refactor qemuDomainAdjustMaxMemLock()
qemu: Add external_limit_manager config knob
qemu: Wire up external limit manager
news: Document external limit manager feature
NEWS.rst | 10 +
src/conf/domain_conf.h | 5 +-
src/qemu/libvirtd_qemu.aug | 1 +
src/qemu/qemu.conf | 12 +
src/qemu/qemu_command.c | 4 -
src/qemu/qemu_conf.c | 4 +
src/qemu/qemu_conf.h | 1 +
src/qemu/qemu_domain.c | 47 ++--
src/qemu/qemu_migration.c | 2 +
src/qemu/qemu_process.c | 30 ++-
src/qemu/test_libvirtd_qemu.aug.in | 1 +
src/util/vircommand.c | 21 +-
src/util/virprocess.c | 340 ++++++++++++++++++++---------
src/util/virprocess.h | 2 +-
tests/virprocessmock.c | 7 +
15 files changed, 354 insertions(+), 133 deletions(-)
--
2.26.2
3 years, 8 months
[PATCH] domaincapstest: Return EXIT_SUCCESS / EXIT_FAILURE instead of -1
by Peter Krempa
The value is used as return value for the process itself.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
tests/domaincapstest.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/domaincapstest.c b/tests/domaincapstest.c
index 7a082705c6..65d9f4c635 100644
--- a/tests/domaincapstest.c
+++ b/tests/domaincapstest.c
@@ -475,7 +475,7 @@ mymain(void)
DO_TEST_BHYVE("fbuf", "/usr/sbin/bhyve", &bhyve_caps, VIR_DOMAIN_VIRT_BHYVE);
#endif /* WITH_BHYVE */
- return ret;
+ return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
#if WITH_QEMU
--
2.29.2
3 years, 8 months
[PATCH] qemuMigrationSrcRun: Don't jump to 'exit_monitor' from outside of the monitor
by Peter Krempa
Failure of 'qemuMigrationSetDBusVMState' would jump to 'exit_monitor'
but the function isn't called inside of the monitor context.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_migration.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index e44931dcfa..79dcb4a15d 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -4156,7 +4156,7 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver,
}
if (qemuMigrationSetDBusVMState(driver, vm) < 0)
- goto exit_monitor;
+ goto error;
/* Before EnterMonitor, since already qemuProcessStopCPUs does that */
if (!(flags & VIR_MIGRATE_LIVE) &&
--
2.29.2
3 years, 8 months
[PATCH] meson: Add documentation installation directory option
by Chris Mayo
Allow the directory to be chosen at installation time, to support local
conventions e.g. versioning.
Signed-off-by: Chris Mayo <aklhfex(a)gmail.com>
---
meson.build | 6 +++++-
meson_options.txt | 1 +
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/meson.build b/meson.build
index 369548f127..5c7a335947 100644
--- a/meson.build
+++ b/meson.build
@@ -83,8 +83,12 @@ mandir = prefix / get_option('mandir')
sbindir = prefix / get_option('sbindir')
sharedstatedir = prefix / get_option('sharedstatedir')
+docdir = get_option('docdir')
+if docdir == ''
+ docdir = datadir / 'doc' / meson.project_name()
+endif
+
confdir = sysconfdir / meson.project_name()
-docdir = datadir / 'doc' / meson.project_name()
pkgdatadir = datadir / meson.project_name()
diff --git a/meson_options.txt b/meson_options.txt
index e5d79c2b6b..2606648b64 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -7,6 +7,7 @@ option('expensive_tests', type: 'feature', value: 'auto', description: 'set the
option('test_coverage', type: 'boolean', value: false, description: 'turn on code coverage instrumentation')
option('git_werror', type: 'feature', value: 'auto', description: 'use -Werror if building from GIT')
option('rpath', type: 'feature', value: 'auto', description: 'whether to include rpath information in installed binaries and libraries')
+option('docdir', type: 'string', value: '', description: 'documentation installation directory')
option('docs', type: 'feature', value: 'auto', description: 'whether to generate documentation')
option('tests', type: 'feature', value: 'auto', description: 'whether to build tests')
--
2.28.0
3 years, 8 months
[libvirt PATCH] util: Fix error reporting in virnetlink
by Andrea Bolognani
The preprocessor macro we use to check whether we're on Linux
has not been spelled properly, and so we will always report the
error message intended for other platforms.
Fixes: 879bcee08ce0f91f556fddfe452c3fbed5318468
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
src/util/virnetlink.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/util/virnetlink.c b/src/util/virnetlink.c
index a06195bd00..cfb86550a5 100644
--- a/src/util/virnetlink.c
+++ b/src/util/virnetlink.c
@@ -1231,7 +1231,7 @@ virNetlinkEventRemoveClient(int watch, const virMacAddr *macaddr,
#else
-# if defined(__linux)
+# if defined(__linux__)
static const char *unsupported = N_("libnl was not available at build time");
# else
static const char *unsupported = N_("not supported on non-linux platforms");
--
2.26.2
3 years, 8 months
[libvirt PATCH] util: don't log error if SRIOV PF has no associated netdev
by Laine Stump
Some SRIOV PFs don't have a netdev associated with them (the spec
apparently doesn't require it). In most cases when libvirt is dealing
with an SRIOV VF, that VF must have a PF, and the PF *must* have an
associated netdev (the only way to set the MAC address of a VF is by
sending a netlink message to the netdev of that VF's PF). But there
are times when we don't need for the PF to have a netdev; in
particular, when we're just getting the Switchdev Features for a VF,
we don't need the PF netdev - the netdev of the VF (apparently) works
just as well.
Commit 6452e2f5 (libvirt 5.1.0) *kind of* made libvirt work around PFs
with no netdevs in this case - if virNetDevGetPhysicalFunction
returned an error when setting up to retrieve Switchdev feature info,
it would ignore the error, and then check if the PF netdev name was
NULL and, if so it would reset the error object and continue on rather
than returning early with a failure. The problem is that by the time
this special handling occured, the error message about missing netdev
had already been logged, which was harmless to proper operation, but
confused the user.
Fortunately there are only 2 users of virNetDevGetPhysicalFunction, so
it is easy to redefine it's API to state that a missing netdev name is
*not* an error - in that case it will still return success, but the
caller must be prepared for the PF netdev name to be NULL. After
making this change, we can modify the two callers to behave properly
with the new semantics (for one of the callers it *is* still an error,
so the error message is moved there, but for the other it is okay to
continue), and our spurious error messages are a thing of the past.
Resolves: https://bugzilla.redhat.com/1924616
Fixes: 6452e2f5e1837bd753ee465e6607ed3c4f62b815
Signed-off-by: Laine Stump <laine(a)redhat.com>
---
src/util/virnetdev.c | 31 +++++++++++++++----------------
1 file changed, 15 insertions(+), 16 deletions(-)
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index 2b4c8b6280..7b766234ec 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -1339,7 +1339,8 @@ virNetDevGetVirtualFunctionIndex(const char *pfname, const char *vfname,
*
* @ifname : name of the physical function interface name
* @pfname : Contains sriov physical function for interface ifname
- * upon successful return
+ * upon successful return (might be NULL if the PF has no
+ * associated netdev. This is *not* an error)
*
* Returns 0 on success, -1 on failure
*
@@ -1361,15 +1362,6 @@ virNetDevGetPhysicalFunction(const char *ifname, char **pfname)
return -1;
}
- if (!*pfname) {
- /* The SRIOV standard does not require VF netdevs to have
- * the netdev assigned to a PF. */
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("The PF device for VF %s has no network device name"),
- ifname);
- return -1;
- }
-
return 0;
}
@@ -1442,6 +1434,17 @@ virNetDevGetVirtualFunctionInfo(const char *vfname, char **pfname,
if (virNetDevGetPhysicalFunction(vfname, pfname) < 0)
return -1;
+ if (!*pfname) {
+ /* The SRIOV standard does not require VF netdevs to have the
+ * netdev assigned to a PF, but our method of retrieving
+ * VFINFO does.
+ */
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("The PF device for VF %s has no network device name, cannot get virtual function info"),
+ vfname);
+ return -1;
+ }
+
if (virNetDevGetVirtualFunctionIndex(*pfname, vfname, vf) < 0)
goto cleanup;
@@ -3204,12 +3207,8 @@ virNetDevSwitchdevFeature(const char *ifname,
if ((is_vf = virNetDevIsVirtualFunction(ifname)) < 0)
return ret;
- if (is_vf == 1) {
- /* Ignore error if PF does not have netdev assigned.
- * In that case pfname == NULL. */
- if (virNetDevGetPhysicalFunction(ifname, &pfname) < 0)
- virResetLastError();
- }
+ if (is_vf == 1 && virNetDevGetPhysicalFunction(ifname, &pfname) < 0)
+ return ret;
pci_device_ptr = pfname ? virNetDevGetPCIDevice(pfname) :
virNetDevGetPCIDevice(ifname);
--
2.29.2
3 years, 8 months