From 772e04ea316e474e9c0f7abfb043851b3e2c7686 Mon Sep 17 00:00:00 2001 From: Aravinda Vishwanathapura Date: Tue, 18 Apr 2023 11:45:29 +0530 Subject: [PATCH] Fix Geo-rep status parsing (#58) Signed-off-by: Aravinda Vishwanathapura --- glustercli/cli/parsers.py | 66 +++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/glustercli/cli/parsers.py b/glustercli/cli/parsers.py index 9f847b0..3be56de 100644 --- a/glustercli/cli/parsers.py +++ b/glustercli/cli/parsers.py @@ -501,30 +501,30 @@ def parse_georep_status(data, volinfo): # Get All Sessions for volume_el in tree.findall("geoRep/volume"): sessions_el = volume_el.find("sessions") - # Master Volume name if multiple Volumes - mvol = volume_el.find("name").text + # Primary Volume name if multiple Volumes + pvol = volume_el.find("name").text # For each session, collect the details for session in sessions_el.findall("session"): - session_slave = "{0}:{1}".format(mvol, session.find( - "session_slave").text) - session_keys.add(session_slave) - gstatus[session_slave] = {} + session_secondary = "{0}:{1}".format(pvol, session.find( + "session_secondary").text) + session_keys.add(session_secondary) + gstatus[session_secondary] = {} for pair in session.findall('pair'): - master_brick = "{0}:{1}".format( - pair.find("master_node").text, - pair.find("master_brick").text + primary_brick = "{0}:{1}".format( + pair.find("primary_node").text, + pair.find("primary_brick").text ) - gstatus[session_slave][master_brick] = { - "mastervol": mvol, - "slavevol": pair.find("slave").text.split("::")[-1], - "master_node": pair.find("master_node").text, - "master_brick": pair.find("master_brick").text, - "slave_user": pair.find("slave_user").text, - "slave": pair.find("slave").text, - "slave_node": pair.find("slave_node").text, + gstatus[session_secondary][primary_brick] = { + "primary_volume": pvol, + "secondary_volume": pair.find("secondary").text.split("::")[-1], + "primary_node": pair.find("primary_node").text, + "primary_brick": pair.find("primary_brick").text, + "secondary_user": pair.find("secondary_user").text, + "secondary": pair.find("secondary").text, + "secondary_node": pair.find("secondary_node").text, "status": pair.find("status").text, "crawl_status": pair.find("crawl_status").text, "entry": pair.find("entry").text, @@ -533,7 +533,7 @@ def parse_georep_status(data, volinfo): "failures": pair.find("failures").text, "checkpoint_completed": pair.find( "checkpoint_completed").text, - "master_node_uuid": pair.find("master_node_uuid").text, + "primary_node_uuid": pair.find("primary_node_uuid").text, "last_synced": pair.find("last_synced").text, "checkpoint_time": pair.find("checkpoint_time").text, "checkpoint_completion_time": @@ -551,30 +551,30 @@ def parse_georep_status(data, volinfo): # Geo-rep status for that Brick out = [] for session in session_keys: - mvol, _, slave = session.split(":", 2) - slave = slave.replace("ssh://", "") - master_bricks = all_bricks[mvol] + pvol, _, secondary = session.split(":", 2) + secondary = secondary.replace("ssh://", "") + primary_bricks = all_bricks[pvol] out.append([]) - for brick in master_bricks: + for brick in primary_bricks: bname = brick["name"] if gstatus.get(session) and gstatus[session].get(bname, None): out[-1].append(gstatus[session][bname]) else: # Offline Status node, brick_path = bname.split(":") - if "@" not in slave: - slave_user = "root" + if "@" not in secondary: + secondary_user = "root" else: - slave_user, _ = slave.split("@") + secondary_user, _ = secondary.split("@") out[-1].append({ - "mastervol": mvol, - "slavevol": slave.split("::")[-1], - "master_node": node, - "master_brick": brick_path, - "slave_user": slave_user, - "slave": slave, - "slave_node": "N/A", + "primary_volume": pvol, + "secondary_volume": secondary.split("::")[-1], + "primary_node": node, + "primary_brick": brick_path, + "secondary_user": secondary_user, + "secondary": secondary, + "secondary_node": "N/A", "status": "Offline", "crawl_status": "N/A", "entry": "N/A", @@ -582,7 +582,7 @@ def parse_georep_status(data, volinfo): "meta": "N/A", "failures": "N/A", "checkpoint_completed": "N/A", - "master_node_uuid": brick["uuid"], + "primary_node_uuid": brick["uuid"], "last_synced": "N/A", "checkpoint_time": "N/A", "checkpoint_completion_time": "N/A"