Skip to content

Commit

Permalink
util: fix tracevol.py to manage config map created by Rook
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
agarwal-mudit authored and mergify[bot] committed Aug 3, 2020
1 parent 3585b21 commit 6814f59
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions troubleshooting/tools/tracevol.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,16 +465,19 @@ def get_subvol_group(arg):
except ValueError as err:
print(err, stdout)
sys.exit()
cm_data = config_map['data']['config.json']
subvol_group = ""
if "subvolumeGroup" in cm_data:
try:
cm_data_json = json.loads(cm_data)
except ValueError as err:
print(err, stdout)
sys.exit()
for data in cm_data_json:
subvol_group = data['cephFS']['subvolumeGroup']
cm_data = config_map['data'].get('config.json')
# Absence of 'config.json' means that the configmap
# is created by Rook and there won't be any provision to
# specify subvolumeGroup
if cm_data:
if "subvolumeGroup" in cm_data:
try:
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

def is_rbd_pv(arg, pvname, pvdata):
Expand Down

0 comments on commit 6814f59

Please sign in to comment.