diff options
author | Avra Sengupta <asengupt@redhat.com> | 2015-04-02 15:14:48 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2015-04-07 06:50:45 -0700 |
commit | 057d2bed4175412e3a95224301eace3e133c1dd3 (patch) | |
tree | d21ef182e55b7b86f1fbecee4eef0ce3d7198ecc /extras | |
parent | 1a22f3e10c82847f054fc4b57977e059dab8ac29 (diff) |
snapshot/scheduler: Don't append timestamp in scheduled snapshots
The scheduled snapshots will now have names as follows:
Scheduled-<jobname>-<volume name>.
Stopped appending time-stamp in scheduled snapshots because
time-stamps are appended in snapshots by default unless
explicitly asked not to.
Therefore snapshot created from "Job1" of "test_vol" volume
will look like
Scheduled-Job1-test_vol_GMT-2015.04.02-09.43.02
Change-Id: I75b4a87d265ed55193f08153fd7ffe521cc5ef68
BUG: 1208097
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
Reviewed-on: http://review.gluster.org/10115
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'extras')
-rwxr-xr-x | extras/snap_scheduler/gcron.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/extras/snap_scheduler/gcron.py b/extras/snap_scheduler/gcron.py index f7e8a4924ed..e52a8c8c30c 100755 --- a/extras/snap_scheduler/gcron.py +++ b/extras/snap_scheduler/gcron.py @@ -50,18 +50,20 @@ def initLogger(script_name): log.addHandler(fh) -def takeSnap(volname=""): +def takeSnap(volname="", snapname=""): success = True if volname == "": log.debug("No volname given") return False + if snapname == "": + log.debug("No snapname given") + return False - timeStr = time.strftime("%Y%m%d%H%M%S") cli = ["gluster", "snapshot", "create", - "%s-snapshot-%s" % (volname, timeStr), - "%s" % (volname)] + snapname, + volname] log.debug("Running command '%s'", " ".join(cli)) p = subprocess.Popen(cli, stdout=subprocess.PIPE, @@ -93,7 +95,7 @@ def doJob(name, lockFile, jobFunc, volname): log.debug("%s last modified at %s", lockFile, time.ctime(mtime)) if mtime < start_time: log.debug("Processing job %s", name) - if jobFunc(volname): + if jobFunc(volname, name): log.info("Job %s succeeded", name) else: log.error("Job %s failed", name) @@ -134,13 +136,15 @@ def main(): return volname = sys.argv[1] - locking_file = os.path.join(LOCK_FILE_DIR, sys.argv[2]) + jobname = sys.argv[2] + locking_file = os.path.join(LOCK_FILE_DIR, jobname) log.debug("locking_file = %s", locking_file) log.debug("volname = %s", volname) + log.debug("jobname = %s", jobname) start_time = int(time.time()) - doJob("Snapshot-" + volname, locking_file, takeSnap, volname) + doJob("Scheduled-" + jobname + "-" + volname, locking_file, takeSnap, volname) if __name__ == "__main__": |