qemu.conf: Allow users to enable/disable label remembering

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Michal Privoznik 2018-11-20 14:23:35 +01:00
parent 1845991d9b
commit e05d8e570b
4 changed files with 10 additions and 0 deletions

View File

@ -71,6 +71,7 @@ module Libvirtd_qemu =
| str_entry "user" | str_entry "user"
| str_entry "group" | str_entry "group"
| bool_entry "dynamic_ownership" | bool_entry "dynamic_ownership"
| bool_entry "remember_owner"
| str_array_entry "cgroup_controllers" | str_array_entry "cgroup_controllers"
| str_array_entry "cgroup_device_acl" | str_array_entry "cgroup_device_acl"
| int_entry "seccomp_sandbox" | int_entry "seccomp_sandbox"

View File

@ -450,6 +450,10 @@
# Set to 0 to disable file ownership changes. # Set to 0 to disable file ownership changes.
#dynamic_ownership = 1 #dynamic_ownership = 1
# Whether libvirt should remember and restore the original
# ownership over files it is relabeling. Defaults to 1, set
# to 0 to disable the feature.
#remember_owner = 1
# What cgroup controllers to make use of with QEMU guests # What cgroup controllers to make use of with QEMU guests
# #

View File

@ -145,6 +145,7 @@ virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool privileged)
cfg->group = (gid_t)-1; cfg->group = (gid_t)-1;
} }
cfg->dynamicOwnership = privileged; cfg->dynamicOwnership = privileged;
cfg->rememberOwner = true;
cfg->cgroupControllers = -1; /* -1 == auto-detect */ cfg->cgroupControllers = -1; /* -1 == auto-detect */
@ -728,6 +729,9 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
if (virConfGetValueBool(conf, "dynamic_ownership", &cfg->dynamicOwnership) < 0) if (virConfGetValueBool(conf, "dynamic_ownership", &cfg->dynamicOwnership) < 0)
goto cleanup; goto cleanup;
if (virConfGetValueBool(conf, "remember_owner", &cfg->rememberOwner) < 0)
goto cleanup;
if (virConfGetValueStringList(conf, "cgroup_controllers", false, if (virConfGetValueStringList(conf, "cgroup_controllers", false,
&controllers) < 0) &controllers) < 0)
goto cleanup; goto cleanup;

View File

@ -43,6 +43,7 @@ module Test_libvirtd_qemu =
{ "user" = "root" } { "user" = "root" }
{ "group" = "root" } { "group" = "root" }
{ "dynamic_ownership" = "1" } { "dynamic_ownership" = "1" }
{ "remember_owner" = "1" }
{ "cgroup_controllers" { "cgroup_controllers"
{ "1" = "cpu" } { "1" = "cpu" }
{ "2" = "devices" } { "2" = "devices" }