summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKotresh HR <khiremat@redhat.com>2018-07-07 08:58:08 -0400
committerShyamsundar Ranganathan <srangana@redhat.com>2018-07-23 23:42:54 +0000
commit42badfbbfe1e2a1efff6cfe7da2c34f418e27838 (patch)
tree24fbb996d597ed5e3e77a4e76a303d5c10f879af
parenta8156e843e651be7c18e9e24d08116f752227a35 (diff)
geo-rep/scheduler: Fix EBUSY trace back
Fix the trace back during temporary mount cleanup. Temporary mount is done to touch the root required for checkpoint to complete. Backport of: > Patch: https://review.gluster.org/#/c/20476/ > BUG: 1598977 > Change-Id: I97fea538e92c4ef0747747e981ef98499504e336 > Signed-off-by: Kotresh HR <khiremat@redhat.com> (cherry picked from commit 271510b09d0613887f983b1e3dad5c55cdc6cd07) fixes: bz#1600941 Change-Id: I97fea538e92c4ef0747747e981ef98499504e336 Signed-off-by: Kotresh HR <khiremat@redhat.com>
-rw-r--r--extras/geo-rep/schedule_georep.py.in25
1 files changed, 20 insertions, 5 deletions
diff --git a/extras/geo-rep/schedule_georep.py.in b/extras/geo-rep/schedule_georep.py.in
index 6462d8f..01a4697 100644
--- a/extras/geo-rep/schedule_georep.py.in
+++ b/extras/geo-rep/schedule_georep.py.in
@@ -43,7 +43,7 @@ SESSION_MOUNT_LOG_FILE = ("/var/log/glusterfs/geo-replication"
"/schedule_georep.mount.log")
USE_CLI_COLOR = True
-
+mnt_list = []
class GlusterBadXmlFormat(Exception):
"""
@@ -90,6 +90,8 @@ def execute(cmd, success_msg="", failure_msg="", exitcode=-1):
output_ok(success_msg)
return out
else:
+ if exitcode == 0:
+ return
err_msg = err if err else out
output_notok(failure_msg, err=err_msg, exitcode=exitcode)
@@ -112,12 +114,12 @@ def cleanup(hostname, volname, mnt):
"""
Unmount the Volume and Remove the temporary directory
"""
- execute(["umount", mnt],
+ execute(["umount", "-l", mnt],
failure_msg="Unable to Unmount Gluster Volume "
"{0}:{1}(Mounted at {2})".format(hostname, volname, mnt))
execute(["rmdir", mnt],
failure_msg="Unable to Remove temp directory "
- "{0}".format(mnt))
+ "{0}".format(mnt), exitcode=0)
@contextmanager
@@ -130,6 +132,7 @@ def glustermount(hostname, volname):
Automatically unmounts it in case of Exceptions/out of context
"""
mnt = tempfile.mkdtemp(prefix="georepsetup_")
+ mnt_list.append(mnt)
execute(["@SBIN_DIR@/glusterfs",
"--volfile-server", hostname,
"--volfile-id", volname,
@@ -376,14 +379,14 @@ def main(args):
output_ok("Started Geo-replication and watching Status for "
"Checkpoint completion")
- touch_mount_root(args.mastervol)
-
start_time = int(time.time())
duration = 0
# Sleep till Geo-rep initializes
time.sleep(60)
+ touch_mount_root(args.mastervol)
+
slave_url = "{0}::{1}".format(args.slave, args.slavevol)
# Loop to Check the Geo-replication Status and Checkpoint
@@ -446,6 +449,11 @@ def main(args):
time.sleep(args.interval)
+ for mnt in mnt_list:
+ execute(["rmdir", mnt],
+ failure_msg="Unable to Remove temp directory "
+ "{0}".format(mnt), exitcode=0)
+
if __name__ == "__main__":
parser = ArgumentParser(formatter_class=RawDescriptionHelpFormatter,
description=__doc__)
@@ -474,4 +482,11 @@ if __name__ == "__main__":
execute(cmd)
main(args)
except KeyboardInterrupt:
+ for mnt in mnt_list:
+ execute(["umount", "-l", mnt],
+ failure_msg="Unable to Unmount Gluster Volume "
+ "Mounted at {0}".format(mnt), exitcode=0)
+ execute(["rmdir", mnt],
+ failure_msg="Unable to Remove temp directory "
+ "{0}".format(mnt), exitcode=0)
output_notok("Exiting...")