Skip to content

Commit

Permalink
Import fails when one or more storage nodes does not have any lvm par…
Browse files Browse the repository at this point in the history
…titions on disk

bugzilla: 1683603
tendrl-bug-id: Tendrl#715

Signed-off-by: GowthamShanmugasundaram <gshanmug@redhat.com>
  • Loading branch information
GowthamShanmugam committed Feb 27, 2019
1 parent 6dd8a8b commit d77590e
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions tendrl/gluster_integration/sds_sync/brick_utilization.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,30 @@ def get_lvs():
{"message": str(err)}
)
return None
out = out.split('\n')
lst = map(lambda x: dict(x),
map(lambda x: [e.split('=') for e in x],
map(lambda x: x.strip().split('$'), out)))

d = {}
for i in lst:
if i['LVM2_LV_ATTR'][0] == 't':
k = "%s/%s" % (i['LVM2_VG_NAME'], i['LVM2_LV_NAME'])
else:
k = os.path.realpath(i['LVM2_LV_PATH'])
d.update({k: i})
if str(out) != '':
try:
out = out.split('\n')
lst = map(lambda x: dict(x),
map(lambda x: [e.split('=') for e in x],
map(lambda x: x.strip().split('$'), out)))

for i in lst:
if i['LVM2_LV_ATTR'][0] == 't':
k = "%s/%s" % (i['LVM2_VG_NAME'], i['LVM2_LV_NAME'])
else:
k = os.path.realpath(i['LVM2_LV_PATH'])
d.update({k: i})
except (ValueError, KeyError) as ex:
# Keyerror will raise when any changes in attributes name
# of lvm output
# ValueError will raise when any problem in output format
# Because parsing logic will raise error
logger.log(
"debug",
NS.publisher_id,
{"message": str(ex)}
)
return d


Expand Down

0 comments on commit d77590e

Please sign in to comment.