summaryrefslogtreecommitdiffstats
path: root/extras/volgen/CreateVolfile.py
diff options
context:
space:
mode:
Diffstat (limited to 'extras/volgen/CreateVolfile.py')
-rw-r--r--extras/volgen/CreateVolfile.py158
1 files changed, 132 insertions, 26 deletions
diff --git a/extras/volgen/CreateVolfile.py b/extras/volgen/CreateVolfile.py
index eb6db0e07..22cffcffe 100644
--- a/extras/volgen/CreateVolfile.py
+++ b/extras/volgen/CreateVolfile.py
@@ -151,32 +151,6 @@ class CreateVolfile:
mount_fd.write ("end-volume\n\n")
subvolumes[0] = "distribute"
-
- if self.nfs:
- mount_fd.write ("volume nfsxlator\n")
- mount_fd.write (" type nfs/server\n")
- mount_fd.write (" subvolumes %s\n" % subvolumes[0])
- mount_fd.write ("# option rpc-auth.auth-unix off #Enabled by default\n")
- mount_fd.write ("# option rpc-auth.auth-null off #Enabled by default\n")
- mount_fd.write ("# By default all addresses are rejected until allowed.\n")
- mount_fd.write ("# option rpc-auth.addr.reject 127.*\n")
- mount_fd.write ("# option rpc-auth.addr.allow localhost\n")
- mount_fd.write (" option rpc-auth.addr.%s.allow %s\n" % (subvolumes[0], self.auth_parameters))
- mount_fd.write ("# By default insecure ports are not allowed.\n")
- mount_fd.write ("# option rpc-auth.ports.insecure on\n")
- mount_fd.write ("# option rpc-auth.ports.<volume>.insecure on\n")
- mount_fd.write ("# By default all access is read-write.\n")
- mount_fd.write ("# option nfs3.<volume>.volume-access read-only\n")
- mount_fd.write ("# option nfs3.<volume>.volume-access read-only\n")
- mount_fd.write ("# option nfs3.read-size 128Kb\n")
- mount_fd.write ("# option nfs3.write-size 32Kb\n")
- mount_fd.write ("# option nfs3.readdir-size 64Kb\n")
- mount_fd.write ("# option nfs3.<volume>.read-size 64Kb\n")
- mount_fd.write ("# option nfs3.<volume>.write-size 64Kb\n")
- mount_fd.write ("# option nfs3.posix1.readdir-size 128Kb\n")
- mount_fd.write ("end-volume\n\n")
- return
-
if self.volume_size_client:
mount_fd.write ("volume quota\n")
mount_fd.write (" type features/quota\n")
@@ -186,6 +160,7 @@ class CreateVolfile:
mount_fd.write ("# option refresh-interval 10\n")
mount_fd.write (" subvolumes %s\n" % subvolumes[0])
mount_fd.write ("end-volume\n\n")
+ subvolumes[0] = "quota"
if self.enable_safe_mode:
return
@@ -194,6 +169,7 @@ class CreateVolfile:
return
+
def performance_mode (self, cluster_subvolume, volfile_fd):
volfile_fd.write ("volume writebehind\n")
@@ -237,6 +213,135 @@ class CreateVolfile:
return
+ def create_pmap_nfs_volfile (self):
+
+ raid_type = self.raid_type
+
+ mount_volfile = "%s/%s-%s-nfs.vol" % (self.conf_dir, str(self.volume_name), str(self.transport))
+ mount_fd = file ("%s" % (mount_volfile), "w")
+
+ print "Generating client volfiles.. '%s'" % mount_volfile
+
+ cmdline = string.join (sys.argv, ' ')
+
+ mount_fd.write ("## file auto generated by %s\n" % sys.argv[0])
+ mount_fd.write ("# Cmd line:\n")
+ mount_fd.write ("# $ %s\n\n" % cmdline)
+
+ if raid_type is not None:
+ # Used for later usage
+ mount_fd.write ("# RAID %d\n" % raid_type)
+
+ mount_fd.write ("# TRANSPORT-TYPE %s\n" % self.transport)
+ subvolumes = []
+ for host in self.host_dict.keys():
+ i = 1
+ for export in self.host_dict[host]:
+ mount_fd.write ("volume %s-%d\n" % (host,i))
+ mount_fd.write (" type protocol/client\n")
+ mount_fd.write (" option transport-type %s\n" %
+ self.transport)
+ mount_fd.write (" option remote-host %s\n" % host)
+ if self.transport == 'ib-verbs':
+ mount_fd.write (" option transport.ib-verbs.port %d\n" %
+ self.ib_devport)
+ if self.transport == 'tcp':
+ mount_fd.write (" option transport.socket.nodelay on\n")
+
+ mount_fd.write (" option remote-subvolume %s\n" % export)
+ mount_fd.write ("end-volume\n\n")
+ subvolumes.append(str(host) + '-' + str(i))
+ i += 1
+
+ # Stripe section.. if given
+ if raid_type is 0:
+ max_stripe_idx = len (subvolumes) / self.num_stripe
+ stripe_idx = 0
+ index = 0
+ while index < max_stripe_idx:
+ mount_fd.write ("volume stripe-%d\n" % index)
+ mount_fd.write (" type cluster/stripe\n")
+ mount_fd.write ("# option block-size 128k\n")
+ mount_fd.write ("# option use-xattr no\n")
+ mount_fd.write (" subvolumes %s" % subvolumes[stripe_idx])
+ sub_idx = 1
+ while sub_idx < self.num_stripe:
+ mount_fd.write (" %s" % subvolumes[stripe_idx+sub_idx])
+ sub_idx += 1
+ mount_fd.write ("\nend-volume\n\n")
+ stripe_idx += self.num_stripe
+ index +=1
+
+ # Replicate section
+ if raid_type is 1:
+ max_mirror_idx = len (subvolumes) / self.num_replica
+ mirror_idx = 0
+ index = 0
+ while index < max_mirror_idx:
+ mount_fd.write ("volume mirror-%d\n" % index)
+ mount_fd.write (" type cluster/replicate\n")
+ mount_fd.write (" subvolumes %s" % subvolumes[mirror_idx])
+ sub_idx = 1
+ while sub_idx < self.num_replica:
+ mount_fd.write (" %s" % subvolumes[mirror_idx + sub_idx])
+ sub_idx += 1
+ mount_fd.write ("\nend-volume\n\n")
+ mirror_idx += self.num_replica
+ index += 1
+
+ # Distribute section
+ if raid_type is 0:
+ subvolumes = []
+ flag = 0
+ while flag < index:
+ subvolumes.append ("stripe-%d" % flag)
+ flag += 1
+
+ if raid_type is 1:
+ subvolumes = []
+ flag = 0
+ while flag < index:
+ subvolumes.append ("mirror-%d" % flag)
+ flag += 1
+
+ if len (subvolumes) > 1:
+ mount_fd.write ("volume distribute\n")
+ mount_fd.write (" type cluster/distribute\n")
+ mount_fd.write ("# option unhashed-sticky-bit yes"
+ " # Used for migrating data while adding new nodes\n")
+ mount_fd.write ("# option min-free-disk 5%"
+ " # Minimum free disk available on the volume\n")
+ mount_fd.write (" subvolumes %s\n" %
+ string.join (subvolumes,' '))
+ mount_fd.write ("end-volume\n\n")
+ subvolumes[0] = "distribute"
+
+
+ mount_fd.write ("volume nfsxlator\n")
+ mount_fd.write (" type nfs/server\n")
+ mount_fd.write (" subvolumes %s\n" % subvolumes[0])
+ mount_fd.write ("# option rpc-auth.auth-unix off #Enabled by default\n")
+ mount_fd.write ("# option rpc-auth.auth-null off #Enabled by default\n")
+ mount_fd.write ("# By default all addresses are rejected until allowed.\n")
+ mount_fd.write ("# option rpc-auth.addr.reject 127.*\n")
+ mount_fd.write ("# option rpc-auth.addr.allow localhost\n")
+ mount_fd.write (" option rpc-auth.addr.%s.allow %s\n" % (subvolumes[0], self.auth_parameters))
+ mount_fd.write ("# By default insecure ports are not allowed.\n")
+ mount_fd.write ("# option rpc-auth.ports.insecure on\n")
+ mount_fd.write ("# option rpc-auth.ports.<volume>.insecure on\n")
+ mount_fd.write ("# By default all access is read-write.\n")
+ mount_fd.write ("# option nfs3.<volume>.volume-access read-only\n")
+ mount_fd.write ("# option nfs3.<volume>.volume-access read-only\n")
+ mount_fd.write ("# option nfs3.read-size 128Kb\n")
+ mount_fd.write ("# option nfs3.write-size 32Kb\n")
+ mount_fd.write ("# option nfs3.readdir-size 64Kb\n")
+ mount_fd.write ("# option nfs3.<volume>.read-size 64Kb\n")
+ mount_fd.write ("# option nfs3.<volume>.write-size 64Kb\n")
+ mount_fd.write ("# option nfs3.posix1.readdir-size 128Kb\n")
+ mount_fd.write ("end-volume\n\n")
+
+ return
+
def create_pmap_export_volfile (self):
cmdline = string.join (sys.argv, ' ')
@@ -477,6 +582,7 @@ class CreateVolfile:
mount_fd.write ("# option refresh-interval 10\n")
mount_fd.write (" subvolumes %s\n" % subvolumes[0])
mount_fd.write ("end-volume\n\n")
+ subvolumes[0] = "quota"
if self.enable_safe_mode:
return