|
|
0a7476 |
From 648ffa72001e1bb6d26a71f4a0be38042bab9242 Mon Sep 17 00:00:00 2001
|
|
|
0a7476 |
Message-Id: <648ffa72001e1bb6d26a71f4a0be38042bab9242@dist-git>
|
|
|
0a7476 |
From: John Ferlan <jferlan@redhat.com>
|
|
|
0a7476 |
Date: Wed, 3 Apr 2019 09:12:14 -0400
|
|
|
0a7476 |
Subject: [PATCH] storage: Move FS backend mount creation command helper
|
|
|
0a7476 |
MIME-Version: 1.0
|
|
|
0a7476 |
Content-Type: text/plain; charset=UTF-8
|
|
|
0a7476 |
Content-Transfer-Encoding: 8bit
|
|
|
0a7476 |
|
|
|
0a7476 |
https://bugzilla.redhat.com/show_bug.cgi?id=1584663
|
|
|
0a7476 |
|
|
|
0a7476 |
Move virStorageBackendFileSystemMountCmd to storage_util so that
|
|
|
0a7476 |
it can be used by the test harness.
|
|
|
0a7476 |
|
|
|
0a7476 |
Signed-off-by: John Ferlan <jferlan@redhat.com>
|
|
|
0a7476 |
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
0a7476 |
(cherry picked from commit 728b9ed61abe3fea101dd4dddddeb9a530babc6a)
|
|
|
0a7476 |
Message-Id: <20190403131219.16385-3-jferlan@redhat.com>
|
|
|
0a7476 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
0a7476 |
---
|
|
|
0a7476 |
src/storage/storage_backend_fs.c | 52 --------------------------------
|
|
|
0a7476 |
src/storage/storage_util.c | 52 ++++++++++++++++++++++++++++++++
|
|
|
0a7476 |
src/storage/storage_util.h | 4 +++
|
|
|
0a7476 |
3 files changed, 56 insertions(+), 52 deletions(-)
|
|
|
0a7476 |
|
|
|
0a7476 |
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
|
|
|
0a7476 |
index 4015271419..4acdb43e0d 100644
|
|
|
0a7476 |
--- a/src/storage/storage_backend_fs.c
|
|
|
0a7476 |
+++ b/src/storage/storage_backend_fs.c
|
|
|
0a7476 |
@@ -334,58 +334,6 @@ virStorageBackendFileSystemIsMounted(virStoragePoolObjPtr pool)
|
|
|
0a7476 |
}
|
|
|
0a7476 |
|
|
|
0a7476 |
|
|
|
0a7476 |
-static virCommandPtr
|
|
|
0a7476 |
-virStorageBackendFileSystemMountCmd(virStoragePoolDefPtr def,
|
|
|
0a7476 |
- const char *src)
|
|
|
0a7476 |
-{
|
|
|
0a7476 |
- /* 'mount -t auto' doesn't seem to auto determine nfs (or cifs),
|
|
|
0a7476 |
- * while plain 'mount' does. We have to craft separate argvs to
|
|
|
0a7476 |
- * accommodate this */
|
|
|
0a7476 |
- bool netauto = (def->type == VIR_STORAGE_POOL_NETFS &&
|
|
|
0a7476 |
- def->source.format == VIR_STORAGE_POOL_NETFS_AUTO);
|
|
|
0a7476 |
- bool glusterfs = (def->type == VIR_STORAGE_POOL_NETFS &&
|
|
|
0a7476 |
- def->source.format == VIR_STORAGE_POOL_NETFS_GLUSTERFS);
|
|
|
0a7476 |
- bool cifsfs = (def->type == VIR_STORAGE_POOL_NETFS &&
|
|
|
0a7476 |
- def->source.format == VIR_STORAGE_POOL_NETFS_CIFS);
|
|
|
0a7476 |
- virCommandPtr cmd = NULL;
|
|
|
0a7476 |
-
|
|
|
0a7476 |
- if (netauto)
|
|
|
0a7476 |
- cmd = virCommandNewArgList(MOUNT,
|
|
|
0a7476 |
- src,
|
|
|
0a7476 |
- def->target.path,
|
|
|
0a7476 |
- NULL);
|
|
|
0a7476 |
- else if (glusterfs)
|
|
|
0a7476 |
- cmd = virCommandNewArgList(MOUNT,
|
|
|
0a7476 |
- "-t",
|
|
|
0a7476 |
- virStoragePoolFormatFileSystemNetTypeToString(def->source.format),
|
|
|
0a7476 |
- src,
|
|
|
0a7476 |
- "-o",
|
|
|
0a7476 |
- "direct-io-mode=1",
|
|
|
0a7476 |
- def->target.path,
|
|
|
0a7476 |
- NULL);
|
|
|
0a7476 |
- else if (cifsfs)
|
|
|
0a7476 |
- cmd = virCommandNewArgList(MOUNT,
|
|
|
0a7476 |
- "-t",
|
|
|
0a7476 |
- virStoragePoolFormatFileSystemNetTypeToString(def->source.format),
|
|
|
0a7476 |
- src,
|
|
|
0a7476 |
- def->target.path,
|
|
|
0a7476 |
- "-o",
|
|
|
0a7476 |
- "guest",
|
|
|
0a7476 |
- NULL);
|
|
|
0a7476 |
- else
|
|
|
0a7476 |
- cmd = virCommandNewArgList(MOUNT,
|
|
|
0a7476 |
- "-t",
|
|
|
0a7476 |
- (def->type == VIR_STORAGE_POOL_FS ?
|
|
|
0a7476 |
- virStoragePoolFormatFileSystemTypeToString(def->source.format) :
|
|
|
0a7476 |
- virStoragePoolFormatFileSystemNetTypeToString(def->source.format)),
|
|
|
0a7476 |
- src,
|
|
|
0a7476 |
- def->target.path,
|
|
|
0a7476 |
- NULL);
|
|
|
0a7476 |
-
|
|
|
0a7476 |
- return cmd;
|
|
|
0a7476 |
-}
|
|
|
0a7476 |
-
|
|
|
0a7476 |
-
|
|
|
0a7476 |
/**
|
|
|
0a7476 |
* @pool storage pool to mount
|
|
|
0a7476 |
*
|
|
|
0a7476 |
diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c
|
|
|
0a7476 |
index 637b90fac1..327b500b6b 100644
|
|
|
0a7476 |
--- a/src/storage/storage_util.c
|
|
|
0a7476 |
+++ b/src/storage/storage_util.c
|
|
|
0a7476 |
@@ -4210,3 +4210,55 @@ virStorageBackendZeroPartitionTable(const char *path,
|
|
|
0a7476 |
return storageBackendVolWipeLocalFile(path, VIR_STORAGE_VOL_WIPE_ALG_ZERO,
|
|
|
0a7476 |
size, true);
|
|
|
0a7476 |
}
|
|
|
0a7476 |
+
|
|
|
0a7476 |
+
|
|
|
0a7476 |
+virCommandPtr
|
|
|
0a7476 |
+virStorageBackendFileSystemMountCmd(virStoragePoolDefPtr def,
|
|
|
0a7476 |
+ const char *src)
|
|
|
0a7476 |
+{
|
|
|
0a7476 |
+ /* 'mount -t auto' doesn't seem to auto determine nfs (or cifs),
|
|
|
0a7476 |
+ * while plain 'mount' does. We have to craft separate argvs to
|
|
|
0a7476 |
+ * accommodate this */
|
|
|
0a7476 |
+ bool netauto = (def->type == VIR_STORAGE_POOL_NETFS &&
|
|
|
0a7476 |
+ def->source.format == VIR_STORAGE_POOL_NETFS_AUTO);
|
|
|
0a7476 |
+ bool glusterfs = (def->type == VIR_STORAGE_POOL_NETFS &&
|
|
|
0a7476 |
+ def->source.format == VIR_STORAGE_POOL_NETFS_GLUSTERFS);
|
|
|
0a7476 |
+ bool cifsfs = (def->type == VIR_STORAGE_POOL_NETFS &&
|
|
|
0a7476 |
+ def->source.format == VIR_STORAGE_POOL_NETFS_CIFS);
|
|
|
0a7476 |
+ virCommandPtr cmd = NULL;
|
|
|
0a7476 |
+
|
|
|
0a7476 |
+ if (netauto)
|
|
|
0a7476 |
+ cmd = virCommandNewArgList(MOUNT,
|
|
|
0a7476 |
+ src,
|
|
|
0a7476 |
+ def->target.path,
|
|
|
0a7476 |
+ NULL);
|
|
|
0a7476 |
+ else if (glusterfs)
|
|
|
0a7476 |
+ cmd = virCommandNewArgList(MOUNT,
|
|
|
0a7476 |
+ "-t",
|
|
|
0a7476 |
+ virStoragePoolFormatFileSystemNetTypeToString(def->source.format),
|
|
|
0a7476 |
+ src,
|
|
|
0a7476 |
+ "-o",
|
|
|
0a7476 |
+ "direct-io-mode=1",
|
|
|
0a7476 |
+ def->target.path,
|
|
|
0a7476 |
+ NULL);
|
|
|
0a7476 |
+ else if (cifsfs)
|
|
|
0a7476 |
+ cmd = virCommandNewArgList(MOUNT,
|
|
|
0a7476 |
+ "-t",
|
|
|
0a7476 |
+ virStoragePoolFormatFileSystemNetTypeToString(def->source.format),
|
|
|
0a7476 |
+ src,
|
|
|
0a7476 |
+ def->target.path,
|
|
|
0a7476 |
+ "-o",
|
|
|
0a7476 |
+ "guest",
|
|
|
0a7476 |
+ NULL);
|
|
|
0a7476 |
+ else
|
|
|
0a7476 |
+ cmd = virCommandNewArgList(MOUNT,
|
|
|
0a7476 |
+ "-t",
|
|
|
0a7476 |
+ (def->type == VIR_STORAGE_POOL_FS ?
|
|
|
0a7476 |
+ virStoragePoolFormatFileSystemTypeToString(def->source.format) :
|
|
|
0a7476 |
+ virStoragePoolFormatFileSystemNetTypeToString(def->source.format)),
|
|
|
0a7476 |
+ src,
|
|
|
0a7476 |
+ def->target.path,
|
|
|
0a7476 |
+ NULL);
|
|
|
0a7476 |
+
|
|
|
0a7476 |
+ return cmd;
|
|
|
0a7476 |
+}
|
|
|
0a7476 |
diff --git a/src/storage/storage_util.h b/src/storage/storage_util.h
|
|
|
0a7476 |
index 58b991c772..5b0baf56c4 100644
|
|
|
0a7476 |
--- a/src/storage/storage_util.h
|
|
|
0a7476 |
+++ b/src/storage/storage_util.h
|
|
|
0a7476 |
@@ -177,4 +177,8 @@ int
|
|
|
0a7476 |
virStorageBackendZeroPartitionTable(const char *path,
|
|
|
0a7476 |
unsigned long long size);
|
|
|
0a7476 |
|
|
|
0a7476 |
+virCommandPtr
|
|
|
0a7476 |
+virStorageBackendFileSystemMountCmd(virStoragePoolDefPtr def,
|
|
|
0a7476 |
+ const char *src);
|
|
|
0a7476 |
+
|
|
|
0a7476 |
#endif /* __VIR_STORAGE_UTIL_H__ */
|
|
|
0a7476 |
--
|
|
|
0a7476 |
2.21.0
|
|
|
0a7476 |
|