diff options
author | Harshavardhana <harsha@gluster.com> | 2010-04-14 20:20:38 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2010-04-22 07:05:07 -0700 |
commit | bf18a37a1b66ca3ac75713d39e68dde1a116f4cf (patch) | |
tree | 45ac161136890acf9bfe92acdda39f00f83f531e /extras/volgen/glusterfs-volgen.in | |
parent | 7c7bafa3b17dcc0c799b5d42ccb5726e52c4d94f (diff) |
extras/volgen: Volgen patchset
-- Supports NFS Translator.
-- Consolidated common API's into Common.py.
-- Removed unused CreateBooster.py.
-- Added code for "--add-server" for dynamic volumes.
Currently its commented out we will use it when needed.
-- No more options hiding in background anymore. All options
specified for each translator are commented and exposed.
Only necessary values are enabled. This is done due to
necessary cleanup of unwanted options by exposing them.
PENDING: "replicate" translator
-- Quota is disabled for native NFS on client side.
Only server side quota can be used as of now.
-- Additional code cleanup.
Signed-off-by: Harshavardhana <harsha@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 822 (Volgen changes supporting NFS)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=822
Diffstat (limited to 'extras/volgen/glusterfs-volgen.in')
-rwxr-xr-x | extras/volgen/glusterfs-volgen.in | 121 |
1 files changed, 43 insertions, 78 deletions
diff --git a/extras/volgen/glusterfs-volgen.in b/extras/volgen/glusterfs-volgen.in index 4fc28f6af..d36a5b668 100755 --- a/extras/volgen/glusterfs-volgen.in +++ b/extras/volgen/glusterfs-volgen.in @@ -27,51 +27,7 @@ if not (prefix + "/share/glusterfs") in sys.path: sys.path.append(prefix + "/share/glusterfs") from CreateVolfile import * -from CreateBooster import * - -def check_duplicate_entry(args): - """Check duplicate entries in incoming arguments""" - _tmp = [] - for server in args: - if server not in _tmp: - _tmp.append (server) - else: - print "Duplicate arguments detected (%s)" % server - raise ValueError - - return - -def args2dict(args): - - keyvalue = {} - for arg in args: - if int(arg.find(':')) == -1: - continue - first = arg.split(':')[0] - keyvalue[first] = [] - - for arg in args: - if int(arg.find(':')) == -1: - continue - first = arg.split(':')[0] - if arg.split(':')[1] not in keyvalue[first]: - if arg.split(':')[1][0] != '/': - print "Absolute export path required for %s" % arg - raise ValueError - keyvalue[first].append (arg.split(':')[1]) - - return keyvalue - -def args2array(args): - - array = [] - - for arg in args: - if int(arg.find(':')) == -1: - continue - array.append(arg) - - return array +from Common import * def generate_volume_files (): @@ -93,48 +49,39 @@ def generate_volume_files (): group.add_option("-p", "--port", type="int", dest="port", default=6996, help="<port> number") - group.add_option("-a", "--auth", dest="auth_param", default="*", + group.add_option("--auth", dest="auth_param", default="*", help="comma seperated ip range") group.add_option("-r", "--raid", type="int", dest="raid_type", help="0|1") + group.add_option("-c", "--conf-dir", dest="conf_dir", + default=os.getcwd(), + help="output directory for volume files") group.add_option("--nfs", action="store_true", dest="need_nfs", - default=False, help="booster nfs reexport") - group.add_option("--cifs", action="store_true", dest="need_cifs", - default=False, help="booster cifs reexport") - parse.add_option_group(group) - - # CIFS option list - group = OptionGroup(parse, "CIFS Options") - group.add_option("--username", dest="cifs_username", - default="gluster", help="<cifs_username>") - group.add_option("--guest", action="store_true", - dest="enable_guest", default=False, - help="enable guest access") + default=False, help="enable nfs translator") parse.add_option_group(group) - # NFS option list # Advanced option list group = OptionGroup(parse, "Advanced Options") group.add_option("--ibdev", type="int", dest="ib_dev", default=1, help="Infiniband device number <N>") - group.add_option("-c", "--conf-dir", dest="conf_dir", - help="output directory for volume files") group.add_option("--volume-size-server", dest="size_server", help="volume size for each server") group.add_option("--volume-size-client", dest="size_client", help="volume size for each client") + group.add_option("--safe-mode", action="store_true", + dest="enable_safe_mode", default=False, + help="generate volume files in safe mode") parse.add_option_group(group) - group = OptionGroup(parse, "Extra Options") - group.add_option("--unused", action="store_true", - dest="unused", default=False, - help="enable unused options") - group.add_option("--debug", action="store_true", - dest="debug", default=False, - help="add all debug modules to volumes") + # Changes for Dynamic Volume Manager + #group = OptionGroup(parse, "Dynamic Volume Options") + #group.add_option("--add-server", dest="add_server_args", + # help="Add server to existing volume") + #group.add_option("--migrate", dest="migrate_server_args", + # help="Migrate servers from existing volumes") - parse.add_option_group(group) + #parse.add_option_group(group) (options, args) = parse.parse_args() @@ -142,6 +89,10 @@ def generate_volume_files (): print "Error: volume name is mandatory, please provide volume name" raise ValueError + if options.need_nfs and options.size_client: + print "Error: Currently quota not supported with native NFS, please use server side instead" + raise ValueError + if options.transport_type: transports = options.transport_type.split(',') for transport in transports: @@ -155,13 +106,33 @@ def generate_volume_files (): print "Error: --raid: option " + str(options.raid_type) + " is not valid raid type" raise ValueError - - check_duplicate_entry(args) + if options.conf_dir: + if not os.path.isdir(options.conf_dir): + print "Specified directory %s doesn't exist" % options.conf_dir + raise ValueError server_dict = {} - server_dict = args2dict(args) + # Dynamic Volume Manager + #if options.add_server_args: + # add_server_list = (options.add_server_args).strip().split() + # check_duplicate_entry(add_server_list) + # old_server_list = get_old_server_args(list_export_vols(options.conf_dir, + # options.volume_name), + # options.conf_dir) + # for new_server in add_server_list: + # old_server_list.append(new_server) + + # server_dict = args2dict(old_server_list) + # server_array = args2array(old_server_list) + # if len (server_dict.keys()) == 0: + # print "Error: no servers provided, please provide atleast one server" + # raise ValueError + + #else: + check_duplicate_entry(args) + server_dict = args2dict(args) server_array = args2array(args) if len (server_dict.keys()) == 0: @@ -199,12 +170,6 @@ def generate_volume_files (): print "Got %s creating client volfiles for transport '%s'" % (strerror, transport) - create_booster = CreateBooster (options, transports) - try: - create_booster.configure_booster () - except IOError, (errno, strerror): - print "Got %s creating booster configuration" % (strerror) - def main (): try: |