mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-09 16:00:22 +00:00
util: fix tracevol.py to manage config map created by Rook
If the config map is created by rook then there won't be any provision to specify subvolumeGroup, tracevol.py should skip looking for subvolumeGroup in such case. Signed-off-by: Mudit Agarwal <muagarwa@redhat.com>
This commit is contained in:
parent
3585b21e80
commit
6814f598ce
@ -465,16 +465,19 @@ def get_subvol_group(arg):
|
|||||||
except ValueError as err:
|
except ValueError as err:
|
||||||
print(err, stdout)
|
print(err, stdout)
|
||||||
sys.exit()
|
sys.exit()
|
||||||
cm_data = config_map['data']['config.json']
|
|
||||||
subvol_group = ""
|
subvol_group = ""
|
||||||
if "subvolumeGroup" in cm_data:
|
cm_data = config_map['data'].get('config.json')
|
||||||
try:
|
# Absence of 'config.json' means that the configmap
|
||||||
cm_data_json = json.loads(cm_data)
|
# is created by Rook and there won't be any provision to
|
||||||
except ValueError as err:
|
# specify subvolumeGroup
|
||||||
print(err, stdout)
|
if cm_data:
|
||||||
sys.exit()
|
if "subvolumeGroup" in cm_data:
|
||||||
for data in cm_data_json:
|
try:
|
||||||
subvol_group = data['cephFS']['subvolumeGroup']
|
cm_data_list = json.loads(cm_data)
|
||||||
|
except ValueError as err:
|
||||||
|
print(err, stdout)
|
||||||
|
sys.exit()
|
||||||
|
subvol_group = cm_data_list[0]['cephFS']['subvolumeGroup']
|
||||||
return subvol_group
|
return subvol_group
|
||||||
|
|
||||||
def is_rbd_pv(arg, pvname, pvdata):
|
def is_rbd_pv(arg, pvname, pvdata):
|
||||||
|
Loading…
Reference in New Issue
Block a user