Commit 79fa4bbe authored by Chrysostomos Nanakos's avatar Chrysostomos Nanakos
Browse files

pithos: Retrieve backend storage type from params

parent 6d9c5041
......@@ -41,8 +41,7 @@ class Blocker(object):
"""
def __init__(self, **params):
fblocker, rblocker, hashlen, blocksize = \
get_blocker(params['backend_storage'], **params)
fblocker, rblocker, hashlen, blocksize = get_blocker(**params)
self.fblocker = fblocker
self.rblocker = rblocker
self.hashlen = hashlen
......
......@@ -42,7 +42,7 @@ class Mapper(object):
"""
def __init__(self, **params):
fmap, rmap = get_mapper(params['backend_storage'], **params)
fmap, rmap = get_mapper(**params)
self.rmap = rmap
self.fmap = fmap
......
......@@ -45,8 +45,7 @@ class Store(object):
"""
def __init__(self, **params):
(pb, pm) = bootstrap_backend_storage(params['backend_storage'],
**params)
(pb, pm) = bootstrap_backend_storage(**params)
self.blocker = Blocker(**pb)
self.mapper = Mapper(**pm)
......
......@@ -35,9 +35,10 @@ import os
from hashlib import new as newhasher
def bootstrap_backend_storage(storageType, **params):
def bootstrap_backend_storage(**params):
umask = params['umask']
path = params['path']
storageType = params['backend_storage']
if umask is not None:
os.umask(umask)
if storageType.lower() == 'nfs':
......@@ -51,7 +52,7 @@ def bootstrap_backend_storage(storageType, **params):
cluster.connect()
if not cluster.pool_exists(params['blockpool']):
try:
cluster.create_pool(paramas['blockpool'])
cluster.create_pool(params['blockpool'])
except Exception as err:
err_msg = "Cannot create %s RADOS Pool"
raise RuntimeError(err_msg % params['blockpool'])
......@@ -89,11 +90,12 @@ def bootstrap_backend_storage(storageType, **params):
return (pb, pm)
def get_blocker(storageType, **params):
def get_blocker(**params):
rblocker = None
fblocker = None
hashlen = None
blocksize = None
storageType = params['backend_storage']
if storageType.lower() == 'rados':
if params['blockpool']:
from radosblocker import RadosBlocker
......@@ -112,9 +114,10 @@ def get_blocker(storageType, **params):
return (fblocker, rblocker, hashlen, blocksize)
def get_mapper(storageType, **params):
def get_mapper(**params):
rmap = None
fmap = None
storageType = params['backend_storage']
if storageType.lower() == 'rados':
if params['mappool']:
from radosmapper import RadosMapper
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment