From nobody Sun Feb 8 14:12:36 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 1543942048614161.60161080414753; Tue, 4 Dec 2018 08:47:28 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C0BBC5F; Tue, 4 Dec 2018 16:47: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 2855B1054FC9; Tue, 4 Dec 2018 16:47: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 2BFA04EA3B; Tue, 4 Dec 2018 16:47:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wB4GlLoQ022368 for ; Tue, 4 Dec 2018 11:47:21 -0500 Received: by smtp.corp.redhat.com (Postfix) id 05CB517AC0; Tue, 4 Dec 2018 16:47:21 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-18.phx2.redhat.com [10.3.116.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id B74A35DD8A for ; Tue, 4 Dec 2018 16:47:20 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Tue, 4 Dec 2018 11:47:11 -0500 Message-Id: <20181204164717.5013-3-jferlan@redhat.com> In-Reply-To: <20181204164717.5013-1-jferlan@redhat.com> References: <20181204164717.5013-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/8] storage: Move FS backend mount creation command helper 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.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 04 Dec 2018 16:47:26 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Move virStorageBackendFileSystemMountCmd to storage_util so that it can be used by the test harness. Signed-off-by: John Ferlan --- src/storage/storage_backend_fs.c | 52 -------------------------------- src/storage/storage_util.c | 52 ++++++++++++++++++++++++++++++++ src/storage/storage_util.h | 4 +++ 3 files changed, 56 insertions(+), 52 deletions(-) diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend= _fs.c index 4bf411b330..b341ba84fa 100644 --- a/src/storage/storage_backend_fs.c +++ b/src/storage/storage_backend_fs.c @@ -331,58 +331,6 @@ virStorageBackendFileSystemIsMounted(virStoragePoolObj= Ptr pool) } =20 =20 -static virCommandPtr -virStorageBackendFileSystemMountCmd(virStoragePoolDefPtr def, - const char *src) -{ - /* 'mount -t auto' doesn't seem to auto determine nfs (or cifs), - * while plain 'mount' does. We have to craft separate argvs to - * accommodate this */ - bool netauto =3D (def->type =3D=3D VIR_STORAGE_POOL_NETFS && - def->source.format =3D=3D VIR_STORAGE_POOL_NETFS_AUTO); - bool glusterfs =3D (def->type =3D=3D VIR_STORAGE_POOL_NETFS && - def->source.format =3D=3D VIR_STORAGE_POOL_NETFS_GLU= STERFS); - bool cifsfs =3D (def->type =3D=3D VIR_STORAGE_POOL_NETFS && - def->source.format =3D=3D VIR_STORAGE_POOL_NETFS_CIFS); - virCommandPtr cmd =3D NULL; - - if (netauto) - cmd =3D virCommandNewArgList(MOUNT, - src, - def->target.path, - NULL); - else if (glusterfs) - cmd =3D virCommandNewArgList(MOUNT, - "-t", - virStoragePoolFormatFileSystemNetTypeTo= String(def->source.format), - src, - "-o", - "direct-io-mode=3D1", - def->target.path, - NULL); - else if (cifsfs) - cmd =3D virCommandNewArgList(MOUNT, - "-t", - virStoragePoolFormatFileSystemNetTypeTo= String(def->source.format), - src, - def->target.path, - "-o", - "guest", - NULL); - else - cmd =3D virCommandNewArgList(MOUNT, - "-t", - (def->type =3D=3D VIR_STORAGE_POOL_FS ? - virStoragePoolFormatFileSystemTypeToSt= ring(def->source.format) : - virStoragePoolFormatFileSystemNetTypeT= oString(def->source.format)), - src, - def->target.path, - NULL); - - return cmd; -} - - /** * @pool storage pool to mount * diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c index 318a556656..180d7b1fa3 100644 --- a/src/storage/storage_util.c +++ b/src/storage/storage_util.c @@ -4226,3 +4226,55 @@ virStorageBackendZeroPartitionTable(const char *path, return storageBackendVolWipeLocalFile(path, VIR_STORAGE_VOL_WIPE_ALG_Z= ERO, size, true); } + + +virCommandPtr +virStorageBackendFileSystemMountCmd(virStoragePoolDefPtr def, + const char *src) +{ + /* 'mount -t auto' doesn't seem to auto determine nfs (or cifs), + * while plain 'mount' does. We have to craft separate argvs to + * accommodate this */ + bool netauto =3D (def->type =3D=3D VIR_STORAGE_POOL_NETFS && + def->source.format =3D=3D VIR_STORAGE_POOL_NETFS_AUTO); + bool glusterfs =3D (def->type =3D=3D VIR_STORAGE_POOL_NETFS && + def->source.format =3D=3D VIR_STORAGE_POOL_NETFS_GLU= STERFS); + bool cifsfs =3D (def->type =3D=3D VIR_STORAGE_POOL_NETFS && + def->source.format =3D=3D VIR_STORAGE_POOL_NETFS_CIFS); + virCommandPtr cmd =3D NULL; + + if (netauto) + cmd =3D virCommandNewArgList(MOUNT, + src, + def->target.path, + NULL); + else if (glusterfs) + cmd =3D virCommandNewArgList(MOUNT, + "-t", + virStoragePoolFormatFileSystemNetTypeTo= String(def->source.format), + src, + "-o", + "direct-io-mode=3D1", + def->target.path, + NULL); + else if (cifsfs) + cmd =3D virCommandNewArgList(MOUNT, + "-t", + virStoragePoolFormatFileSystemNetTypeTo= String(def->source.format), + src, + def->target.path, + "-o", + "guest", + NULL); + else + cmd =3D virCommandNewArgList(MOUNT, + "-t", + (def->type =3D=3D VIR_STORAGE_POOL_FS ? + virStoragePoolFormatFileSystemTypeToSt= ring(def->source.format) : + virStoragePoolFormatFileSystemNetTypeT= oString(def->source.format)), + src, + def->target.path, + NULL); + + return cmd; +} diff --git a/src/storage/storage_util.h b/src/storage/storage_util.h index 58b991c772..5b0baf56c4 100644 --- a/src/storage/storage_util.h +++ b/src/storage/storage_util.h @@ -177,4 +177,8 @@ int virStorageBackendZeroPartitionTable(const char *path, unsigned long long size); =20 +virCommandPtr +virStorageBackendFileSystemMountCmd(virStoragePoolDefPtr def, + const char *src); + #endif /* __VIR_STORAGE_UTIL_H__ */ --=20 2.17.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list