qemu_conf: Introduce metadata_lock_manager

This config option allows users to set and enable lock manager
for domain metadata. The lock manager is going to be used by
security drivers to serialize each other when changing a file
ownership or changing the SELinux label. The only supported lock
manager is 'lockd' for now.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
Michal Privoznik 2018-08-21 11:55:55 +02:00
parent 35b5b244da
commit 8b8aefb3d6
5 changed files with 24 additions and 0 deletions

View File

@ -98,6 +98,7 @@ module Libvirtd_qemu =
| bool_entry "relaxed_acs_check"
| bool_entry "allow_disk_format_probing"
| str_entry "lock_manager"
| str_entry "metadata_lock_manager"
let rpc_entry = int_entry "max_queued"
| int_entry "keepalive_interval"

View File

@ -659,6 +659,14 @@
#lock_manager = "lockd"
# To serialize two or more daemons trying to change metadata on a
# file (e.g. a file on NFS share), libvirt offers a locking
# mechanism. Currently, only "lockd" is supported (or no locking
# at all if unset). Note that this is independent of lock_manager
# described above.
#
#metadata_lock_manager = "lockd"
# Set limit of maximum APIs queued on one domain. All other APIs
# over this threshold will fail on acquiring job lock. Specially,

View File

@ -430,6 +430,7 @@ static void virQEMUDriverConfigDispose(void *obj)
virStringListFree(cfg->securityDriverNames);
VIR_FREE(cfg->lockManagerName);
VIR_FREE(cfg->metadataLockManagerName);
virFirmwareFreeList(cfg->firmwares, cfg->nfirmwares);
@ -840,6 +841,18 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
if (virConfGetValueString(conf, "lock_manager", &cfg->lockManagerName) < 0)
goto cleanup;
if (virConfGetValueString(conf, "metadata_lock_manager",
&cfg->metadataLockManagerName) < 0)
goto cleanup;
if (cfg->metadataLockManagerName &&
STRNEQ(cfg->metadataLockManagerName, "lockd")) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unknown metadata lock manager name %s"),
cfg->metadataLockManagerName);
goto cleanup;
}
if (virConfGetValueString(conf, "stdio_handler", &stdioHandler) < 0)
goto cleanup;
if (stdioHandler) {

View File

@ -186,6 +186,7 @@ struct _virQEMUDriverConfig {
bool autoStartBypassCache;
char *lockManagerName;
char *metadataLockManagerName;
int keepAliveInterval;
unsigned int keepAliveCount;

View File

@ -81,6 +81,7 @@ module Test_libvirtd_qemu =
{ "mac_filter" = "1" }
{ "relaxed_acs_check" = "1" }
{ "lock_manager" = "lockd" }
{ "metadata_lock_manager" = "lockd" }
{ "max_queued" = "0" }
{ "keepalive_interval" = "5" }
{ "keepalive_count" = "5" }