|
|
a3470f |
From 8c9028b560b1f0fd816e7d2a9e0bec70cc526c1a Mon Sep 17 00:00:00 2001
|
|
|
a3470f |
From: Kotresh HR <khiremat@redhat.com>
|
|
|
a3470f |
Date: Sat, 7 Jul 2018 08:58:08 -0400
|
|
|
a3470f |
Subject: [PATCH 317/325] geo-rep/scheduler: Fix EBUSY trace back
|
|
|
a3470f |
|
|
|
a3470f |
Fix the trace back during temporary mount
|
|
|
a3470f |
cleanup. Temporary mount is done to touch
|
|
|
a3470f |
the root required for checkpoint to complete.
|
|
|
a3470f |
|
|
|
a3470f |
Backport of
|
|
|
a3470f |
> Patch: https://review.gluster.org/#/c/20476/
|
|
|
a3470f |
> BUG: 1598977
|
|
|
a3470f |
> Change-Id: I97fea538e92c4ef0747747e981ef98499504e336
|
|
|
a3470f |
> Signed-off-by: Kotresh HR <khiremat@redhat.com>
|
|
|
a3470f |
|
|
|
a3470f |
BUG: 1568896
|
|
|
a3470f |
Change-Id: I97fea538e92c4ef0747747e981ef98499504e336
|
|
|
a3470f |
Signed-off-by: Kotresh HR <khiremat@redhat.com>
|
|
|
a3470f |
Reviewed-on: https://code.engineering.redhat.com/gerrit/143949
|
|
|
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 | 25 ++++++++++++++++++++-----
|
|
|
a3470f |
1 file changed, 20 insertions(+), 5 deletions(-)
|
|
|
a3470f |
|
|
|
a3470f |
diff --git a/extras/geo-rep/schedule_georep.py.in b/extras/geo-rep/schedule_georep.py.in
|
|
|
a3470f |
index 4e1a071..3797fff 100644
|
|
|
a3470f |
--- a/extras/geo-rep/schedule_georep.py.in
|
|
|
a3470f |
+++ b/extras/geo-rep/schedule_georep.py.in
|
|
|
a3470f |
@@ -43,7 +43,7 @@ SESSION_MOUNT_LOG_FILE = ("/var/log/glusterfs/geo-replication"
|
|
|
a3470f |
"/schedule_georep.mount.log")
|
|
|
a3470f |
|
|
|
a3470f |
USE_CLI_COLOR = True
|
|
|
a3470f |
-
|
|
|
a3470f |
+mnt_list = []
|
|
|
a3470f |
|
|
|
a3470f |
class GlusterBadXmlFormat(Exception):
|
|
|
a3470f |
"""
|
|
|
a3470f |
@@ -90,6 +90,8 @@ def execute(cmd, success_msg="", failure_msg="", exitcode=-1):
|
|
|
a3470f |
output_ok(success_msg)
|
|
|
a3470f |
return out
|
|
|
a3470f |
else:
|
|
|
a3470f |
+ if exitcode == 0:
|
|
|
a3470f |
+ return
|
|
|
a3470f |
err_msg = err if err else out
|
|
|
a3470f |
output_notok(failure_msg, err=err_msg, exitcode=exitcode)
|
|
|
a3470f |
|
|
|
a3470f |
@@ -112,12 +114,12 @@ def cleanup(hostname, volname, mnt):
|
|
|
a3470f |
"""
|
|
|
a3470f |
Unmount the Volume and Remove the temporary directory
|
|
|
a3470f |
"""
|
|
|
a3470f |
- execute(["umount", mnt],
|
|
|
a3470f |
+ execute(["umount", "-l", mnt],
|
|
|
a3470f |
failure_msg="Unable to Unmount Gluster Volume "
|
|
|
a3470f |
"{0}:{1}(Mounted at {2})".format(hostname, volname, mnt))
|
|
|
a3470f |
execute(["rmdir", mnt],
|
|
|
a3470f |
failure_msg="Unable to Remove temp directory "
|
|
|
a3470f |
- "{0}".format(mnt))
|
|
|
a3470f |
+ "{0}".format(mnt), exitcode=0)
|
|
|
a3470f |
|
|
|
a3470f |
|
|
|
a3470f |
@contextmanager
|
|
|
a3470f |
@@ -130,6 +132,7 @@ def glustermount(hostname, volname):
|
|
|
a3470f |
Automatically unmounts it in case of Exceptions/out of context
|
|
|
a3470f |
"""
|
|
|
a3470f |
mnt = tempfile.mkdtemp(prefix="georepsetup_")
|
|
|
a3470f |
+ mnt_list.append(mnt)
|
|
|
a3470f |
execute(["@SBIN_DIR@/glusterfs",
|
|
|
a3470f |
"--volfile-server", hostname,
|
|
|
a3470f |
"--volfile-id", volname,
|
|
|
a3470f |
@@ -378,14 +381,14 @@ def main(args):
|
|
|
a3470f |
output_ok("Started Geo-replication and watching Status for "
|
|
|
a3470f |
"Checkpoint completion")
|
|
|
a3470f |
|
|
|
a3470f |
- touch_mount_root(args.mastervol)
|
|
|
a3470f |
-
|
|
|
a3470f |
start_time = int(time.time())
|
|
|
a3470f |
duration = 0
|
|
|
a3470f |
|
|
|
a3470f |
# Sleep till Geo-rep initializes
|
|
|
a3470f |
time.sleep(60)
|
|
|
a3470f |
|
|
|
a3470f |
+ touch_mount_root(args.mastervol)
|
|
|
a3470f |
+
|
|
|
a3470f |
slave_url = "{0}::{1}".format(args.slave, args.slavevol)
|
|
|
a3470f |
|
|
|
a3470f |
# Loop to Check the Geo-replication Status and Checkpoint
|
|
|
a3470f |
@@ -446,6 +449,11 @@ def main(args):
|
|
|
a3470f |
|
|
|
a3470f |
time.sleep(args.interval)
|
|
|
a3470f |
|
|
|
a3470f |
+ for mnt in mnt_list:
|
|
|
a3470f |
+ execute(["rmdir", mnt],
|
|
|
a3470f |
+ failure_msg="Unable to Remove temp directory "
|
|
|
a3470f |
+ "{0}".format(mnt), exitcode=0)
|
|
|
a3470f |
+
|
|
|
a3470f |
if __name__ == "__main__":
|
|
|
a3470f |
parser = ArgumentParser(formatter_class=RawDescriptionHelpFormatter,
|
|
|
a3470f |
description=__doc__)
|
|
|
a3470f |
@@ -474,4 +482,11 @@ if __name__ == "__main__":
|
|
|
a3470f |
execute(cmd)
|
|
|
a3470f |
main(args)
|
|
|
a3470f |
except KeyboardInterrupt:
|
|
|
a3470f |
+ for mnt in mnt_list:
|
|
|
a3470f |
+ execute(["umount", "-l", mnt],
|
|
|
a3470f |
+ failure_msg="Unable to Unmount Gluster Volume "
|
|
|
a3470f |
+ "Mounted at {0}".format(mnt), exitcode=0)
|
|
|
a3470f |
+ execute(["rmdir", mnt],
|
|
|
a3470f |
+ failure_msg="Unable to Remove temp directory "
|
|
|
a3470f |
+ "{0}".format(mnt), exitcode=0)
|
|
|
a3470f |
output_notok("Exiting...")
|
|
|
a3470f |
--
|
|
|
a3470f |
1.8.3.1
|
|
|
a3470f |
|