|
|
d1681e |
From daab3274ba03f4df0160374fa9fb5993847f3153 Mon Sep 17 00:00:00 2001
|
|
|
d1681e |
From: Kotresh HR <khiremat@redhat.com>
|
|
|
d1681e |
Date: Wed, 9 May 2018 01:10:29 -0400
|
|
|
d1681e |
Subject: [PATCH 267/271] geo-rep/scheduler: Fix crash
|
|
|
d1681e |
|
|
|
d1681e |
Fix crash where session_name is referenced
|
|
|
d1681e |
before assignment. Well, this is a corner
|
|
|
d1681e |
case where the geo-rep session exists and
|
|
|
d1681e |
the status output doesn't show any rows.
|
|
|
d1681e |
This might happen when glusterd is down
|
|
|
d1681e |
or when the system is in inconsistent state
|
|
|
d1681e |
w.r.t glusterd.
|
|
|
d1681e |
|
|
|
d1681e |
Upstream reference:
|
|
|
d1681e |
> fixes: bz#1576179
|
|
|
d1681e |
> Change-Id: Iec1557e01b35068041b4b3c1aacee2bfa0e05873
|
|
|
d1681e |
> Patch: https://review.gluster.org/19991
|
|
|
d1681e |
|
|
|
d1681e |
BUG: 1575877
|
|
|
d1681e |
Change-Id: Iec1557e01b35068041b4b3c1aacee2bfa0e05873
|
|
|
d1681e |
Signed-off-by: Kotresh HR <khiremat@redhat.com>
|
|
|
d1681e |
Reviewed-on: https://code.engineering.redhat.com/gerrit/138668
|
|
|
d1681e |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
d1681e |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
d1681e |
---
|
|
|
d1681e |
extras/geo-rep/schedule_georep.py.in | 70 ++++++++++++++++++------------------
|
|
|
d1681e |
1 file changed, 35 insertions(+), 35 deletions(-)
|
|
|
d1681e |
|
|
|
d1681e |
diff --git a/extras/geo-rep/schedule_georep.py.in b/extras/geo-rep/schedule_georep.py.in
|
|
|
d1681e |
index 1887fe7..4e1a071 100644
|
|
|
d1681e |
--- a/extras/geo-rep/schedule_georep.py.in
|
|
|
d1681e |
+++ b/extras/geo-rep/schedule_georep.py.in
|
|
|
d1681e |
@@ -297,6 +297,7 @@ def get_summary(mastervol, slave_url):
|
|
|
d1681e |
status_data = get(mastervol, slave_url)
|
|
|
d1681e |
|
|
|
d1681e |
for session in status_data:
|
|
|
d1681e |
+ session_name = ""
|
|
|
d1681e |
summary = {
|
|
|
d1681e |
"active": 0,
|
|
|
d1681e |
"passive": 0,
|
|
|
d1681e |
@@ -339,7 +340,8 @@ def get_summary(mastervol, slave_url):
|
|
|
d1681e |
if summary["faulty"] == 0 and summary["offline"] == 0:
|
|
|
d1681e |
summary["ok"] = True
|
|
|
d1681e |
|
|
|
d1681e |
- out.append([session_name, summary, faulty_rows, down_rows])
|
|
|
d1681e |
+ if session_name != "":
|
|
|
d1681e |
+ out.append([session_name, summary, faulty_rows, down_rows])
|
|
|
d1681e |
|
|
|
d1681e |
return out
|
|
|
d1681e |
|
|
|
d1681e |
@@ -397,41 +399,39 @@ def main(args):
|
|
|
d1681e |
# or any other error. Gluster cmd still produces XML output
|
|
|
d1681e |
# with different message
|
|
|
d1681e |
output_warning("Unable to get Geo-replication Status")
|
|
|
d1681e |
- time.sleep(1)
|
|
|
d1681e |
- continue
|
|
|
d1681e |
-
|
|
|
d1681e |
- session_name, summary, faulty_rows, down_rows = session_summary[0]
|
|
|
d1681e |
- chkpt_status = "COMPLETE" if summary["checkpoints_ok"] else \
|
|
|
d1681e |
- "NOT COMPLETE"
|
|
|
d1681e |
- ok_status = "OK" if summary["ok"] else "NOT OK"
|
|
|
d1681e |
-
|
|
|
d1681e |
- if summary["ok"]:
|
|
|
d1681e |
- output_ok("All Checkpoints {1}, "
|
|
|
d1681e |
- "All status {2} (Turns {0:>3})".format(
|
|
|
d1681e |
- turns, chkpt_status, ok_status))
|
|
|
d1681e |
else:
|
|
|
d1681e |
- output_warning("All Checkpoints {1}, "
|
|
|
d1681e |
- "All status {2} (Turns {0:>3})".format(
|
|
|
d1681e |
- turns, chkpt_status, ok_status))
|
|
|
d1681e |
-
|
|
|
d1681e |
- output_warning("Geo-rep workers Faulty/Offline, "
|
|
|
d1681e |
- "Faulty: {0} Offline: {1}".format(
|
|
|
d1681e |
- repr(faulty_rows),
|
|
|
d1681e |
- repr(down_rows)))
|
|
|
d1681e |
-
|
|
|
d1681e |
- if summary["checkpoints_ok"]:
|
|
|
d1681e |
- output_ok("Stopping Geo-replication session now")
|
|
|
d1681e |
- cmd = ["@SBIN_DIR@/gluster", "volume", "geo-replication",
|
|
|
d1681e |
- args.mastervol,
|
|
|
d1681e |
- "%s::%s" % (args.slave, args.slavevol), "stop"]
|
|
|
d1681e |
- execute(cmd)
|
|
|
d1681e |
- break
|
|
|
d1681e |
- else:
|
|
|
d1681e |
- # If Checkpoint is not complete after a iteration means brick
|
|
|
d1681e |
- # was down and came online now. SETATTR on mount is not
|
|
|
d1681e |
- # recorded, So again issue touch on mount root So that
|
|
|
d1681e |
- # Stime will increase and Checkpoint will complete.
|
|
|
d1681e |
- touch_mount_root(args.mastervol)
|
|
|
d1681e |
+ session_name, summary, faulty_rows, down_rows = session_summary[0]
|
|
|
d1681e |
+ chkpt_status = "COMPLETE" if summary["checkpoints_ok"] else \
|
|
|
d1681e |
+ "NOT COMPLETE"
|
|
|
d1681e |
+ ok_status = "OK" if summary["ok"] else "NOT OK"
|
|
|
d1681e |
+
|
|
|
d1681e |
+ if summary["ok"]:
|
|
|
d1681e |
+ output_ok("All Checkpoints {1}, "
|
|
|
d1681e |
+ "All status {2} (Turns {0:>3})".format(
|
|
|
d1681e |
+ turns, chkpt_status, ok_status))
|
|
|
d1681e |
+ else:
|
|
|
d1681e |
+ output_warning("All Checkpoints {1}, "
|
|
|
d1681e |
+ "All status {2} (Turns {0:>3})".format(
|
|
|
d1681e |
+ turns, chkpt_status, ok_status))
|
|
|
d1681e |
+
|
|
|
d1681e |
+ output_warning("Geo-rep workers Faulty/Offline, "
|
|
|
d1681e |
+ "Faulty: {0} Offline: {1}".format(
|
|
|
d1681e |
+ repr(faulty_rows),
|
|
|
d1681e |
+ repr(down_rows)))
|
|
|
d1681e |
+
|
|
|
d1681e |
+ if summary["checkpoints_ok"]:
|
|
|
d1681e |
+ output_ok("Stopping Geo-replication session now")
|
|
|
d1681e |
+ cmd = ["@SBIN_DIR@/gluster", "volume", "geo-replication",
|
|
|
d1681e |
+ args.mastervol,
|
|
|
d1681e |
+ "%s::%s" % (args.slave, args.slavevol), "stop"]
|
|
|
d1681e |
+ execute(cmd)
|
|
|
d1681e |
+ break
|
|
|
d1681e |
+ else:
|
|
|
d1681e |
+ # If Checkpoint is not complete after a iteration means brick
|
|
|
d1681e |
+ # was down and came online now. SETATTR on mount is not
|
|
|
d1681e |
+ # recorded, So again issue touch on mount root So that
|
|
|
d1681e |
+ # Stime will increase and Checkpoint will complete.
|
|
|
d1681e |
+ touch_mount_root(args.mastervol)
|
|
|
d1681e |
|
|
|
d1681e |
# Increment the turns and Sleep for 10 sec
|
|
|
d1681e |
turns += 1
|
|
|
d1681e |
--
|
|
|
d1681e |
1.8.3.1
|
|
|
d1681e |
|