Changeset View
Changeset View
Standalone View
Standalone View
swh/objstorage/backends/winery/roshard.py
Show All 15 Lines | |||||
class Pool(object): | class Pool(object): | ||||
name = "shards" | name = "shards" | ||||
def __init__(self, **kwargs): | def __init__(self, **kwargs): | ||||
self.args = kwargs | self.args = kwargs | ||||
self.rbd = sh.sudo.bake("rbd", f"--pool={self.name}") | self.rbd = sh.sudo.bake("rbd", f"--pool={self.name}") | ||||
self.ceph = sh.sudo.bake("ceph") | self.ceph = sh.sudo.bake("ceph") | ||||
self.image_size = self.args["shard_max_size"] * 2 | self.image_size = int((self.args["shard_max_size"] * 2) / (1024 * 1024)) | ||||
def image_list(self): | def image_list(self): | ||||
try: | try: | ||||
self.rbd.ls() | self.rbd.ls() | ||||
except sh.ErrorReturnCode_2 as e: | except sh.ErrorReturnCode_2 as e: | ||||
if "No such file or directory" in e.args[0]: | if "No such file or directory" in e.args[0]: | ||||
return [] | return [] | ||||
else: | else: | ||||
▲ Show 20 Lines • Show All 51 Lines • Show Last 20 Lines |