summaryrefslogtreecommitdiffstats
path: root/gluster
diff options
context:
space:
mode:
authorMohammed Junaid <junaid@redhat.com>2013-07-22 10:38:26 +0530
committerLuis Pabon <lpabon@redhat.com>2013-07-24 18:41:54 -0700
commitb1919bd79429c8b66ea8be8b62df8491ab01254b (patch)
tree09604be60c03852a36cb235721132cd9dc302a08 /gluster
parent7ef1581a074757b05fc8f3235a558d10e990dce4 (diff)
Gracefully handle the ring file not found error.
Change-Id: I35c33f3938709d5d9a9a55640a503f186df9a965 Signed-off-by: Mohammed Junaid <junaid@redhat.com> Reviewed-on: http://review.gluster.org/5368 Reviewed-by: Luis Pabon <lpabon@redhat.com> Tested-by: Luis Pabon <lpabon@redhat.com>
Diffstat (limited to 'gluster')
-rw-r--r--gluster/swift/common/ring.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/gluster/swift/common/ring.py b/gluster/swift/common/ring.py
index a3209e2..d86a534 100644
--- a/gluster/swift/common/ring.py
+++ b/gluster/swift/common/ring.py
@@ -13,6 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+import os
+import errno
from ConfigParser import ConfigParser
from swift.common.ring import ring
from swift.common.utils import search_tree
@@ -39,12 +41,20 @@ if not reseller_prefix.endswith('_'):
class Ring(ring.Ring):
- def __init__(self, *args, **kwargs):
+ def __init__(self, serialized_path, *args, **kwargs):
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.Ring.__init__(self, *args, **kwargs)
+
+ 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)
+
+ ring.Ring.__init__(self, serialized_path, *args, **kwargs)
def _get_part_nodes(self, part):
seen_ids = set()