From nobody Mon Feb 9 00:07:52 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1535357366810922.1544101751151; Mon, 27 Aug 2018 01:09:26 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 79B25432A5; Mon, 27 Aug 2018 08:09:24 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 36FC35C73F; Mon, 27 Aug 2018 08:09:24 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id E0B774A46E; Mon, 27 Aug 2018 08:09:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w7R894lj032521 for ; Mon, 27 Aug 2018 04:09:04 -0400 Received: by smtp.corp.redhat.com (Postfix) id 49FA12027056; Mon, 27 Aug 2018 08:09:04 +0000 (UTC) Received: from localhost.localdomain (ovpn-204-81.brq.redhat.com [10.40.204.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id CC640202704E for ; Mon, 27 Aug 2018 08:09:03 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Mon, 27 Aug 2018 10:08:32 +0200 Message-Id: <45a287b15182b1452dcdfe123922e17dd48891d9.1535356707.git.mprivozn@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v3 19/28] qemu_conf: Introduce metadata_lock_manager X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 27 Aug 2018 08:09:25 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: John Ferlan --- src/qemu/libvirtd_qemu.aug | 1 + src/qemu/qemu.conf | 6 ++++++ src/qemu/qemu_conf.c | 13 +++++++++++++ src/qemu/qemu_conf.h | 1 + src/qemu/test_libvirtd_qemu.aug.in | 1 + 5 files changed, 22 insertions(+) diff --git a/src/qemu/libvirtd_qemu.aug b/src/qemu/libvirtd_qemu.aug index ddc4bbfd1d..42e325d4fb 100644 --- a/src/qemu/libvirtd_qemu.aug +++ b/src/qemu/libvirtd_qemu.aug @@ -98,6 +98,7 @@ module Libvirtd_qemu =3D | bool_entry "relaxed_acs_check" | bool_entry "allow_disk_format_probing" | str_entry "lock_manager" + | str_entry "metadata_lock_manager" =20 let rpc_entry =3D int_entry "max_queued" | int_entry "keepalive_interval" diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf index cd57b3cc69..06caa39232 100644 --- a/src/qemu/qemu.conf +++ b/src/qemu/qemu.conf @@ -659,6 +659,12 @@ #lock_manager =3D "lockd" =20 =20 +# To serialize two daemons trying to change metadata on a file, +# libvirt offers a locking mechanism. Currently, only "lockd" is +# supported (or no locking at all if unset). +# +#metadata_lock_manager =3D "lockd" + =20 # Set limit of maximum APIs queued on one domain. All other APIs # over this threshold will fail on acquiring job lock. Specially, diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index a4f545ef92..46318b7b2a 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -428,6 +428,7 @@ static void virQEMUDriverConfigDispose(void *obj) virStringListFree(cfg->securityDriverNames); =20 VIR_FREE(cfg->lockManagerName); + VIR_FREE(cfg->metadataLockManagerName); =20 virFirmwareFreeList(cfg->firmwares, cfg->nfirmwares); =20 @@ -838,6 +839,18 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr= cfg, =20 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) { diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h index a8d84efea2..c227ac72cc 100644 --- a/src/qemu/qemu_conf.h +++ b/src/qemu/qemu_conf.h @@ -186,6 +186,7 @@ struct _virQEMUDriverConfig { bool autoStartBypassCache; =20 char *lockManagerName; + char *metadataLockManagerName; =20 int keepAliveInterval; unsigned int keepAliveCount; diff --git a/src/qemu/test_libvirtd_qemu.aug.in b/src/qemu/test_libvirtd_qe= mu.aug.in index f1e8806ad2..451e73126e 100644 --- a/src/qemu/test_libvirtd_qemu.aug.in +++ b/src/qemu/test_libvirtd_qemu.aug.in @@ -81,6 +81,7 @@ module Test_libvirtd_qemu =3D { "mac_filter" =3D "1" } { "relaxed_acs_check" =3D "1" } { "lock_manager" =3D "lockd" } +{ "metadata_lock_manager" =3D "lockd" } { "max_queued" =3D "0" } { "keepalive_interval" =3D "5" } { "keepalive_count" =3D "5" } --=20 2.16.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list