1
# Copyright (c) 2009-2010 Gluster, Inc. <http://www.gluster.com>
2
# This file is part of GlusterFS.
4
# GlusterFS is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published
6
# by the Free Software Foundation; either version 3 of the License,
7
# or (at your option) any later version.
9
# GlusterFS is distributed in the hope that it will be useful, but
10
# WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
# General Public License for more details.
14
# You should have received a copy of the GNU General Public License
15
# along with this program. If not, see
16
# <http://www.gnu.org/licenses/>.
18
import os, sys, string
21
cache_size = "`echo $(( $(grep 'MemTotal' /proc/meminfo | sed 's/[^0-9]//g') / 5120 ))`"
25
def __init__ (self, server_dict, server, transport,
26
transports, options, server_array):
28
self.host_dict = server_dict
30
self.volume_name = options.volume_name
31
self.transport = transport
32
self.transports = transports
33
self.auth_parameters = options.auth_param
34
self.raid_type = options.raid_type
35
self.ib_devport = options.ib_dev
36
self.conf_dir = options.conf_dir
37
self.host_array = server_array
38
self.enable_safe_mode = options.enable_safe_mode
39
self.volume_size_server = options.size_server
40
self.volume_size_client = options.size_client
41
self.nfs = options.need_nfs
42
self.num_replica = options.num_replica
43
self.num_stripe = options.num_stripe
45
self.gfs_port = options.port
46
self.gfs_ib_port = options.port + 1
49
self.gfs_ib_port = 24008
51
def create_pmap_mount_volfile (self):
53
raid_type = self.raid_type
55
mount_volfile = "%s/%s-%s.vol" % (self.conf_dir, str(self.volume_name), str(self.transport))
56
mount_fd = file ("%s" % (mount_volfile), "w")
58
print "Generating client volfiles.. '%s'" % mount_volfile
60
cmdline = string.join (sys.argv, ' ')
62
mount_fd.write ("## file auto generated by %s\n" % sys.argv[0])
63
mount_fd.write ("# Cmd line:\n")
64
mount_fd.write ("# $ %s\n\n" % cmdline)
66
if raid_type is not None:
67
# Used for later usage
68
mount_fd.write ("# RAID %d\n" % raid_type)
70
mount_fd.write ("# TRANSPORT-TYPE %s\n" % self.transport)
72
for host in self.host_dict.keys():
74
for export in self.host_dict[host]:
75
mount_fd.write ("volume %s-%s\n" % (host,export))
76
mount_fd.write (" type protocol/client\n")
77
mount_fd.write (" option transport-type %s\n" %
79
mount_fd.write (" option remote-host %s\n" % host)
80
if self.transport == 'ib-verbs':
81
mount_fd.write (" option transport.ib-verbs.port %d\n" %
83
if self.transport == 'tcp':
84
mount_fd.write (" option transport.socket.nodelay on\n")
86
mount_fd.write (" option remote-subvolume %s\n" % export)
87
mount_fd.write ("end-volume\n\n")
89
subvolumes.append(str(host) + '-' + str(export))
91
# Stripe section.. if given
93
max_stripe_idx = len (subvolumes) / self.num_stripe
96
while index < max_stripe_idx:
97
mount_fd.write ("volume stripe-%d\n" % index)
98
mount_fd.write (" type cluster/stripe\n")
99
mount_fd.write ("# option block-size 128k\n")
100
mount_fd.write ("# option use-xattr no\n")
101
mount_fd.write (" subvolumes %s" % subvolumes[stripe_idx])
103
while sub_idx < self.num_stripe:
104
mount_fd.write (" %s" % subvolumes[stripe_idx+sub_idx])
106
mount_fd.write ("\nend-volume\n\n")
107
stripe_idx += self.num_stripe
112
max_mirror_idx = len (subvolumes) / self.num_replica
115
while index < max_mirror_idx:
116
mount_fd.write ("volume mirror-%d\n" % index)
117
mount_fd.write (" type cluster/replicate\n")
118
mount_fd.write (" subvolumes %s" % subvolumes[mirror_idx])
120
while sub_idx < self.num_replica:
121
mount_fd.write (" %s" % subvolumes[mirror_idx + sub_idx])
123
mount_fd.write ("\nend-volume\n\n")
124
mirror_idx += self.num_replica
132
subvolumes.append ("stripe-%d" % flag)
139
subvolumes.append ("mirror-%d" % flag)
142
if len (subvolumes) > 1:
143
mount_fd.write ("volume distribute\n")
144
mount_fd.write (" type cluster/distribute\n")
145
mount_fd.write ("# option unhashed-sticky-bit yes"
146
" # Used for migrating data while adding new nodes\n")
147
mount_fd.write ("# option min-free-disk 5%"
148
" # Minimum free disk available on the volume\n")
149
mount_fd.write (" subvolumes %s\n" %
150
string.join (subvolumes,' '))
151
mount_fd.write ("end-volume\n\n")
152
subvolumes[0] = "distribute"
154
if self.volume_size_client:
155
mount_fd.write ("volume quota\n")
156
mount_fd.write (" type features/quota\n")
157
mount_fd.write (" option disk-usage-limit %s\n" % self.volume_size_client)
158
mount_fd.write ("# option minimum-free-disk-limit 10GB\n"
159
"# minimum free disk value (default) 0\n")
160
mount_fd.write ("# option refresh-interval 10\n")
161
mount_fd.write (" subvolumes %s\n" % subvolumes[0])
162
mount_fd.write ("end-volume\n\n")
163
subvolumes[0] = "quota"
165
if self.enable_safe_mode:
168
self.performance_mode (subvolumes[0], mount_fd)
173
def performance_mode (self, cluster_subvolume, volfile_fd):
175
volfile_fd.write ("volume writebehind\n")
176
volfile_fd.write (" type performance/write-behind\n")
177
volfile_fd.write (" option cache-size 4MB\n")
178
volfile_fd.write ("# option enable-trickling-writes yes # Flush final write calls when network is free\n")
179
volfile_fd.write ("# option enable-O_SYNC yes # Enable O_SYNC for write-behind\n")
180
volfile_fd.write ("# option disable-for-first-nbytes 1 # Disable first nbytes with very small initial writes\n")
181
if self.volume_size_client:
182
volfile_fd.write (" subvolumes quota\n")
184
volfile_fd.write (" subvolumes %s\n" % cluster_subvolume)
185
volfile_fd.write ("end-volume\n\n")
187
volfile_fd.write ("volume readahead\n")
188
volfile_fd.write (" type performance/read-ahead\n")
189
volfile_fd.write (" option page-count 4\n")
190
volfile_fd.write ("# option force-atime-update yes # force updating atimes, default off\n")
191
volfile_fd.write (" subvolumes writebehind\n")
192
volfile_fd.write ("end-volume\n\n")
194
volfile_fd.write ("volume iocache\n")
195
volfile_fd.write (" type performance/io-cache\n")
196
volfile_fd.write (" option cache-size %sMB\n" % cache_size)
197
volfile_fd.write (" option cache-timeout 1\n")
198
volfile_fd.write ("# option priority *.html:1,abc*:2 # Priority list for iocaching files\n")
199
volfile_fd.write (" subvolumes readahead\n")
200
volfile_fd.write ("end-volume\n\n")
202
volfile_fd.write ("volume quickread\n")
203
volfile_fd.write (" type performance/quick-read\n")
204
volfile_fd.write (" option cache-timeout 1\n")
205
volfile_fd.write (" option max-file-size 64kB\n")
206
volfile_fd.write (" subvolumes iocache\n")
207
volfile_fd.write ("end-volume\n\n")
209
volfile_fd.write ("volume statprefetch\n")
210
volfile_fd.write (" type performance/stat-prefetch\n")
211
volfile_fd.write (" subvolumes quickread\n")
212
volfile_fd.write ("end-volume\n\n")
216
def create_pmap_nfs_volfile (self):
218
raid_type = self.raid_type
220
mount_volfile = "%s/%s-%s-nfs.vol" % (self.conf_dir, str(self.volume_name), str(self.transport))
221
mount_fd = file ("%s" % (mount_volfile), "w")
223
print "Generating client volfiles.. '%s'" % mount_volfile
225
cmdline = string.join (sys.argv, ' ')
227
mount_fd.write ("## file auto generated by %s\n" % sys.argv[0])
228
mount_fd.write ("# Cmd line:\n")
229
mount_fd.write ("# $ %s\n\n" % cmdline)
231
if raid_type is not None:
232
# Used for later usage
233
mount_fd.write ("# RAID %d\n" % raid_type)
235
mount_fd.write ("# TRANSPORT-TYPE %s\n" % self.transport)
237
for host in self.host_dict.keys():
239
for export in self.host_dict[host]:
240
mount_fd.write ("volume %s-%d\n" % (host,i))
241
mount_fd.write (" type protocol/client\n")
242
mount_fd.write (" option transport-type %s\n" %
244
mount_fd.write (" option remote-host %s\n" % host)
245
if self.transport == 'ib-verbs':
246
mount_fd.write (" option transport.ib-verbs.port %d\n" %
248
if self.transport == 'tcp':
249
mount_fd.write (" option transport.socket.nodelay on\n")
251
mount_fd.write (" option remote-subvolume %s\n" % export)
252
mount_fd.write ("end-volume\n\n")
253
subvolumes.append(str(host) + '-' + str(i))
256
# Stripe section.. if given
258
max_stripe_idx = len (subvolumes) / self.num_stripe
261
while index < max_stripe_idx:
262
mount_fd.write ("volume stripe-%d\n" % index)
263
mount_fd.write (" type cluster/stripe\n")
264
mount_fd.write ("# option block-size 128k\n")
265
mount_fd.write ("# option use-xattr no\n")
266
mount_fd.write (" subvolumes %s" % subvolumes[stripe_idx])
268
while sub_idx < self.num_stripe:
269
mount_fd.write (" %s" % subvolumes[stripe_idx+sub_idx])
271
mount_fd.write ("\nend-volume\n\n")
272
stripe_idx += self.num_stripe
277
max_mirror_idx = len (subvolumes) / self.num_replica
280
while index < max_mirror_idx:
281
mount_fd.write ("volume mirror-%d\n" % index)
282
mount_fd.write (" type cluster/replicate\n")
283
mount_fd.write (" subvolumes %s" % subvolumes[mirror_idx])
285
while sub_idx < self.num_replica:
286
mount_fd.write (" %s" % subvolumes[mirror_idx + sub_idx])
288
mount_fd.write ("\nend-volume\n\n")
289
mirror_idx += self.num_replica
297
subvolumes.append ("stripe-%d" % flag)
304
subvolumes.append ("mirror-%d" % flag)
307
if len (subvolumes) > 1:
308
mount_fd.write ("volume distribute\n")
309
mount_fd.write (" type cluster/distribute\n")
310
mount_fd.write ("# option unhashed-sticky-bit yes"
311
" # Used for migrating data while adding new nodes\n")
312
mount_fd.write ("# option min-free-disk 5%"
313
" # Minimum free disk available on the volume\n")
314
mount_fd.write (" subvolumes %s\n" %
315
string.join (subvolumes,' '))
316
mount_fd.write ("end-volume\n\n")
317
subvolumes[0] = "distribute"
320
mount_fd.write ("volume nfsxlator\n")
321
mount_fd.write (" type nfs/server\n")
322
mount_fd.write (" subvolumes %s\n" % subvolumes[0])
323
mount_fd.write ("# option rpc-auth.auth-unix off #Enabled by default\n")
324
mount_fd.write ("# option rpc-auth.auth-null off #Enabled by default\n")
325
mount_fd.write ("# By default all addresses are rejected until allowed.\n")
326
mount_fd.write ("# option rpc-auth.addr.reject 127.*\n")
327
mount_fd.write ("# option rpc-auth.addr.allow localhost\n")
328
mount_fd.write (" option rpc-auth.addr.%s.allow %s\n" % (subvolumes[0], self.auth_parameters))
329
mount_fd.write ("# By default insecure ports are not allowed.\n")
330
mount_fd.write ("# option rpc-auth.ports.insecure on\n")
331
mount_fd.write ("# option rpc-auth.ports.<volume>.insecure on\n")
332
mount_fd.write ("# By default all access is read-write.\n")
333
mount_fd.write ("# option nfs3.<volume>.volume-access read-only\n")
334
mount_fd.write ("# option nfs3.<volume>.volume-access read-only\n")
335
mount_fd.write ("# option nfs3.read-size 128Kb\n")
336
mount_fd.write ("# option nfs3.write-size 32Kb\n")
337
mount_fd.write ("# option nfs3.readdir-size 64Kb\n")
338
mount_fd.write ("# option nfs3.<volume>.read-size 64Kb\n")
339
mount_fd.write ("# option nfs3.<volume>.write-size 64Kb\n")
340
mount_fd.write ("# option nfs3.posix1.readdir-size 128Kb\n")
341
mount_fd.write ("end-volume\n\n")
345
def create_pmap_export_volfile (self):
347
cmdline = string.join (sys.argv, ' ')
349
for export in self.host_dict[self.host]:
350
export_volfile = "%s/%s-%d.vol" % (self.conf_dir,
351
str(self.volume_name + '.' + self.host),
354
exp_fd = file ("%s" % (export_volfile),"w")
356
print "Generating server volfiles.. for server %s as '%s'" % (self.host,
359
exp_fd.write ("## file auto generated by %s\n" % sys.argv[0])
360
exp_fd.write ("# Cmd line:\n")
361
exp_fd.write ("# $ %s\n\n" % cmdline)
362
exp_fd.write ("volume posix\n")
363
exp_fd.write (" type storage/posix\n")
364
exp_fd.write ("# option o-direct enable # (default: disable) boolean type only\n")
365
exp_fd.write ("# option export-statfs-size no # (default: yes) boolean type only\n")
366
exp_fd.write ("# option mandate-attribute off # (default: on) boolean type only\n")
367
exp_fd.write ("# option span-devices 8 # (default: 0) integer value\n")
368
exp_fd.write ("# option background-unlink yes # (default: no) boolean type\n")
370
exp_fd.write (" option directory %s\n" % export)
371
exp_fd.write ("end-volume\n\n")
374
exp_fd.write ("volume posix-ac\n")
375
exp_fd.write (" type features/access-control\n")
376
exp_fd.write (" subvolumes posix\n")
377
exp_fd.write ("end-volume\n\n")
379
if self.volume_size_server:
380
exp_fd.write ("volume quota\n")
381
exp_fd.write (" type features/quota\n")
382
exp_fd.write (" option disk-usage-limit %s\n" % self.volume_size_server)
383
exp_fd.write ("# option minimum-free-disk-limit 10GB"
384
" # minimum free disk value (default) 0\n")
385
exp_fd.write ("# option refresh-interval 10\n")
387
exp_fd.write (" subvolumes posix-ac\n")
389
exp_fd.write (" subvolumes posix\n")
390
exp_fd.write ("end-volume\n\n")
392
exp_fd.write ("volume locks\n")
393
exp_fd.write (" type features/locks\n")
394
exp_fd.write ("# option mandatory on # Default off, used in specific applications\n")
395
if self.volume_size_server:
396
exp_fd.write (" subvolumes quota\n")
398
exp_fd.write (" subvolumes posix-ac\n")
400
exp_fd.write (" subvolumes posix\n")
401
exp_fd.write ("end-volume\n\n")
403
exp_fd.write ("volume replace-brick\n")
404
exp_fd.write (" type protocol/client\n")
406
exp_fd.write (" option transport-type %s\n" % self.transport)
408
exp_fd.write (" option transport.remote-port 34034\n")
409
exp_fd.write (" option ping-timeout 42\n")
410
exp_fd.write ("end-volume\n\n")
412
exp_fd.write ("volume pump\n")
413
exp_fd.write (" type cluster/pump\n")
414
exp_fd.write (" subvolumes locks replace-brick\n")
415
exp_fd.write ("end-volume\n\n")
417
exp_fd.write ("volume %s\n" % export)
418
exp_fd.write (" type performance/io-threads\n")
419
exp_fd.write (" option thread-count 8\n")
420
exp_fd.write ("# option autoscaling yes # Heuristic for autoscaling threads on demand\n")
421
exp_fd.write ("# option min-threads 2 # min count for thread pool\n")
422
exp_fd.write ("# option max-threads 64 # max count for thread pool\n")
423
exp_fd.write (" subvolumes pump\n")
424
exp_fd.write ("end-volume\n\n")
426
for transport in self.transports:
427
exp_fd.write ("volume server-%s\n" % export)
428
exp_fd.write (" type protocol/server\n")
429
exp_fd.write (" option transport-type %s\n" % transport)
430
exp_fd.write (" option auth.addr.%s.allow %s\n" %
431
(export, self.auth_parameters))
432
if transport == 'ib-verbs':
433
exp_fd.write (" option transport.ib-verbs.port %d\n" %
435
if transport == 'tcp':
436
exp_fd.write (" option transport.socket.nodelay on\n")
437
exp_fd.write (" option transport.socket.listen-port %d\n" % self.gfs_port)
438
exp_fd.write (" subvolumes %s\n" % export)
439
exp_fd.write ("end-volume\n\n")
444
def create_mount_volfile (self):
446
raid_type = self.raid_type
448
mount_volfile = "%s/%s-%s.vol" % (self.conf_dir, str(self.volume_name), str(self.transport))
449
mount_fd = file ("%s" % (mount_volfile), "w")
451
print "Generating client volfiles.. '%s'" % mount_volfile
453
cmdline = string.join (sys.argv, ' ')
455
mount_fd.write ("## file auto generated by %s\n" % sys.argv[0])
456
mount_fd.write ("# Cmd line:\n")
457
mount_fd.write ("# $ %s\n\n" % cmdline)
459
if raid_type is not None:
460
# Used for later usage
461
mount_fd.write ("# RAID %d\n" % raid_type)
463
mount_fd.write ("# TRANSPORT-TYPE %s\n" % self.transport)
465
for host in self.host_dict.keys():
467
for exports in self.host_dict[host]:
468
mount_fd.write ("volume %s-%s\n" % (host,exports))
469
mount_fd.write (" type protocol/client\n")
470
mount_fd.write (" option transport-type %s\n" %
472
mount_fd.write (" option remote-host %s\n" % host)
473
if self.transport == 'ib-verbs':
474
mount_fd.write (" option transport.ib-verbs.port %d\n" %
476
mount_fd.write (" option remote-port %d\n" %
478
if self.transport == 'tcp':
479
mount_fd.write (" option transport.socket.nodelay on\n")
480
mount_fd.write (" option remote-port %d\n" %
483
mount_fd.write (" option remote-subvolume %s\n" % exports)
484
mount_fd.write ("end-volume\n\n")
485
subvolumes.append(str(host) + '-' + str(exports))
487
# Stripe section.. if given
489
max_stripe_idx = len (subvolumes) / self.num_stripe
492
while index < max_stripe_idx:
493
mount_fd.write ("volume stripe-%d\n" % index)
494
mount_fd.write (" type cluster/stripe\n")
495
mount_fd.write ("# option block-size 128k\n")
496
mount_fd.write ("# option use-xattr no\n")
497
mount_fd.write (" subvolumes %s" % subvolumes[stripe_idx])
499
while sub_idx < self.num_stripe:
500
mount_fd.write (" %s" % subvolumes[stripe_idx+sub_idx])
502
mount_fd.write ("\nend-volume\n\n")
503
stripe_idx += self.num_stripe
508
max_mirror_idx = len (subvolumes) / self.num_replica
511
while index < max_mirror_idx:
512
mount_fd.write ("volume mirror-%d\n" % index)
513
mount_fd.write (" type cluster/replicate\n")
514
mount_fd.write (" subvolumes %s" % subvolumes[mirror_idx])
516
while sub_idx < self.num_replica:
517
mount_fd.write (" %s" % subvolumes[mirror_idx + sub_idx])
519
mount_fd.write ("\nend-volume\n\n")
520
mirror_idx += self.num_replica
528
subvolumes.append ("stripe-%d" % flag)
535
subvolumes.append ("mirror-%d" % flag)
538
if len (subvolumes) > 1:
539
mount_fd.write ("volume distribute\n")
540
mount_fd.write (" type cluster/distribute\n")
541
mount_fd.write ("# option unhashed-sticky-bit yes"
542
" # Used for migrating data while adding new nodes\n")
543
mount_fd.write ("# option min-free-disk 5%"
544
" # Minimum free disk available on the volume\n")
545
mount_fd.write (" subvolumes %s\n" %
546
string.join (subvolumes,' '))
547
mount_fd.write ("end-volume\n\n")
548
subvolumes[0] = "distribute"
552
mount_fd.write ("volume nfsxlator\n")
553
mount_fd.write (" type nfs/server\n")
554
mount_fd.write (" subvolumes %s\n" % subvolumes[0])
555
mount_fd.write ("# option rpc-auth.auth-unix off #Enabled by default\n")
556
mount_fd.write ("# option rpc-auth.auth-null off #Enabled by default\n")
557
mount_fd.write ("# By default all addresses are rejected until allowed.\n")
558
mount_fd.write ("# option rpc-auth.addr.reject 127.*\n")
559
mount_fd.write ("# option rpc-auth.addr.allow localhost\n")
560
mount_fd.write (" option rpc-auth.addr.%s.allow %s\n" % (subvolumes[0], self.auth_parameters))
561
mount_fd.write ("# By default insecure ports are not allowed.\n")
562
mount_fd.write ("# option rpc-auth.ports.insecure on\n")
563
mount_fd.write ("# option rpc-auth.ports.<volume>.insecure on\n")
564
mount_fd.write ("# By default all access is read-write.\n")
565
mount_fd.write ("# option nfs3.<volume>.volume-access read-only\n")
566
mount_fd.write ("# option nfs3.<volume>.volume-access read-only\n")
567
mount_fd.write ("# option nfs3.read-size 128Kb\n")
568
mount_fd.write ("# option nfs3.write-size 32Kb\n")
569
mount_fd.write ("# option nfs3.readdir-size 64Kb\n")
570
mount_fd.write ("# option nfs3.<volume>.read-size 64Kb\n")
571
mount_fd.write ("# option nfs3.<volume>.write-size 64Kb\n")
572
mount_fd.write ("# option nfs3.posix1.readdir-size 128Kb\n")
573
mount_fd.write ("end-volume\n\n")
576
if self.volume_size_client:
577
mount_fd.write ("volume quota\n")
578
mount_fd.write (" type features/quota\n")
579
mount_fd.write (" option disk-usage-limit %s\n" % self.volume_size_client)
580
mount_fd.write ("# option minimum-free-disk-limit 10GB\n"
581
"# minimum free disk value (default) 0\n")
582
mount_fd.write ("# option refresh-interval 10\n")
583
mount_fd.write (" subvolumes %s\n" % subvolumes[0])
584
mount_fd.write ("end-volume\n\n")
585
subvolumes[0] = "quota"
587
if self.enable_safe_mode:
590
self.performance_mode (subvolumes[0], mount_fd)
594
def create_export_volfile (self):
596
cmdline = string.join (sys.argv, ' ')
597
export_volfile = "%s/%s-export.vol" % (self.conf_dir, str(self.host + '-' + self.volume_name))
598
exp_fd = file ("%s" % (export_volfile),"w")
600
print "Generating server volfiles.. for server %s as '%s'" % (self.host,
603
exp_fd.write ("## file auto generated by %s\n" %
605
exp_fd.write ("# Cmd line:\n")
606
exp_fd.write ("# $ %s\n\n" % cmdline)
609
for export in self.host_dict[self.host]:
610
exp_fd.write ("volume posix%d\n" % i)
611
exp_fd.write (" type storage/posix\n")
612
exp_fd.write ("# option o-direct enable # (default: disable) boolean type only\n")
613
exp_fd.write ("# option export-statfs-size no # (default: yes) boolean type only\n")
614
exp_fd.write ("# option mandate-attribute off # (default: on) boolean type only\n")
615
exp_fd.write ("# option span-devices 8 # (default: 0) integer value\n")
616
exp_fd.write ("# option background-unlink yes # (default: no) boolean type\n")
618
exp_fd.write (" option directory %s\n" % export)
619
exp_fd.write ("end-volume\n\n")
622
exp_fd.write ("volume posix-ac%d\n" % i)
623
exp_fd.write (" type features/access-control\n")
624
exp_fd.write (" subvolumes posix%d\n" % i)
625
exp_fd.write ("end-volume\n\n")
627
if self.volume_size_server:
628
exp_fd.write ("volume quota%d\n" % i)
629
exp_fd.write (" type features/quota\n")
630
exp_fd.write (" option disk-usage-limit %s\n" % self.volume_size_server)
631
exp_fd.write ("# option minimum-free-disk-limit 10GB"
632
" # minimum free disk value (default) 0\n")
633
exp_fd.write ("# option refresh-interval 10\n")
635
exp_fd.write (" subvolumes posix-ac%d\n" % i)
637
exp_fd.write (" subvolumes posix%d\n" % i)
638
exp_fd.write ("end-volume\n\n")
641
exp_fd.write ("volume locks%d\n" % i)
642
exp_fd.write (" type features/locks\n")
643
exp_fd.write ("# option mandatory on # Default off, used in specific applications\n")
644
if self.volume_size_server:
645
exp_fd.write (" subvolumes quota%d\n" % i)
647
exp_fd.write (" subvolumes posix%d\n" % i)
648
exp_fd.write ("end-volume\n\n")
650
exp_fd.write ("volume %s\n" % export)
651
exp_fd.write (" type performance/io-threads\n")
652
exp_fd.write (" option thread-count 8\n")
653
exp_fd.write ("# option autoscaling yes # Heuristic for autoscaling threads on demand\n")
654
exp_fd.write ("# option min-threads 2 # min count for thread pool\n")
655
exp_fd.write ("# option max-threads 64 # max count for thread pool\n")
657
exp_fd.write (" subvolumes locks%d\n" % i)
658
exp_fd.write ("end-volume\n\n")
660
total_bricks.append("%s" % export)
663
for transport in self.transports:
664
exp_fd.write ("volume server-%s\n" % transport)
665
exp_fd.write (" type protocol/server\n")
666
exp_fd.write (" option transport-type %s\n" % transport)
667
for brick in total_bricks:
668
exp_fd.write (" option auth.addr.%s.allow %s\n" %
669
(brick, self.auth_parameters))
671
if transport == 'ib-verbs':
672
exp_fd.write (" option transport.ib-verbs.listen-port %d\n" % self.gfs_ib_port)
673
exp_fd.write (" option transport.ib-verbs.port %d\n" %
675
if transport == 'tcp':
676
exp_fd.write (" option transport.socket.listen-port %d\n" % self.gfs_port)
677
exp_fd.write (" option transport.socket.nodelay on\n")
679
exp_fd.write (" subvolumes %s\n" %
680
string.join(total_bricks, ' '))
681
exp_fd.write ("end-volume\n\n")