From nobody Mon May 4 10:17:59 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1745925754; cv=none; d=zohomail.com; s=zohoarc; b=cbaGgKxwDfMbQG88riAA8I2WZF/ybKpe0NC76WPwxSUmhWu014jeG84zePLynt4cglXVXxnxxMXcGiMguzYR+hCEbJXkEdpmmpuijralnl8rs0Dq9+hVaTAigz3EYUphECYHIble6ZFY3OLGfR1yTO7eR+MuguInIETXb6/ZaTU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1745925754; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id; bh=ur5dj97kv1bM2hocdlFJW9Uwnz1yNd6FEAzWvj4Kb3U=; b=m5cfrnL/prLWLL0L/7uqwpBHqIgGrMFd5S/Ddc9NpRGrfgAHgQmrW5O0axn7XXo5N9pp5QKp8uVv3PiuK63owY4q+5ecXs8Gb+PMUs/2ou+Hm5vbZs2prC1CFJZ4NPaXOBa9+FnHR/EPzezgJmK5WN9fob0SDsaCuTULkzYAP/k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 174592575486690.65372899460681; Tue, 29 Apr 2025 04:22:34 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 475D714C3; Tue, 29 Apr 2025 07:22:34 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id D1D2D1477; Tue, 29 Apr 2025 07:15:22 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 262851292; Tue, 29 Apr 2025 07:15:08 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 1220313CD for ; Tue, 29 Apr 2025 07:14:47 -0400 (EDT) Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-124-qE760zy3P7OeHyS-DceQ_A-1; Tue, 29 Apr 2025 07:14:45 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 32DB61800374 for ; Tue, 29 Apr 2025 11:14:44 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.98]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3E3AB195608D; Tue, 29 Apr 2025 11:14:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1745925286; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BlM/Igi35HSrkqKSnQMT2+DK6N7imPHKmPbWqr6dpEA=; b=XorsUXNZOnJF1bIM5J8bRrV9/tDUzyheRob3mfyRS0gPImQPOjNjdlxHkfauWdSDeTuJPI jfK46HEkWWQD90Ra6q9+stwCZcv9Hbq3vDxH+vdntQQGCsi6L4Ds0RFUvrpA/8HMWmSAxy u+TWL3epludndTe+nTZhQM1vXpWAGZA= X-MC-Unique: qE760zy3P7OeHyS-DceQ_A-1 X-Mimecast-MFC-AGG-ID: qE760zy3P7OeHyS-DceQ_A_1745925284 To: devel@lists.libvirt.org Cc: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 18/20] storage: stop hardcoding LVM tool paths Date: Tue, 29 Apr 2025 12:14:18 +0100 Message-ID: <20250429111420.1748521-19-berrange@redhat.com> In-Reply-To: <20250429111420.1748521-1-berrange@redhat.com> References: <20250429111420.1748521-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: LQP_caNBchhxqV-yETxCCinmGbCc4UqZfplA6eTEr0g_1745925284 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: LX6V7WJQML765GFLUUFJJ6BJXGIVUBVU X-Message-ID-Hash: LX6V7WJQML765GFLUUFJJ6BJXGIVUBVU X-MailFrom: berrange@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: From: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9_via_Devel?= Reply-To: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1745925755612019000 Content-Type: text/plain; charset="utf-8" From: Daniel P. Berrang=C3=A9 Change the mesonm rules to always enable the LVM driver if on a Linux host, unless the meson options say not to. The virCommand APIs will return suitable runtime errors if the tools are not installed. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Peter Krempa --- meson.build | 30 +++++---------------------- src/locking/lock_driver_lockd.c | 4 ++-- src/storage/storage_backend_logical.c | 24 ++++++++++----------- 3 files changed, 19 insertions(+), 39 deletions(-) diff --git a/meson.build b/meson.build index 68b955a02c..e23777819d 100644 --- a/meson.build +++ b/meson.build @@ -1826,32 +1826,12 @@ if conf.has('WITH_LIBVIRTD') error('Need libiscsi for iscsi-direct storage driver') endif =20 - if not get_option('storage_lvm').disabled() + if not get_option('storage_lvm').disabled() and host_machine.system() = =3D=3D 'linux' lvm_enable =3D true - lvm_progs =3D [ - 'pvcreate', 'vgcreate', 'lvcreate', - 'pvremove', 'vgremove', 'lvremove', - 'lvchange', 'vgchange', 'vgscan', - 'pvs', 'vgs', 'lvs', - ] - foreach name : lvm_progs - set_variable( - '@0@_prog'.format(name), - find_program(name, required: get_option('storage_lvm'), dirs: libv= irt_sbin_path) - ) - if not get_variable('@0@_prog'.format(name)).found() - lvm_enable =3D false - endif - endforeach - - if lvm_enable - use_storage =3D true - conf.set('WITH_STORAGE_LVM', 1) - - foreach name : lvm_progs - conf.set_quoted(name.to_upper(), get_variable('@0@_prog'.format(na= me)).full_path()) - endforeach - endif + use_storage =3D true + conf.set('WITH_STORAGE_LVM', 1) + elif get_option('storage_lvm').enabled() + error('Linux host needed for LVM storage driver') endif =20 if not get_option('storage_mpath').disabled() and host_machine.system() = =3D=3D 'linux' and devmapper_dep.found() diff --git a/src/locking/lock_driver_lockd.c b/src/locking/lock_driver_lock= d.c index 0b6c720477..a3bb285eec 100644 --- a/src/locking/lock_driver_lockd.c +++ b/src/locking/lock_driver_lockd.c @@ -433,7 +433,7 @@ static int virLockManagerLockDaemonNew(virLockManager *= lock, } =20 =20 -#ifdef LVS +#ifdef __linux__ static int virLockManagerGetLVMKey(const char *path, char **key) @@ -446,7 +446,7 @@ virLockManagerGetLVMKey(const char *path, int ret =3D -1; g_autoptr(virCommand) cmd =3D NULL; =20 - cmd =3D virCommandNewArgList(LVS, "--noheadings", + cmd =3D virCommandNewArgList("lvs", "--noheadings", "--unbuffered", "--nosuffix", "--options", "uuid", path, NULL diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_ba= ckend_logical.c index 6acbc37f18..51e9337820 100644 --- a/src/storage/storage_backend_logical.c +++ b/src/storage/storage_backend_logical.c @@ -49,7 +49,7 @@ virStorageBackendLogicalSetActive(virStoragePoolObj *pool, g_autoptr(virCommand) cmd =3D NULL; int ret; =20 - cmd =3D virStorageBackendLogicalChangeCmd(VGCHANGE, def, on); + cmd =3D virStorageBackendLogicalChangeCmd("vgchange", def, on); =20 virObjectUnlock(pool); ret =3D virCommandRun(cmd, NULL); @@ -70,7 +70,7 @@ virStorageBackendLogicalRemoveDevice(const char *path) { g_autoptr(virCommand) cmd =3D NULL; =20 - cmd =3D virCommandNewArgList(PVREMOVE, path, NULL); + cmd =3D virCommandNewArgList("pvremove", path, NULL); if (virCommandRun(cmd, NULL) < 0) VIR_INFO("Failed to pvremove logical device '%s'", path); } @@ -100,7 +100,7 @@ virStorageBackendLogicalInitializeDevice(const char *pa= th) * Initialize the physical volume because vgcreate is not * clever enough todo this for us :-( */ - pvcmd =3D virCommandNewArgList(PVCREATE, path, NULL); + pvcmd =3D virCommandNewArgList("pvcreate", path, NULL); return virCommandRun(pvcmd, NULL); } =20 @@ -380,7 +380,7 @@ virStorageBackendLogicalFindLVs(virStoragePoolObj *pool, }; g_autoptr(virCommand) cmd =3D NULL; =20 - cmd =3D virCommandNewArgList(LVS, + cmd =3D virCommandNewArgList("lvs", "--separator", "#", "--noheadings", "--units", "b", @@ -483,11 +483,11 @@ virStorageBackendLogicalGetPoolSources(virStoragePool= SourceList *sourceList) * that might be hanging around, so if this fails for some reason, the * worst that happens is that scanning doesn't pick everything up */ - vgcmd =3D virCommandNew(VGSCAN); + vgcmd =3D virCommandNew("vgscan"); if (virCommandRun(vgcmd, NULL) < 0) VIR_WARN("Failure when running vgscan to refresh physical volumes"= ); =20 - pvcmd =3D virCommandNewArgList(PVS, + pvcmd =3D virCommandNewArgList("pvs", "--noheadings", "-o", "pv_name,vg_name", NULL, NULL); @@ -658,7 +658,7 @@ virStorageBackendLogicalBuildPool(virStoragePoolObj *po= ol, VIR_STORAGE_POOL_BUILD_NO_OVERWRITE, cleanup); =20 - vgcmd =3D virCommandNewArgList(VGCREATE, def->source.name, NULL); + vgcmd =3D virCommandNewArgList("vgcreate", def->source.name, NULL); =20 for (i =3D 0; i < def->source.ndevice; i++) { const char *path =3D def->source.devices[i].path; @@ -720,7 +720,7 @@ virStorageBackendLogicalRefreshPool(virStoragePoolObj *= pool) if (virStorageBackendLogicalFindLVs(pool, NULL) < 0) return -1; =20 - cmd =3D virCommandNewArgList(VGS, + cmd =3D virCommandNewArgList("vgs", "--separator", ":", "--noheadings", "--units", "b", @@ -769,7 +769,7 @@ virStorageBackendLogicalDeletePool(virStoragePoolObj *p= ool, virCheckFlags(0, -1); =20 /* first remove the volume group */ - cmd =3D virCommandNewArgList(VGREMOVE, + cmd =3D virCommandNewArgList("vgremove", "-f", def->source.name, NULL); if (virCommandRun(cmd, NULL) < 0) @@ -795,8 +795,8 @@ virStorageBackendLogicalDeleteVol(virStoragePoolObj *po= ol G_GNUC_UNUSED, =20 virWaitForDevices(); =20 - lvchange_cmd =3D virCommandNewArgList(LVCHANGE, "-aln", vol->target.pa= th, NULL); - lvremove_cmd =3D virCommandNewArgList(LVREMOVE, "-f", vol->target.path= , NULL); + lvchange_cmd =3D virCommandNewArgList("lvchange", "-aln", vol->target.= path, NULL); + lvremove_cmd =3D virCommandNewArgList("lvremove", "-f", vol->target.pa= th, NULL); =20 if (virCommandRun(lvremove_cmd, NULL) < 0) { if (virCommandRun(lvchange_cmd, NULL) < 0) { @@ -825,7 +825,7 @@ virStorageBackendLogicalLVCreate(virStorageVolDef *vol, return -1; } =20 - cmd =3D virCommandNewArgList(LVCREATE, + cmd =3D virCommandNewArgList("lvcreate", "--name", vol->name, NULL); virCommandAddArg(cmd, "-L"); --=20 2.49.0