generate separate volume files for nfs in case of 'portmapper' mode
Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 1319 (gnfs support in gluster command line) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1319
This commit is contained in:
parent
883913af30
commit
6b55c3b072
@ -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
|
||||
|
@ -185,6 +185,16 @@ def generate_volume_files ():
|
||||
except IOError, (errno, strerror):
|
||||
print "Got %s creating client volfiles for transport '%s'" % (strerror, transport)
|
||||
|
||||
if options.need_nfs:
|
||||
for transport in transports:
|
||||
create_mnt = CreateVolfile (server_dict, None,
|
||||
transport, transports,
|
||||
options, server_array)
|
||||
try:
|
||||
create_mnt.create_pmap_nfs_volfile ()
|
||||
except IOError, (errno, strerror):
|
||||
print "Got %s creating nfs volfiles for transport '%s'" % (strerror, transport)
|
||||
|
||||
return
|
||||
|
||||
for server in server_dict.keys():
|
||||
|
Loading…
Reference in New Issue
Block a user