Skip to content

Commit 9b24072

Browse files
committed
Merge pull request #6 from mattf/configurable-automount
Allow for conf-based control of auto-mounting glusterfs volume
2 parents 2c5a455 + b9a9acf commit 9b24072

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
@@ -108,6 +108,7 @@ public void initialize(URI uri, Configuration conf) throws IOException {
108108
String volName = null;
109109
String remoteGFSServer = null;
110110
String needQuickRead = null;
111+
boolean autoMount = true;
111112

112113
if (this.mounted)
113114
return;
@@ -119,15 +120,18 @@ public void initialize(URI uri, Configuration conf) throws IOException {
119120
glusterMount = conf.get("fs.glusterfs.mount", null);
120121
remoteGFSServer = conf.get("fs.glusterfs.server", null);
121122
needQuickRead = conf.get("quick.slave.io", null);
123+
autoMount = conf.getBoolean("fs.glusterfs.automount", true);
122124

123125
if ((volName.length() == 0) || (remoteGFSServer.length() == 0)
124126
|| (glusterMount.length() == 0))
125127
throw new RuntimeException("Not enough info to mount FUSE: volname="+volName + " glustermount=" + glusterMount);
126128

127-
128-
ret = FUSEMount(volName, remoteGFSServer, glusterMount);
129-
if (!ret) {
130-
throw new RuntimeException("Initialize: Failed to mount GlusterFS ");
129+
130+
if (autoMount) {
131+
ret = FUSEMount(volName, remoteGFSServer, glusterMount);
132+
if (!ret) {
133+
throw new RuntimeException("Initialize: Failed to mount GlusterFS ");
134+
}
131135
}
132136

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

0 commit comments

Comments
 (0)