summaryrefslogtreecommitdiffstats
path: root/extras
diff options
context:
space:
mode:
authorHarshavardhana Ranganath <harsha@gluster.com>2009-11-30 01:17:22 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-12-01 09:22:34 -0800
commit90cebe19380b4319e3a4345f31268563b51e08c3 (patch)
tree831d3a16239e091329b343d827dbc908af293009 /extras
parent85ed82893aca7dd6307100660b9bba0233d52240 (diff)
Booster configuration fixed for per transport type and honours conf-dir option.
Signed-off-by: Harshavardhana <harsha@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 421 (Make booster configuration honour conf-dir and transport type) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=421
Diffstat (limited to 'extras')
-rw-r--r--extras/volgen/CreateBooster.py66
-rwxr-xr-xextras/volgen/glusterfs-volgen2
2 files changed, 57 insertions, 11 deletions
diff --git a/extras/volgen/CreateBooster.py b/extras/volgen/CreateBooster.py
index 3f56db34d3e..488426436de 100644
--- a/extras/volgen/CreateBooster.py
+++ b/extras/volgen/CreateBooster.py
@@ -1,25 +1,48 @@
-GLUSTERFS_BOOSTER_FSTAB = "/etc/gluster/booster.fstab"
-GLUSTERFS_UNFS3_EXPORTS = "/etc/gluster/boosterexports"
-GLUSTERFS_CIFS_CONFIG = "/etc/gluster/boostersmb.conf"
+GLUSTERFS_BOOSTER_FSTAB = "booster.fstab"
+GLUSTERFS_UNFS3_EXPORTS = "boosterexports"
+GLUSTERFS_CIFS_CONFIG = "boostersmb.conf"
LOGDIR = "/var/log/glusterfs"
-CONFDIR = "/etc/gluster"
fstype = "glusterfs"
class CreateBooster:
- def __init__ (self, options):
+ def __init__ (self, options, transports):
self.volume_name = options.volume_name
self.need_nfs = options.need_nfs
self.need_cifs = options.need_cifs
self.username = options.cifs_username
self.enable_guest = options.enable_guest
+ self.conf_dir = options.conf_dir
+ self.transports = transports
def configure_booster_fstab (self):
- booster_fstab_fd = file (GLUSTERFS_BOOSTER_FSTAB, "a")
+ _fstab = ""
+ _options = ""
+ _options_log = ""
+ _options_ext = ""
+
+ if self.conf_dir:
+ booster_fstab_fd = file ("%s/%s" % (str(self.conf_dir),
+ GLUSTERFS_BOOSTER_FSTAB), "a")
+ else:
+ booster_fstab_fd = file (GLUSTERFS_BOOSTER_FSTAB, "a")
+
if self.need_nfs:
- _fstab = "%s/%s.vol %s" % (CONFDIR, self.volume_name, str("/nfs/" + self.volume_name))
+ for transport in self.transports:
+ if self.conf_dir:
+ _fstab = "%s/%s-%s.vol %s" % (str(self.conf_dir),
+ self.volume_name,
+ transport,
+ str("/nfs/" +
+ self.volume_name))
+ else:
+ _fstab = "%s-%s.vol %s" % (self.volume_name,
+ transport,
+ str("/nfs/" +
+ self.volume_name))
+
_options = "%s" % fstype
_options_log = "logfile=%s/%s-nfs.log" % (LOGDIR, self.volume_name)
_options_ext = "loglevel=ERROR,attr_timeout=0"
@@ -30,7 +53,19 @@ class CreateBooster:
_options_ext))
if self.need_cifs:
- _fstab = "%s/%s.vol %s" % (CONFDIR, self.volume_name, str("/cifs/" + self.volume_name))
+ for transport in self.transports:
+ if self.conf_dir:
+ _fstab = "%s/%s-%s.vol %s" % (self.conf_dir,
+ self.volume_name,
+ transport,
+ str("/cifs/" +
+ self.volume_name))
+ else:
+ _fstab = "%s-%s.vol %s" % (self.volume_name,
+ transport,
+ str("/cifs/" +
+ self.volume_name))
+
_options = "%s" % fstype
_options_log = "logfile=%s/%s-cifs.log" % (LOGDIR, self.volume_name)
_options_ext = "loglevel=ERROR,attr_timeout=0"
@@ -44,20 +79,31 @@ class CreateBooster:
def configure_nfs_booster (self):
- nfs_exports_fd = file (GLUSTERFS_UNFS3_EXPORTS, "a")
+ if self.conf_dir:
+ nfs_exports_fd = file ("%s/%s" % (str(self.conf_dir),
+ GLUSTERFS_UNFS3_EXPORTS), "a")
+ else:
+ nfs_exports_fd = file (GLUSTERFS_UNFS3_EXPORTS, "a")
+
nfs_exports_fd.write ("%s 0.0.0.0/0(rw,no_root_squash)\n" %
str("/nfs/" + self.volume_name))
return
def configure_cifs_booster (self):
- cifs_config_fd = file (GLUSTERFS_CIFS_CONFIG, "a")
+ if self.conf_dir:
+ cifs_config_fd = file ("%s/%s" % (str(self.conf_dir),
+ GLUSTERFS_CIFS_CONFIG), "a")
+ else:
+ cifs_config_fd = file (GLUSTERFS_CIFS_CONFIG, "a")
cifs_config_fd.write ("[%s]\n" % self.volume_name)
cifs_config_fd.write ("comment = %s volume served by Gluster\n" %
self.volume_name)
cifs_config_fd.write ("path = %s\n" % str("/cifs/" + self.volume_name))
+
if self.enable_guest:
cifs_config_fd.write ("guest ok = yes\n")
+
cifs_config_fd.write ("public = yes\n")
cifs_config_fd.write ("writable = yes\n")
cifs_config_fd.write ("users = %s\n" % self.username)
diff --git a/extras/volgen/glusterfs-volgen b/extras/volgen/glusterfs-volgen
index f1fb4c9bc00..5275b90936c 100755
--- a/extras/volgen/glusterfs-volgen
+++ b/extras/volgen/glusterfs-volgen
@@ -166,7 +166,7 @@ def generate_volume_files ():
print "Got %s creating client volfiles for transport '%s'" % (strerror, transport)
- create_booster = CreateBooster (options)
+ create_booster = CreateBooster (options, transports)
try:
create_booster.configure_booster ()
except IOError, (errno, strerror):