Handle the ring_name variable being none in Ring.__init__

Change-Id: Ifbcf217e525e50f62b98028ed5292be58db64bad
Signed-off-by: Mohammed Junaid <junaid@redhat.com>
Reviewed-on: http://review.gluster.org/5459
Reviewed-by: Luis Pabon <lpabon@redhat.com>
Tested-by: Luis Pabon <lpabon@redhat.com>
This commit is contained in:
Mohammed Junaid 2013-08-01 11:31:39 +05:30 committed by Luis Pabon
parent a71ab7b9b7
commit ee972086c2

View File

@ -41,20 +41,24 @@ if not reseller_prefix.endswith('_'):
class Ring(ring.Ring):
def __init__(self, serialized_path, *args, **kwargs):
def __init__(self, serialized_path, reload_time=15, ring_name=None):
self.false_node = {'zone': 1, 'weight': 100.0, 'ip': '127.0.0.1',
'id': 0, 'meta': '', 'device': 'volume_not_in_ring',
'port': 6012}
self.account_list = []
ring_file = os.path.join(serialized_path, kwargs['ring_name']
+ '.ring.gz')
if not os.path.exists(ring_file):
raise OSError(errno.ENOENT, 'No such file or directory',
'ring files do not exists under %s, '
'aborting proxy-server start.' % serialized_path)
if ring_name:
_serialized_path = os.path.join(serialized_path,
ring_name + '.ring.gz')
else:
_serialized_path = os.path.join(serialized_path)
ring.Ring.__init__(self, serialized_path, *args, **kwargs)
if not os.path.exists(_serialized_path):
raise OSError(errno.ENOENT, 'No such file or directory',
'%s ring file does not exists, aborting '
'proxy-server start.' % _serialized_path)
ring.Ring.__init__(self, serialized_path, reload_time, ring_name)
def _get_part_nodes(self, part):
seen_ids = set()