|
|
99cbc7 |
From e6545c2acc9a3626572cbf937c1d7eba62362e3b Mon Sep 17 00:00:00 2001
|
|
|
99cbc7 |
Message-Id: <e6545c2acc9a3626572cbf937c1d7eba62362e3b@dist-git>
|
|
|
99cbc7 |
From: John Ferlan <jferlan@redhat.com>
|
|
|
99cbc7 |
Date: Wed, 3 Apr 2019 09:12:18 -0400
|
|
|
99cbc7 |
Subject: [PATCH] storage: Rework virStorageBackendFileSystemMountCmd
|
|
|
99cbc7 |
MIME-Version: 1.0
|
|
|
99cbc7 |
Content-Type: text/plain; charset=UTF-8
|
|
|
99cbc7 |
Content-Transfer-Encoding: 8bit
|
|
|
99cbc7 |
|
|
|
99cbc7 |
https://bugzilla.redhat.com/show_bug.cgi?id=1584663
|
|
|
99cbc7 |
|
|
|
99cbc7 |
Let's create helpers for each style of command line created. This
|
|
|
99cbc7 |
primarily is easier on the eyes rather than the large multi line
|
|
|
99cbc7 |
if-then-else-else clause used, but may also be useful if in the
|
|
|
99cbc7 |
future any particular pool needs to add to the command line based
|
|
|
99cbc7 |
on pool xml format.
|
|
|
99cbc7 |
|
|
|
99cbc7 |
Signed-off-by: John Ferlan <jferlan@redhat.com>
|
|
|
99cbc7 |
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
99cbc7 |
(cherry picked from commit b663d4329ca844b1bdb536acaa2ae338bf435f74)
|
|
|
99cbc7 |
Message-Id: <20190403131219.16385-7-jferlan@redhat.com>
|
|
|
99cbc7 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
99cbc7 |
---
|
|
|
99cbc7 |
src/storage/storage_util.c | 84 +++++++++++++++++++++++++-------------
|
|
|
99cbc7 |
1 file changed, 55 insertions(+), 29 deletions(-)
|
|
|
99cbc7 |
|
|
|
99cbc7 |
diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c
|
|
|
99cbc7 |
index ccbc2c925c..70ce600581 100644
|
|
|
99cbc7 |
--- a/src/storage/storage_util.c
|
|
|
99cbc7 |
+++ b/src/storage/storage_util.c
|
|
|
99cbc7 |
@@ -4245,6 +4245,56 @@ virStorageBackendFileSystemGetPoolSource(virStoragePoolObjPtr pool)
|
|
|
99cbc7 |
}
|
|
|
99cbc7 |
|
|
|
99cbc7 |
|
|
|
99cbc7 |
+static void
|
|
|
99cbc7 |
+virStorageBackendFileSystemMountNFSArgs(virCommandPtr cmd,
|
|
|
99cbc7 |
+ const char *src,
|
|
|
99cbc7 |
+ virStoragePoolDefPtr def)
|
|
|
99cbc7 |
+{
|
|
|
99cbc7 |
+ virCommandAddArgList(cmd, src, def->target.path, NULL);
|
|
|
99cbc7 |
+}
|
|
|
99cbc7 |
+
|
|
|
99cbc7 |
+
|
|
|
99cbc7 |
+static void
|
|
|
99cbc7 |
+virStorageBackendFileSystemMountGlusterArgs(virCommandPtr cmd,
|
|
|
99cbc7 |
+ const char *src,
|
|
|
99cbc7 |
+ virStoragePoolDefPtr def)
|
|
|
99cbc7 |
+{
|
|
|
99cbc7 |
+ const char *fmt;
|
|
|
99cbc7 |
+
|
|
|
99cbc7 |
+ fmt = virStoragePoolFormatFileSystemNetTypeToString(def->source.format);
|
|
|
99cbc7 |
+ virCommandAddArgList(cmd, "-t", fmt, src, "-o", "direct-io-mode=1",
|
|
|
99cbc7 |
+ def->target.path, NULL);
|
|
|
99cbc7 |
+}
|
|
|
99cbc7 |
+
|
|
|
99cbc7 |
+
|
|
|
99cbc7 |
+static void
|
|
|
99cbc7 |
+virStorageBackendFileSystemMountCIFSArgs(virCommandPtr cmd,
|
|
|
99cbc7 |
+ const char *src,
|
|
|
99cbc7 |
+ virStoragePoolDefPtr def)
|
|
|
99cbc7 |
+{
|
|
|
99cbc7 |
+ const char *fmt;
|
|
|
99cbc7 |
+
|
|
|
99cbc7 |
+ fmt = virStoragePoolFormatFileSystemNetTypeToString(def->source.format);
|
|
|
99cbc7 |
+ virCommandAddArgList(cmd, "-t", fmt, src, def->target.path,
|
|
|
99cbc7 |
+ "-o", "guest", NULL);
|
|
|
99cbc7 |
+}
|
|
|
99cbc7 |
+
|
|
|
99cbc7 |
+
|
|
|
99cbc7 |
+static void
|
|
|
99cbc7 |
+virStorageBackendFileSystemMountDefaultArgs(virCommandPtr cmd,
|
|
|
99cbc7 |
+ const char *src,
|
|
|
99cbc7 |
+ virStoragePoolDefPtr def)
|
|
|
99cbc7 |
+{
|
|
|
99cbc7 |
+ const char *fmt;
|
|
|
99cbc7 |
+
|
|
|
99cbc7 |
+ if (def->type == VIR_STORAGE_POOL_FS)
|
|
|
99cbc7 |
+ fmt = virStoragePoolFormatFileSystemTypeToString(def->source.format);
|
|
|
99cbc7 |
+ else
|
|
|
99cbc7 |
+ fmt = virStoragePoolFormatFileSystemNetTypeToString(def->source.format);
|
|
|
99cbc7 |
+ virCommandAddArgList(cmd, "-t", fmt, src, def->target.path, NULL);
|
|
|
99cbc7 |
+}
|
|
|
99cbc7 |
+
|
|
|
99cbc7 |
+
|
|
|
99cbc7 |
virCommandPtr
|
|
|
99cbc7 |
virStorageBackendFileSystemMountCmd(virStoragePoolDefPtr def,
|
|
|
99cbc7 |
const char *src)
|
|
|
99cbc7 |
@@ -4260,38 +4310,14 @@ virStorageBackendFileSystemMountCmd(virStoragePoolDefPtr def,
|
|
|
99cbc7 |
def->source.format == VIR_STORAGE_POOL_NETFS_CIFS);
|
|
|
99cbc7 |
virCommandPtr cmd = NULL;
|
|
|
99cbc7 |
|
|
|
99cbc7 |
+ cmd = virCommandNew(MOUNT);
|
|
|
99cbc7 |
if (netauto)
|
|
|
99cbc7 |
- cmd = virCommandNewArgList(MOUNT,
|
|
|
99cbc7 |
- src,
|
|
|
99cbc7 |
- def->target.path,
|
|
|
99cbc7 |
- NULL);
|
|
|
99cbc7 |
+ virStorageBackendFileSystemMountNFSArgs(cmd, src, def);
|
|
|
99cbc7 |
else if (glusterfs)
|
|
|
99cbc7 |
- cmd = virCommandNewArgList(MOUNT,
|
|
|
99cbc7 |
- "-t",
|
|
|
99cbc7 |
- virStoragePoolFormatFileSystemNetTypeToString(def->source.format),
|
|
|
99cbc7 |
- src,
|
|
|
99cbc7 |
- "-o",
|
|
|
99cbc7 |
- "direct-io-mode=1",
|
|
|
99cbc7 |
- def->target.path,
|
|
|
99cbc7 |
- NULL);
|
|
|
99cbc7 |
+ virStorageBackendFileSystemMountGlusterArgs(cmd, src, def);
|
|
|
99cbc7 |
else if (cifsfs)
|
|
|
99cbc7 |
- cmd = virCommandNewArgList(MOUNT,
|
|
|
99cbc7 |
- "-t",
|
|
|
99cbc7 |
- virStoragePoolFormatFileSystemNetTypeToString(def->source.format),
|
|
|
99cbc7 |
- src,
|
|
|
99cbc7 |
- def->target.path,
|
|
|
99cbc7 |
- "-o",
|
|
|
99cbc7 |
- "guest",
|
|
|
99cbc7 |
- NULL);
|
|
|
99cbc7 |
+ virStorageBackendFileSystemMountCIFSArgs(cmd, src, def);
|
|
|
99cbc7 |
else
|
|
|
99cbc7 |
- cmd = virCommandNewArgList(MOUNT,
|
|
|
99cbc7 |
- "-t",
|
|
|
99cbc7 |
- (def->type == VIR_STORAGE_POOL_FS ?
|
|
|
99cbc7 |
- virStoragePoolFormatFileSystemTypeToString(def->source.format) :
|
|
|
99cbc7 |
- virStoragePoolFormatFileSystemNetTypeToString(def->source.format)),
|
|
|
99cbc7 |
- src,
|
|
|
99cbc7 |
- def->target.path,
|
|
|
99cbc7 |
- NULL);
|
|
|
99cbc7 |
-
|
|
|
99cbc7 |
+ virStorageBackendFileSystemMountDefaultArgs(cmd, src, def);
|
|
|
99cbc7 |
return cmd;
|
|
|
99cbc7 |
}
|
|
|
99cbc7 |
--
|
|
|
99cbc7 |
2.21.0
|
|
|
99cbc7 |
|