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