From: Xiaoxi Chen Date: Wed, 6 Apr 2016 14:50:05 +0000 (+0800) Subject: python_cephfs: rule out empty/None volume_id X-Git-Tag: v10.2.1~53^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F8787%2Fhead;p=ceph.git python_cephfs: rule out empty/None volume_id Signed-off-by: Xiaoxi Chen (cherry picked from commit 73368069dd466cdbde1ebeae97771d603ce431f5) --- diff --git a/src/pybind/ceph_volume_client.py b/src/pybind/ceph_volume_client.py index c035871216c4..d5748f126a25 100644 --- a/src/pybind/ceph_volume_client.py +++ b/src/pybind/ceph_volume_client.py @@ -44,6 +44,7 @@ class VolumePath(object): self.group_id = group_id self.volume_id = volume_id assert self.group_id != NO_GROUP_NAME + assert self.volume_id != "" and self.volume_id is not None def __str__(self): return "{0}/{1}".format(self.group_id, self.volume_id) @@ -446,8 +447,8 @@ class CephFSVolumeClient(object): # data_isolated means create a seperate pool for this volume if data_isolated: - log.info("create_volume: {0}, create pool {1} as data_isolated =True.".format(volume_path, pool_name)) pool_name = "{0}{1}".format(self.POOL_PREFIX, volume_path.volume_id) + log.info("create_volume: {0}, create pool {1} as data_isolated =True.".format(volume_path, pool_name)) pool_id = self._create_volume_pool(pool_name) mds_map = self._rados_command("mds dump", {}) if pool_id not in mds_map['data_pools']: @@ -456,7 +457,7 @@ class CephFSVolumeClient(object): }) self.fs.setxattr(path, 'ceph.dir.layout.pool', pool_name, 0) - # enforce security isolation, create a seperate pool for this volume + # enforce security isolation, use seperate namespace for this volume namespace = "{0}{1}".format(self.POOL_NS_PREFIX, volume_path.volume_id) log.info("create_volume: {0}, using rados namespace {1} to isolate data.".format(volume_path, namespace)) self.fs.setxattr(path, 'ceph.dir.layout.pool_namespace', namespace, 0)