Skip to content

Commit b9a9acf

Browse files
author
Matthew Farrellee
committed
Allow for conf-based control of auto-mounting glusterfs volume
Introduce a fs.glusterfs.automount configuration parameter, defaulting to true, which when set to false will skip exec(mount ...) during initialization. Signed-off-by: Matthew Farrellee <[email protected]>
1 parent df6da46 commit b9a9acf

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/main/java/org/apache/hadoop/fs/glusterfs/GlusterFileSystem.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ public void initialize(URI uri, Configuration conf) throws IOException {
101101
String volName = null;
102102
String remoteGFSServer = null;
103103
String needQuickRead = null;
104+
boolean autoMount = true;
104105

105106
if (this.mounted)
106107
return;
@@ -112,15 +113,18 @@ public void initialize(URI uri, Configuration conf) throws IOException {
112113
glusterMount = conf.get("fs.glusterfs.mount", null);
113114
remoteGFSServer = conf.get("fs.glusterfs.server", null);
114115
needQuickRead = conf.get("quick.slave.io", null);
116+
autoMount = conf.getBoolean("fs.glusterfs.automount", true);
115117

116118
if ((volName.length() == 0) || (remoteGFSServer.length() == 0)
117119
|| (glusterMount.length() == 0))
118120
throw new RuntimeException("Not enough info to mount FUSE: volname="+volName + " glustermount=" + glusterMount);
119121

120-
121-
ret = FUSEMount(volName, remoteGFSServer, glusterMount);
122-
if (!ret) {
123-
throw new RuntimeException("Initialize: Failed to mount GlusterFS ");
122+
123+
if (autoMount) {
124+
ret = FUSEMount(volName, remoteGFSServer, glusterMount);
125+
if (!ret) {
126+
throw new RuntimeException("Initialize: Failed to mount GlusterFS ");
127+
}
124128
}
125129

126130
if((needQuickRead.length() != 0)

0 commit comments

Comments
 (0)