qemu: Use real defaults for user and group in qemu.conf

The default values used by the library are determined at configure
time based on a number of factors, and we should reflect them in
the installed configuration file to make the comments it contains
more useful.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/263
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Andrea Bolognani 2022-03-28 15:26:11 +02:00
parent 9f1bd0fb97
commit 64a7b8203b
3 changed files with 31 additions and 7 deletions

View File

@ -130,12 +130,36 @@ if conf.has('WITH_QEMU')
],
}
virt_conf_files += files('qemu.conf')
qemu_user_group_conf = configuration_data({
'QEMU_USER': qemu_user,
'QEMU_GROUP': qemu_group,
})
qemu_conf = configure_file(
input: 'qemu.conf.in',
output: 'qemu.conf',
configuration: qemu_user_group_conf,
)
qemu_user_group_hack_conf = configuration_data({
'QEMU_USER': qemu_user,
'QEMU_GROUP': qemu_group,
# This hack is necessary because the output file is going to be
# used as input for another configure_file() call later, which
# will take care of substituting @CONFIG@ with useful data
'CONFIG': '@CONFIG@',
})
test_libvirtd_qemu_aug_tmp = configure_file(
input: 'test_libvirtd_qemu.aug.in',
output: 'test_libvirtd_qemu.aug.tmp',
configuration: qemu_user_group_hack_conf,
)
virt_conf_files += qemu_conf
virt_aug_files += files('libvirtd_qemu.aug')
virt_test_aug_files += {
'name': 'test_libvirtd_qemu.aug',
'aug': files('test_libvirtd_qemu.aug.in'),
'conf': files('qemu.conf'),
'aug': test_libvirtd_qemu_aug_tmp,
'conf': qemu_conf,
'test_name': 'libvirtd_qemu',
'test_srcdir': meson.current_source_dir(),
'test_builddir': meson.current_build_dir(),

View File

@ -516,11 +516,11 @@
# user = "+0" # Super user (uid=0)
# user = "100" # A user named "100" or a user with uid=100
#
#user = "root"
#user = "@QEMU_USER@"
# The group for QEMU processes run by the system instance. It can be
# specified in a similar way to user.
#group = "root"
#group = "@QEMU_GROUP@"
# Whether libvirt should dynamically change file ownership
# to match the configured user/group above. Defaults to 1.

View File

@ -47,8 +47,8 @@ module Test_libvirtd_qemu =
{ "security_driver" = "selinux" }
{ "security_default_confined" = "1" }
{ "security_require_confined" = "1" }
{ "user" = "root" }
{ "group" = "root" }
{ "user" = "@QEMU_USER@" }
{ "group" = "@QEMU_GROUP@" }
{ "dynamic_ownership" = "1" }
{ "remember_owner" = "1" }
{ "cgroup_controllers"