[libvirt PATCH 00/10] Automatic mutex management - part 5
by Tim Wiederhake
Use the recently implemented VIR_LOCK_GUARD and VIR_WITH_MUTEX_LOCK_GUARD
to simplify mutex management.
Tim Wiederhake (10):
virnetdaemon: Use automatic mutex management
bridge_driver: Use automatic mutex management
node_device_driver: Use automatic mutex management
interface_backend_netcf: Use automatic mutex management
node_device_udev: Use automatic mutex management
qemu_agent: Use automatic mutex management
vbox_common: Use automatic mutex management
datatypes: Use automatic mutex management
ch_monitor: Use automatic mutex management
virportallocator: Use automatic mutex management
src/ch/ch_monitor.c | 55 +++----
src/datatypes.c | 63 +++-----
src/interface/interface_backend_netcf.c | 192 +++++++++++-------------
src/network/bridge_driver.c | 59 +++-----
src/network/bridge_driver_linux.c | 4 +-
src/node_device/node_device_driver.c | 12 +-
src/node_device/node_device_udev.c | 76 +++++-----
src/qemu/qemu_agent.c | 25 ++-
src/rpc/virnetdaemon.c | 144 ++++++------------
src/util/virportallocator.c | 93 +++++-------
src/vbox/vbox_common.c | 31 ++--
11 files changed, 302 insertions(+), 452 deletions(-)
--
2.31.1
2 years, 9 months
[PATCH] qemu: capabilities: Remove check for /usr/libexec/qemu-kvm
by Jim Fehlig
A downstream packaging bug resulted in a scenario where no aarch64 emulator
binary was installed on a kvm host. Querying capabilities on the host
succeeds and the capabilities correctly report that no <guest>'s are
supported, but the following error is logged
libvirtd: Cannot check QEMU binary /usr/libexec/qemu-kvm: No such file or directory
This error is confusing and not very helpful. Additionally, comments in the
associated code note that /usr/libexec/qemu-kvm is disto-specific, which
suggests the logic is better suited for a downstream patch. Removing the
check for /usr/libexec/qemu-kvm leaves virQEMUCapsGetDefaultEmulator() as
nothing more than a needless wrapper around virQEMUCapsFindBinaryForArch.
Drop virQEMUCapsGetDefaultEmulator() and call virQEMUCapsFindBinaryForArch()
directly in its place, which squelches the unhelpful error.
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
src/qemu/qemu_capabilities.c | 25 +++----------------------
src/qemu/qemu_capabilities.h | 5 +++--
src/qemu/qemu_domain.c | 2 +-
3 files changed, 7 insertions(+), 25 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 6b4ed08499..c866c5acf6 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -915,7 +915,7 @@ virQEMUCapsFindBinary(const char *format,
return ret;
}
-static char *
+char *
virQEMUCapsFindBinaryForArch(virArch hostarch,
virArch guestarch)
{
@@ -949,25 +949,6 @@ virQEMUCapsFindBinaryForArch(virArch hostarch,
}
-char *
-virQEMUCapsGetDefaultEmulator(virArch hostarch,
- virArch guestarch)
-{
- char *binary = NULL;
- /* Check for existence of base emulator, or alternate base
- * which can be used with magic cpu choice
- */
- binary = virQEMUCapsFindBinaryForArch(hostarch, guestarch);
-
- /* RHEL doesn't follow the usual naming for QEMU binaries and ships
- * a single binary named qemu-kvm outside of $PATH instead */
- if (virQEMUCapsGuestIsNative(hostarch, guestarch) && !binary)
- binary = g_strdup("/usr/libexec/qemu-kvm");
-
- return binary;
-}
-
-
static int
virQEMUCapsInitGuest(virCaps *caps,
virFileCache *cache,
@@ -978,7 +959,7 @@ virQEMUCapsInitGuest(virCaps *caps,
virQEMUCaps *qemuCaps = NULL;
int ret = -1;
- binary = virQEMUCapsGetDefaultEmulator(hostarch, guestarch);
+ binary = virQEMUCapsFindBinaryForArch(hostarch, guestarch);
/* Ignore binary if extracting version info fails */
if (binary) {
@@ -5878,7 +5859,7 @@ virQEMUCapsCacheLookupDefault(virFileCache *cache,
}
if (!binary) {
- probedbinary = virQEMUCapsGetDefaultEmulator(hostarch, arch);
+ probedbinary = virQEMUCapsFindBinaryForArch(hostarch, arch);
binary = probedbinary;
}
if (!binary) {
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 948029d60d..d0e776a5c4 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -752,8 +752,6 @@ const char *virQEMUCapsGetMachineDefaultRAMid(virQEMUCaps *qemuCaps,
void virQEMUCapsFilterByMachineType(virQEMUCaps *qemuCaps,
virDomainVirtType virtType,
const char *machineType);
-char * virQEMUCapsGetDefaultEmulator(virArch hostarch,
- virArch guestarch);
virFileCache *virQEMUCapsCacheNew(const char *libDir,
const char *cacheDir,
@@ -789,6 +787,9 @@ bool virQEMUCapsSupportsGICVersion(virQEMUCaps *qemuCaps,
const char *virQEMUCapsGetPreferredMachine(virQEMUCaps *qemuCaps,
virDomainVirtType virtType);
+char *virQEMUCapsFindBinaryForArch(virArch hostarch,
+ virArch guestarch);
+
int virQEMUCapsInitGuestFromBinary(virCaps *caps,
const char *binary,
virQEMUCaps *qemuCaps,
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 18d403e099..81b56b4233 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -4607,7 +4607,7 @@ qemuDomainDefPostParseBasic(virDomainDef *def,
/* check for emulator and create a default one if needed */
if (!def->emulator) {
- if (!(def->emulator = virQEMUCapsGetDefaultEmulator(
+ if (!(def->emulator = virQEMUCapsFindBinaryForArch(
driver->hostarch, def->os.arch))) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("No emulator found for arch '%s'"),
--
2.35.1
2 years, 9 months
[PATCH 00/29] docs: Convert some pages to rST and clean up (part 2)
by Peter Krempa
Peter Krempa (29):
docs: Remove empty unreferenced 'drvremote' page
docs: Convert 'cgroups' page to rST
docs: Convert 'drvbhyve' page to rST
docs: Convert 'drvesx' page to rST
docs: Convert 'drvhyperv' page to rST
docs: Convert 'drvlxc' page to rST
docs: Convert 'drvnodedev' page to rST
docs: Convert 'drvopenvz' page to rST
docs: Convert 'drvsecret' page to rST
docs: Convert 'drvtest' page to rST
docs: Convert 'drvvbox' page to rST
docs: Convert 'drvvirtuozzo' page to rST
docs: Convert 'drvvmware' page to rST
docs: Convert 'drvxen' page to rST
docs: Convert 'firewall' page to rST
docs: Convert 'format' page to rST
docs: Convert 'formatcaps' page to rST
docs: Convert 'formatdomaincaps' to rST
docs: Convert 'formatnetworkport' to rST
docs: Fix heading of 'formatnetworkport' page
docs: Convert 'formatstoragecaps' page to rST
docs: Convert 'formatstorageencryption' page to rST
docs: formatstorageencryption: Drop empty 'default' paragraph
docs: formatstorageencryption: Re-style encryption type headers
docs: Convert 'hooks' page to rST
docs: Convert 'java' page to rST
docs: Convert 'logging' page to rST
docs: logging: Replace example by link to kbase/debuglogs.html
docs: Convert 'php' page to rST
docs/cgroups.html.in | 424 --------------
docs/cgroups.rst | 364 ++++++++++++
docs/drvbhyve.html.in | 583 -------------------
docs/drvbhyve.rst | 582 +++++++++++++++++++
docs/drvesx.html.in | 838 ---------------------------
docs/drvesx.rst | 681 ++++++++++++++++++++++
docs/drvhyperv.html.in | 150 -----
docs/drvhyperv.rst | 121 ++++
docs/drvlxc.html.in | 822 --------------------------
docs/drvlxc.rst | 670 +++++++++++++++++++++
docs/drvnodedev.html.in | 383 ------------
docs/drvnodedev.rst | 348 +++++++++++
docs/drvopenvz.html.in | 123 ----
docs/drvopenvz.rst | 97 ++++
docs/drvremote.html.in | 7 -
docs/drvsecret.html.in | 82 ---
docs/drvsecret.rst | 65 +++
docs/drvtest.html.in | 27 -
docs/drvtest.rst | 21 +
docs/drvvbox.html.in | 172 ------
docs/drvvbox.rst | 161 +++++
docs/drvvirtuozzo.html.in | 70 ---
docs/drvvirtuozzo.rst | 60 ++
docs/drvvmware.html.in | 89 ---
docs/drvvmware.rst | 72 +++
docs/drvxen.html.in | 358 ------------
docs/drvxen.rst | 338 +++++++++++
docs/firewall.html.in | 523 -----------------
docs/firewall.rst | 506 ++++++++++++++++
docs/format.html.in | 48 --
docs/format.rst | 35 ++
docs/formatcaps.html.in | 219 -------
docs/formatcaps.rst | 196 +++++++
docs/formatdomain.rst | 25 +-
docs/formatdomaincaps.html.in | 693 ----------------------
docs/formatdomaincaps.rst | 602 +++++++++++++++++++
docs/formatnetworkport.html.in | 223 -------
docs/formatnetworkport.rst | 175 ++++++
docs/formatstoragecaps.html.in | 95 ---
docs/formatstoragecaps.rst | 81 +++
docs/formatstorageencryption.html.in | 181 ------
docs/formatstorageencryption.rst | 139 +++++
docs/hooks.html.in | 406 -------------
docs/hooks.rst | 518 +++++++++++++++++
docs/java.html.in | 121 ----
docs/java.rst | 128 ++++
docs/kbase/backing_chains.rst | 2 +-
docs/logging.html.in | 243 --------
docs/logging.rst | 215 +++++++
docs/meson.build | 49 +-
docs/php.html.in | 28 -
docs/php.rst | 23 +
52 files changed, 6236 insertions(+), 6946 deletions(-)
delete mode 100644 docs/cgroups.html.in
create mode 100644 docs/cgroups.rst
delete mode 100644 docs/drvbhyve.html.in
create mode 100644 docs/drvbhyve.rst
delete mode 100644 docs/drvesx.html.in
create mode 100644 docs/drvesx.rst
delete mode 100644 docs/drvhyperv.html.in
create mode 100644 docs/drvhyperv.rst
delete mode 100644 docs/drvlxc.html.in
create mode 100644 docs/drvlxc.rst
delete mode 100644 docs/drvnodedev.html.in
create mode 100644 docs/drvnodedev.rst
delete mode 100644 docs/drvopenvz.html.in
create mode 100644 docs/drvopenvz.rst
delete mode 100644 docs/drvremote.html.in
delete mode 100644 docs/drvsecret.html.in
create mode 100644 docs/drvsecret.rst
delete mode 100644 docs/drvtest.html.in
create mode 100644 docs/drvtest.rst
delete mode 100644 docs/drvvbox.html.in
create mode 100644 docs/drvvbox.rst
delete mode 100644 docs/drvvirtuozzo.html.in
create mode 100644 docs/drvvirtuozzo.rst
delete mode 100644 docs/drvvmware.html.in
create mode 100644 docs/drvvmware.rst
delete mode 100644 docs/drvxen.html.in
create mode 100644 docs/drvxen.rst
delete mode 100644 docs/firewall.html.in
create mode 100644 docs/firewall.rst
delete mode 100644 docs/format.html.in
create mode 100644 docs/format.rst
delete mode 100644 docs/formatcaps.html.in
create mode 100644 docs/formatcaps.rst
delete mode 100644 docs/formatdomaincaps.html.in
create mode 100644 docs/formatdomaincaps.rst
delete mode 100644 docs/formatnetworkport.html.in
create mode 100644 docs/formatnetworkport.rst
delete mode 100644 docs/formatstoragecaps.html.in
create mode 100644 docs/formatstoragecaps.rst
delete mode 100644 docs/formatstorageencryption.html.in
create mode 100644 docs/formatstorageencryption.rst
delete mode 100644 docs/hooks.html.in
create mode 100644 docs/hooks.rst
delete mode 100644 docs/java.html.in
create mode 100644 docs/java.rst
delete mode 100644 docs/logging.html.in
create mode 100644 docs/logging.rst
delete mode 100644 docs/php.html.in
create mode 100644 docs/php.rst
--
2.35.1
2 years, 9 months
[PATCH] virsh: Provide completer for virtualization types
by natto1784
Related: https://gitlab.com/libvirt/libvirt/-/issues/9
Signed-off-by: natto1784 <natto(a)weirdnatto.in>
---
.gitignore | 4 ++++
tools/virsh-completer-host.c | 12 ++++++++++++
tools/virsh-completer-host.h | 5 +++++
tools/virsh-host.c | 3 +++
4 files changed, 24 insertions(+)
diff --git a/.gitignore b/.gitignore
index 4695391..62012f4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,4 +23,8 @@ tags
# clangd related ignores
.clangd
+.cache/clangd
compile_commands.json
+
+# ccls cache
+.ccls-cache
diff --git a/tools/virsh-completer-host.c b/tools/virsh-completer-host.c
index 40cb687..e481a73 100644
--- a/tools/virsh-completer-host.c
+++ b/tools/virsh-completer-host.c
@@ -27,6 +27,7 @@
#include "virxml.h"
#include "virutil.h"
#include "virsh-host.h"
+#include "conf/domain_conf.h"
static char *
virshPagesizeNodeToString(xmlNodePtr node)
@@ -180,3 +181,14 @@ virshNodeSuspendTargetCompleter(vshControl *ctl G_GNUC_UNUSED,
return virshEnumComplete(VIR_NODE_SUSPEND_TARGET_LAST,
virshNodeSuspendTargetTypeToString);
}
+
+char **
+virshVirtTypeCompleter(vshControl *ctl G_GNUC_UNUSED,
+ const vshCmd *cmd G_GNUC_UNUSED,
+ unsigned int flags)
+{
+ virCheckFlags(0, NULL);
+
+ return virshEnumComplete(VIR_DOMAIN_VIRT_LAST,
+ virDomainVirtTypeToString);
+}
diff --git a/tools/virsh-completer-host.h b/tools/virsh-completer-host.h
index e71ccff..372ac14 100644
--- a/tools/virsh-completer-host.h
+++ b/tools/virsh-completer-host.h
@@ -41,3 +41,8 @@ char **
virshNodeSuspendTargetCompleter(vshControl *ctl,
const vshCmd *cmd,
unsigned int flags);
+
+char **
+virshVirtTypeCompleter(vshControl *ctl,
+ const vshCmd *cmd,
+ unsigned int flags);
diff --git a/tools/virsh-host.c b/tools/virsh-host.c
index 2e3cbc3..b28f29f 100644
--- a/tools/virsh-host.c
+++ b/tools/virsh-host.c
@@ -77,6 +77,7 @@ static const vshCmdInfo info_domcapabilities[] = {
static const vshCmdOptDef opts_domcapabilities[] = {
{.name = "virttype",
.type = VSH_OT_STRING,
+ .completer = virshVirtTypeCompleter,
.help = N_("virtualization type (/domain/@type)"),
},
{.name = "emulatorbin",
@@ -1577,6 +1578,7 @@ static const vshCmdOptDef opts_hypervisor_cpu_compare[] = {
VIRSH_COMMON_OPT_FILE(N_("file containing an XML CPU description")),
{.name = "virttype",
.type = VSH_OT_STRING,
+ .completer = virshVirtTypeCompleter,
.help = N_("virtualization type (/domain/@type)"),
},
{.name = "emulator",
@@ -1686,6 +1688,7 @@ static const vshCmdOptDef opts_hypervisor_cpu_baseline[] = {
VIRSH_COMMON_OPT_FILE(N_("file containing XML CPU descriptions")),
{.name = "virttype",
.type = VSH_OT_STRING,
+ .completer = virshVirtTypeCompleter,
.help = N_("virtualization type (/domain/@type)"),
},
{.name = "emulator",
--
2.35.1
2 years, 9 months
[libvirt PATCH] meson: Use dicts to initialize cfg_data objects
by Andrea Bolognani
Instead of creating an empty object and then setting keys one
at a time, it is possible to pass a dict object to
configuration_data(). This is nicer because it doesn't require
repeating the name of the cfg_data object over and over.
There is one exception: the 'conf' object, where we store values
that are used directly by C code. In that case, using a dict
object is not feasible for two reasons: first of all, replacing
the set_quoted() calls would result in awkward code with a lot
of calls to format(); moreover, since code that modifies it is
sprinkled all over the place, refactoring it would probably
make things more complicated rather than simpler.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
build-aux/meson.build | 18 ++++-----
docs/manpages/meson.build | 9 +++--
meson.build | 35 ++++++++++-------
po/meson.build | 7 ++--
src/meson.build | 65 ++++++++++++++++++-------------
src/remote/meson.build | 5 ++-
src/security/apparmor/meson.build | 11 +++---
tools/bash-completion/meson.build | 5 ++-
tools/meson.build | 21 +++++-----
9 files changed, 98 insertions(+), 78 deletions(-)
diff --git a/build-aux/meson.build b/build-aux/meson.build
index f4d0130e3b..bbfa27c4c6 100644
--- a/build-aux/meson.build
+++ b/build-aux/meson.build
@@ -1,14 +1,7 @@
-syntax_check_conf = configuration_data()
-syntax_check_conf.set('top_srcdir', meson.source_root())
-syntax_check_conf.set('top_builddir', meson.build_root())
-
flake8_path = ''
if flake8_prog.found()
flake8_path = flake8_prog.path()
endif
-syntax_check_conf.set('flake8_path', flake8_path)
-syntax_check_conf.set('runutf8', ' '.join(runutf8))
-syntax_check_conf.set('PYTHON3', python3_prog.path())
if host_machine.system() == 'freebsd' or host_machine.system() == 'darwin'
make_prog = find_program('gmake')
@@ -33,8 +26,15 @@ else
grep_prog = find_program('grep')
endif
-syntax_check_conf.set('GREP', grep_prog.path())
-syntax_check_conf.set('SED', sed_prog.path())
+syntax_check_conf = configuration_data({
+ 'top_srcdir': meson.source_root(),
+ 'top_builddir': meson.build_root(),
+ 'flake8_path': flake8_path,
+ 'runutf8': ' '.join(runutf8),
+ 'PYTHON3': python3_prog.path(),
+ 'GREP': grep_prog.path(),
+ 'SED': sed_prog.path(),
+})
configure_file(
input: 'Makefile.in',
diff --git a/docs/manpages/meson.build b/docs/manpages/meson.build
index bad9b62a2e..d9fcb6b057 100644
--- a/docs/manpages/meson.build
+++ b/docs/manpages/meson.build
@@ -84,10 +84,11 @@ foreach name : keyname_list
}
endforeach
-docs_man_conf = configuration_data()
-docs_man_conf.set('SYSCONFDIR', sysconfdir)
-docs_man_conf.set('RUNSTATEDIR', runstatedir)
-docs_man_conf.set('VERSION', meson.project_version())
+docs_man_conf = configuration_data({
+ 'SYSCONFDIR': sysconfdir,
+ 'RUNSTATEDIR': runstatedir,
+ 'VERSION': meson.project_version(),
+})
foreach data : docs_man_files
rst_in_file = '@0@.rst'.format(data['name'])
diff --git a/meson.build b/meson.build
index 27c21d1d67..50b996cbd4 100644
--- a/meson.build
+++ b/meson.build
@@ -2135,14 +2135,15 @@ pkgconfig_files = [
'libvirt-admin.pc.in',
]
-pkgconfig_conf = configuration_data()
-pkgconfig_conf.set('VERSION', meson.project_version())
-pkgconfig_conf.set('datadir', datadir)
-pkgconfig_conf.set('datarootdir', datadir)
-pkgconfig_conf.set('exec_prefix', prefix)
-pkgconfig_conf.set('includedir', includedir)
-pkgconfig_conf.set('libdir', libdir)
-pkgconfig_conf.set('prefix', prefix)
+pkgconfig_conf = configuration_data({
+ 'VERSION': meson.project_version(),
+ 'datadir': datadir,
+ 'datarootdir': datadir,
+ 'exec_prefix': prefix,
+ 'includedir': includedir,
+ 'libdir': libdir,
+ 'prefix': prefix,
+})
pkgconfig_dir = libdir / 'pkgconfig'
@@ -2165,8 +2166,9 @@ if git
'mingw-libvirt.spec.in',
]
- spec_conf = configuration_data()
- spec_conf.set('VERSION', meson.project_version())
+ spec_conf = configuration_data({
+ 'VERSION': meson.project_version(),
+ })
foreach file : spec_files
configure_file(
@@ -2180,8 +2182,9 @@ if git
env: runutf8, check: true)
authors_file = 'AUTHORS.rst.in'
- authors_conf = configuration_data()
- authors_conf.set('contributorslist', authors.stdout())
+ authors_conf = configuration_data({
+ 'contributorslist': authors.stdout(),
+ })
configure_file(
input: authors_file,
@@ -2209,9 +2212,11 @@ configure_file(output: 'meson-config.h', configuration: conf)
# generate run helper
-run_conf = configuration_data()
-run_conf.set('abs_builddir', meson.build_root())
-run_conf.set('abs_top_builddir', meson.build_root())
+run_conf = configuration_data({
+ 'abs_builddir': meson.build_root(),
+ 'abs_top_builddir': meson.build_root(),
+})
+
configure_file(
input: 'run.in',
output: '@BASENAME@',
diff --git a/po/meson.build b/po/meson.build
index 69d8be726a..f4d95f97fe 100644
--- a/po/meson.build
+++ b/po/meson.build
@@ -1,8 +1,9 @@
i18n = import('i18n')
-potfiles_conf = configuration_data()
-potfiles_conf.set('SRCDIR', '')
-potfiles_conf.set('BUILDDIR', '')
+potfiles_conf = configuration_data({
+ 'SRCDIR': '',
+ 'BUILDDIR': '',
+})
potfiles = configure_file(
input: 'POTFILES.in',
diff --git a/src/meson.build b/src/meson.build
index b2d951d36c..10165ba5ac 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -698,20 +698,23 @@ endforeach
foreach data : virt_daemon_confs
capitalize_args = [ '-c', 'print("@0@".capitalize())'.format(data['name']) ]
name_uc = run_command(python3_prog, capitalize_args, check: true, env: runutf8).stdout().strip()
- daemon_conf = configuration_data()
- daemon_conf.set('runstatedir', runstatedir)
- daemon_conf.set('sbindir', sbindir)
- daemon_conf.set('sysconfdir', sysconfdir)
- daemon_conf.set('DAEMON_NAME', data['name'])
- daemon_conf.set('DAEMON_NAME_UC', name_uc)
- # to silence meson warning about missing 'CONFIG' in the configuration_data
- daemon_conf.set('CONFIG', '@CONFIG@')
+
if conf.has('WITH_POLKIT')
- daemon_conf.set('default_auth', 'polkit')
+ default_auth = 'polkit'
else
- daemon_conf.set('default_auth', 'none')
+ default_auth = 'none'
endif
+ daemon_conf = configuration_data({
+ 'runstatedir': runstatedir,
+ 'sbindir': sbindir,
+ 'sysconfdir': sysconfdir,
+ 'DAEMON_NAME': data['name'],
+ 'DAEMON_NAME_UC': name_uc,
+ 'default_auth': default_auth,
+ # to silence meson warning about missing 'CONFIG' in the configuration_data
+ 'CONFIG': '@CONFIG@',
+ })
if data.get('with_ip', false)
conf_in = libvirtd_conf_tmp
@@ -783,20 +786,23 @@ if conf.has('WITH_LIBVIRTD')
)
foreach unit : virt_daemon_units
- unit_conf = configuration_data()
- unit_conf.set('runstatedir', runstatedir)
- unit_conf.set('sbindir', sbindir)
- unit_conf.set('sysconfdir', sysconfdir)
- unit_conf.set('name', unit['name'])
- unit_conf.set('service', unit['service'])
- unit_conf.set('sockprefix', unit['sockprefix'])
- unit_conf.set('deps', unit.get('deps', ''))
if conf.has('WITH_POLKIT')
- unit_conf.set('mode', '0666')
+ mode = '0666'
else
- unit_conf.set('mode', '0600')
+ mode = '0600'
endif
+ unit_conf = configuration_data({
+ 'runstatedir': runstatedir,
+ 'sbindir': sbindir,
+ 'sysconfdir': sysconfdir,
+ 'name': unit['name'],
+ 'service': unit['service'],
+ 'sockprefix': unit['sockprefix'],
+ 'deps': unit.get('deps', ''),
+ 'mode': mode,
+ })
+
configure_file(
input: unit['service_in'],
output: '@0@.service'.format(unit['service']),
@@ -829,15 +835,17 @@ if conf.has('WITH_LIBVIRTD')
# Generate openrc init files
if init_script == 'openrc'
foreach init : openrc_init_files
- init_conf = configuration_data()
- init_conf.set('sbindir', sbindir)
- init_conf.set('runstatedir', runstatedir)
if conf.has('WITH_FIREWALLD')
need_firewalld = 'need firewalld'
else
need_firewalld = ''
endif
- init_conf.set('NEED_FIREWALLD', need_firewalld)
+
+ init_conf = configuration_data({
+ 'sbindir': sbindir,
+ 'runstatedir': runstatedir,
+ 'NEED_FIREWALLD': need_firewalld,
+ })
init_file = configure_file(
input: init['in_file'],
@@ -1010,10 +1018,11 @@ run_pkg_config_files = [
'libvirt.pc.in',
]
-run_pkg_config_conf = configuration_data()
-run_pkg_config_conf.set('VERSION', meson.project_version())
-run_pkg_config_conf.set('abs_top_builddir', meson.build_root())
-run_pkg_config_conf.set('abs_top_srcdir', meson.source_root())
+run_pkg_config_conf = configuration_data({
+ 'VERSION': meson.project_version(),
+ 'abs_top_builddir': meson.build_root(),
+ 'abs_top_srcdir': meson.source_root(),
+})
foreach file : run_pkg_config_files
configure_file(
diff --git a/src/remote/meson.build b/src/remote/meson.build
index b2aafe6320..eb4f7a0068 100644
--- a/src/remote/meson.build
+++ b/src/remote/meson.build
@@ -240,8 +240,9 @@ if conf.has('WITH_REMOTE')
runstatedir / 'libvirt' / 'common',
]
- logrotate_conf = configuration_data()
- logrotate_conf.set('localstatedir', localstatedir)
+ logrotate_conf = configuration_data({
+ 'localstatedir': localstatedir,
+ })
foreach name : logrotate_files
log_file = configure_file(
diff --git a/src/security/apparmor/meson.build b/src/security/apparmor/meson.build
index 990f00b4f3..58b4024b85 100644
--- a/src/security/apparmor/meson.build
+++ b/src/security/apparmor/meson.build
@@ -5,11 +5,12 @@ apparmor_gen_profiles = [
'usr.sbin.virtxend',
]
-apparmor_gen_profiles_conf = configuration_data()
-apparmor_gen_profiles_conf.set('sysconfdir', sysconfdir)
-apparmor_gen_profiles_conf.set('sbindir', sbindir)
-apparmor_gen_profiles_conf.set('runstatedir', runstatedir)
-apparmor_gen_profiles_conf.set('libexecdir', libexecdir)
+apparmor_gen_profiles_conf = configuration_data({
+ 'sysconfdir': sysconfdir,
+ 'sbindir': sbindir,
+ 'runstatedir': runstatedir,
+ 'libexecdir': libexecdir,
+})
apparmor_dir = sysconfdir / 'apparmor.d'
diff --git a/tools/bash-completion/meson.build b/tools/bash-completion/meson.build
index deda7c4f46..2ce1c47602 100644
--- a/tools/bash-completion/meson.build
+++ b/tools/bash-completion/meson.build
@@ -4,8 +4,9 @@ completion_commands = [
]
foreach command : completion_commands
- completion_conf = configuration_data()
- completion_conf.set('command', command)
+ completion_conf = configuration_data({
+ 'command': command,
+ })
completion = configure_file(
input: 'vsh.in',
output: command,
diff --git a/tools/meson.build b/tools/meson.build
index ac714e6425..bb28a904dc 100644
--- a/tools/meson.build
+++ b/tools/meson.build
@@ -231,16 +231,17 @@ if conf.has('WITH_REMOTE')
)
endif
-tools_conf = configuration_data()
-tools_conf.set('PACKAGE', meson.project_name())
-tools_conf.set('VERSION', meson.project_version())
-tools_conf.set('bindir', bindir)
-tools_conf.set('libexecdir', libexecdir)
-tools_conf.set('localedir', localedir)
-tools_conf.set('localstatedir', localstatedir)
-tools_conf.set('sbindir', sbindir)
-tools_conf.set('schemadir', pkgdatadir / 'schemas')
-tools_conf.set('sysconfdir', sysconfdir)
+tools_conf = configuration_data({
+ 'PACKAGE': meson.project_name(),
+ 'VERSION': meson.project_version(),
+ 'bindir': bindir,
+ 'libexecdir': libexecdir,
+ 'localedir': localedir,
+ 'localstatedir': localstatedir,
+ 'sbindir': sbindir,
+ 'schemadir': pkgdatadir / 'schemas',
+ 'sysconfdir': sysconfdir,
+})
configure_file(
input: 'virt-xml-validate.in',
--
2.35.1
2 years, 9 months
[PATCH 00/11] qemu: switch to modern QEMU's snapshot-* API for
by Nikolay Shirokovskiy
This series applied on top of [1].
In this series I still use old API to load snapshot if snapshot was done
using old API. The thing is snapshot-load require "vmstate" parameter to
be set. And with old snapshot the disk which holds vmstate is not known
to libvirt. This is unfortunate as we will need to use old API for
a long time even after we drop support for QEMU older then 6.0 (where
snapshot-* API is introduced). I guess the best will be to allow
omiting "vmstate" for snapshot-load and thus falling back to default
disk for vmstate.
The code for recovering on libvirtd crash/restart is missing. I'll work on
it too if the overall approach is accepted.
[PATCH v2 REBASE 0/3] qemu: don't pause VM when creating internal snapshot
https://listman.redhat.com/archives/libvir-list/2022-March/229719.html
Nikolay Shirokovskiy (11):
qemu: add QEMU_CAPS_SNAPSHOT_SAVE capability
qemu: add monitor commands to snapshot-{save, load, delete}
qemu: move snapshot related funcs from domain.c to snapshot.c
qemu: introduce QEMU_ASYNC_JOB_SNAPSHOT_DELETE
qemu: snapshot: prepare for async snapshot deletion
conf: add memory state disk for internal snapshots
qemu: check internal snaphshot memory disk
qemu: add snapshot job types to qemuMonitorJobType
qemu: use snapshot-save for modern qemu to create snapshot
qemu: use snapshot-load for modern QEMU to revert to snapshot
qemu: use snapshot-delete for modern QEMU to delete snapshot
src/conf/snapshot_conf.c | 13 +
src/conf/snapshot_conf.h | 1 +
src/hypervisor/domain_job.c | 1 +
src/hypervisor/domain_job.h | 1 +
src/qemu/qemu_capabilities.c | 2 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_domain.c | 241 +-------
src/qemu/qemu_domain.h | 19 -
src/qemu/qemu_domainjob.c | 2 +
src/qemu/qemu_driver.c | 14 +-
src/qemu/qemu_migration.c | 2 +
src/qemu/qemu_monitor.c | 56 ++
src/qemu/qemu_monitor.h | 26 +
src/qemu/qemu_monitor_json.c | 106 ++++
src/qemu/qemu_monitor_json.h | 23 +
src/qemu/qemu_process.c | 22 +-
src/qemu/qemu_snapshot.c | 583 +++++++++++++++++-
src/qemu/qemu_snapshot.h | 10 +
.../caps_6.0.0.aarch64.xml | 1 +
.../qemucapabilitiesdata/caps_6.0.0.s390x.xml | 1 +
.../caps_6.0.0.x86_64.xml | 1 +
.../caps_6.1.0.x86_64.xml | 1 +
.../caps_6.2.0.aarch64.xml | 1 +
.../qemucapabilitiesdata/caps_6.2.0.ppc64.xml | 1 +
.../caps_6.2.0.x86_64.xml | 1 +
.../qemucapabilitiesdata/caps_7.0.0.ppc64.xml | 1 +
.../caps_7.0.0.x86_64.xml | 1 +
27 files changed, 844 insertions(+), 288 deletions(-)
--
2.35.1
2 years, 9 months
[PATCH] virsh: Fix integer overflow in allocpages
by Michal Privoznik
I've came across an aarch64 system which supports hugepages up to
16GiB of size. However, I was unable to allocate them using
virsh allocpages. This is because cmdAllocpages() uses
vshCommandOptScaledInt(), which scales passed value into bytes,
but since the virNodeAllocPages() expects size in KiB the
variable holding bytes is then divided by 1024. However, the
limit for the biggest value passed to vshCommandOptScaledInt() is
UINT_MAX which is now obviously wrong, as it needs to be UINT_MAX
* 1024.
The same bug is in completer. But here, let's use ULLONG_MAX so
that we don't have to care about it anymore.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
tools/virsh-completer-host.c | 2 +-
tools/virsh-host.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/virsh-completer-host.c b/tools/virsh-completer-host.c
index 40cb687582..cbdc3f0d49 100644
--- a/tools/virsh-completer-host.c
+++ b/tools/virsh-completer-host.c
@@ -42,7 +42,7 @@ virshPagesizeNodeToString(xmlNodePtr node)
unit = virXMLPropString(node, "unit");
if (virStrToLong_ull(pagesize, NULL, 10, &byteval) < 0)
return NULL;
- if (virScaleInteger(&byteval, unit, 1024, UINT_MAX) < 0)
+ if (virScaleInteger(&byteval, unit, 1024, ULLONG_MAX) < 0)
return NULL;
size = vshPrettyCapacity(byteval, &suffix);
ret = g_strdup_printf("%.0f%s", size, suffix);
diff --git a/tools/virsh-host.c b/tools/virsh-host.c
index 2e3cbc39b6..1e83d19fa1 100644
--- a/tools/virsh-host.c
+++ b/tools/virsh-host.c
@@ -488,7 +488,7 @@ cmdAllocpages(vshControl *ctl, const vshCmd *cmd)
if (cellno && vshCommandOptInt(ctl, cmd, "cellno", &startCell) < 0)
return false;
- if (vshCommandOptScaledInt(ctl, cmd, "pagesize", &tmp, 1024, UINT_MAX) < 0)
+ if (vshCommandOptScaledInt(ctl, cmd, "pagesize", &tmp, 1024, UINT_MAX * 1024ULL) < 0)
return false;
pageSizes[0] = VIR_DIV_UP(tmp, 1024);
--
2.35.1
2 years, 9 months
Entering freeze for libvirt-8.2.0
by Jiri Denemark
I have just tagged v8.2.0-rc1 in the repository and pushed signed
tarballs and source RPMs to https://libvirt.org/sources/
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
2 years, 9 months
[PATCH v2 REBASE 0/3] qemu: don't pause VM when creating internal snapshot
by Nikolay Shirokovskiy
Diff to v1 [1]:
- fix mistake of dropping hunk that starts CPUs if snapshot was
not successful. We still need it if halt upon snapshot is requested.
The is series is mostly about the first patch. The others patch are
minor cleanups.
[1] v1 version
https://listman.redhat.com/archives/libvir-list/2022-March/229437.html
Maxim Nestratov (1):
qemu: don't pause vm when creating internal snapshot
Nikolay Shirokovskiy (2):
qemu: remove excessive check in qemuSnapshotCreateActiveInternal
qemu: remove unnecessary gotos in qemuSnapshotCreateActiveInternal
src/qemu/qemu_snapshot.c | 24 +++++++-----------------
1 file changed, 7 insertions(+), 17 deletions(-)
--
2.35.1
2 years, 9 months