From nobody Mon Apr 29 10:37:30 2024 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 1544717874964752.542169607265; Thu, 13 Dec 2018 08:17:54 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EF4EA3164669; Thu, 13 Dec 2018 16:17:52 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8C7025D6A9; Thu, 13 Dec 2018 16:17:51 +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 5EE89181B9E5; Thu, 13 Dec 2018 16:17:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wBDGHnAC026236 for ; Thu, 13 Dec 2018 11:17:49 -0500 Received: by smtp.corp.redhat.com (Postfix) id BF5BB60C67; Thu, 13 Dec 2018 16:17:49 +0000 (UTC) Received: from unknown54ee7586bd10.attlocal.net.com (ovpn-116-170.phx2.redhat.com [10.3.116.170]) by smtp.corp.redhat.com (Postfix) with ESMTP id 792E860C6B for ; Thu, 13 Dec 2018 16:17:49 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Thu, 13 Dec 2018 11:17:40 -0500 Message-Id: <20181213161740.31041-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] storage: Fix build issue with MOUNT and VGCHANGE commands 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Thu, 13 Dec 2018 16:17:53 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Turns out there some build platforms that must not define MOUNT or VGCHANGE in config.h... So moving the commands from the storage backend specific module into a common storage_util module causes issues for those platforms. So instead of assuming they are there, let's just pass the command string to the storage util API's from the storage backend specific code (as would have been successful before). Also modify the test to determine whether the MOUNT and/or VGCHANGE doesn't exist and just define it to (for example) what Fedora has for the path. Could have just used "mount" and "vgchange" in the call, but that defeats the purpose of adding the call to virTestClearCommandPath. Signed-off-by: John Ferlan --- Although it is a build breaker I figured I'd wait before pushing to ensure no one had heartburn over my selected solution of just restoring the onus of the MOUNT and VGCHANGE back to the storage backend specific module as opposed to trying to use #ifdef's in the common module and of course the testing code. This just seemed to be the path of least resistance. src/storage/storage_backend_fs.c | 2 +- src/storage/storage_backend_logical.c | 2 +- src/storage/storage_util.c | 10 ++++++---- src/storage/storage_util.h | 6 ++++-- tests/storagepoolxml2argvtest.c | 11 +++++++++-- 5 files changed, 21 insertions(+), 10 deletions(-) diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend= _fs.c index c5e75627b5..37feff79d1 100644 --- a/src/storage/storage_backend_fs.c +++ b/src/storage/storage_backend_fs.c @@ -330,7 +330,7 @@ virStorageBackendFileSystemMount(virStoragePoolObjPtr p= ool) if (!(src =3D virStorageBackendFileSystemGetPoolSource(pool))) return -1; =20 - cmd =3D virStorageBackendFileSystemMountCmd(def, src); + cmd =3D virStorageBackendFileSystemMountCmd(MOUNT, def, src); if (virCommandRun(cmd, NULL) < 0) goto cleanup; =20 diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_ba= ckend_logical.c index 12fff651e8..0059e24308 100644 --- a/src/storage/storage_backend_logical.c +++ b/src/storage/storage_backend_logical.c @@ -52,7 +52,7 @@ virStorageBackendLogicalSetActive(virStoragePoolObjPtr po= ol, { int ret; virStoragePoolDefPtr def =3D virStoragePoolObjGetDef(pool); - virCommandPtr cmd =3D virStorageBackendLogicalChangeCmd(def, on); + virCommandPtr cmd =3D virStorageBackendLogicalChangeCmd(VGCHANGE, def,= on); =20 ret =3D virCommandRun(cmd, NULL); virCommandFree(cmd); diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c index 01f3c93008..a84ee5b600 100644 --- a/src/storage/storage_util.c +++ b/src/storage/storage_util.c @@ -4312,7 +4312,8 @@ virStorageBackendFileSystemMountDefaultArgs(virComman= dPtr cmd, =20 =20 virCommandPtr -virStorageBackendFileSystemMountCmd(virStoragePoolDefPtr def, +virStorageBackendFileSystemMountCmd(const char *cmdstr, + virStoragePoolDefPtr def, const char *src) { /* 'mount -t auto' doesn't seem to auto determine nfs (or cifs), @@ -4326,7 +4327,7 @@ virStorageBackendFileSystemMountCmd(virStoragePoolDef= Ptr def, def->source.format =3D=3D VIR_STORAGE_POOL_NETFS_CIFS); virCommandPtr cmd =3D NULL; =20 - cmd =3D virCommandNew(MOUNT); + cmd =3D virCommandNew(cmdstr); if (netauto) virStorageBackendFileSystemMountNFSArgs(cmd, src, def); else if (glusterfs) @@ -4340,10 +4341,11 @@ virStorageBackendFileSystemMountCmd(virStoragePoolD= efPtr def, =20 =20 virCommandPtr -virStorageBackendLogicalChangeCmd(virStoragePoolDefPtr def, +virStorageBackendLogicalChangeCmd(const char *cmdstr, + virStoragePoolDefPtr def, bool on) { - return virCommandNewArgList(VGCHANGE, + return virCommandNewArgList(cmdstr, on ? "-aly" : "-aln", def->source.name, NULL); diff --git a/src/storage/storage_util.h b/src/storage/storage_util.h index a2ef2ac07d..d0cb5d9884 100644 --- a/src/storage/storage_util.h +++ b/src/storage/storage_util.h @@ -181,11 +181,13 @@ char * virStorageBackendFileSystemGetPoolSource(virStoragePoolObjPtr pool); =20 virCommandPtr -virStorageBackendFileSystemMountCmd(virStoragePoolDefPtr def, +virStorageBackendFileSystemMountCmd(const char *cmdstr, + virStoragePoolDefPtr def, const char *src); =20 virCommandPtr -virStorageBackendLogicalChangeCmd(virStoragePoolDefPtr def, +virStorageBackendLogicalChangeCmd(const char *cmdstr, + virStoragePoolDefPtr def, bool on); =20 #endif /* __VIR_STORAGE_UTIL_H__ */ diff --git a/tests/storagepoolxml2argvtest.c b/tests/storagepoolxml2argvtes= t.c index 534cb21144..196989cb6d 100644 --- a/tests/storagepoolxml2argvtest.c +++ b/tests/storagepoolxml2argvtest.c @@ -9,6 +9,13 @@ =20 #define VIR_FROM_THIS VIR_FROM_NONE =20 +#ifndef MOUNT +# define MOUNT "/usr/bin/mount" +#endif + +#ifndef VGCHANGE +# define VGCHANGE "/usr/sbin/vgchange" +#endif =20 static int testCompareXMLToArgvFiles(bool shouldFail, @@ -40,11 +47,11 @@ testCompareXMLToArgvFiles(bool shouldFail, goto cleanup; } =20 - cmd =3D virStorageBackendFileSystemMountCmd(def, src); + cmd =3D virStorageBackendFileSystemMountCmd(MOUNT, def, src); break; =20 case VIR_STORAGE_POOL_LOGICAL: - cmd =3D virStorageBackendLogicalChangeCmd(def, true); + cmd =3D virStorageBackendLogicalChangeCmd(VGCHANGE, def, true); break; =20 case VIR_STORAGE_POOL_DIR: --=20 2.17.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list