Bug 1198021

Summary: [SNAPSHOT]: Schedule snapshot creation with frequency ofhalf-hourly ,hourly,daily,weekly,monthly and yearly
Product: [Red Hat Storage] Red Hat Gluster Storage Reporter: senaik
Component: snapshotAssignee: Avra Sengupta <asengupt>
Status: CLOSED ERRATA QA Contact: senaik
Severity: unspecified Docs Contact:
Priority: urgent    
Version: rhgs-3.0CC: annair, asengupt, nsathyan, rhs-bugs, rjoseph, storage-qa-internal, vagarwal
Target Milestone: ---   
Target Release: RHGS 3.1.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: Scheduler
Fixed In Version: glusterfs-3.7.1-5 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1198027 (view as bug list) Environment:
Last Closed: 2015-07-29 04:38:52 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1198027, 1202842, 1223636    

Description senaik 2015-03-03 09:09:27 UTC
Description of problem:
======================
Provide option to the administrator to schedule snap creation with frequency of half-hourly,hourly,daily,weekly,monthly and yearly and also the option to specify hour of the day, day of the week,date of the month and month of the year.

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Avra Sengupta 2015-03-03 09:28:30 UTC
Patch sent upstream at http://review.gluster.org/9788

Comment 4 senaik 2015-07-02 11:14:30 UTC
Version : glusterfs-3.7.1-6.el6rhs.x86_64

Created snapshots with frequency ofhalf-hourly ,hourly,daily,weekly,monthly and yearly , snapshots were created successfully. 

Half hourly:
============
[root@inception ~]# snap_scheduler.py list
JOB_NAME         SCHEDULE         OPERATION        VOLUME NAME      
--------------------------------------------------------------------
Job1             */30 * * * *     Snapshot Create  vol0             
           
gluster snapshot list 
Scheduled-Job1-vol0_GMT-2015.07.02-08.00.01
Scheduled-Job2-vol0_GMT-2015.07.02-08.30.01
Scheduled-Job1-vol0_GMT-2015.07.02-09.00.01
Scheduled-Job2-vol0_GMT-2015.07.02-09.30.01

Hourly:
======
 snap_scheduler.py list
JOB_NAME         SCHEDULE         OPERATION        VOLUME NAME      
--------------------------------------------------------------------
Job2             */60 * * * *     Snapshot Create  vol0             

gluster snapshot list
Scheduled-Job1-vol0_GMT-2015.07.02-08.00.01
Scheduled-Job2-vol0_GMT-2015.07.02-08.30.01
Scheduled-Job1-vol0_GMT-2015.07.02-09.00.01
Scheduled-Job2-vol0_GMT-2015.07.02-09.30.01
Scheduled-Job2-vol0_GMT-2015.07.02-10.30.03

Daily:
======
Set a job to take daily snapshots at 15:35 and changed the date accordingly and verified if snapshots were created.

snap_scheduler.py list
JOB_NAME         SCHEDULE         OPERATION        VOLUME NAME      
--------------------------------------------------------------------
daily            35 15 * * *      Snapshot Create  vol0             

[2015-07-05 15:35:22,030 gcron.py:75 takeSnap] DEBUG Command 'gluster snapshot create Scheduled-daily-vol0 vol0' returned '0'
[2015-07-05 15:35:22,032 gcron.py:83 takeSnap] INFO Snapshot of vol0 successful
[2015-07-05 15:35:22,032 gcron.py:100 doJob] INFO Job Scheduled-daily-vol0 succeeded

gluster snapshot list
Scheduled-daily-vol0_GMT-2015.07.04-09.59.01
Scheduled-daily-vol0_GMT-2015.07.04-10.00.01
Scheduled-daily-vol0_GMT-2015.07.05-10.05.01

Weekly:
======
Added a job to create snapshots every Sunday at 15:30 

[root@inception ~]# snap_scheduler.py list
JOB_NAME         SCHEDULE         OPERATION        VOLUME NAME      
--------------------------------------------------------------------
weekly           30 15 * * 0      Snapshot Create  vol0             

Changed the date to 15:29 and at 15:30 saw successful snapshot creation

[2015-07-12 15:30:01,420 gcron.py:68 takeSnap] DEBUG Running command 'gluster snapshot create Scheduled-weekly-vol0 vol0'
[2015-07-12 15:30:20,558 gcron.py:75 takeSnap] DEBUG Command 'gluster snapshot create Scheduled-weekly-vol0 vol0' returned '0'
[2015-07-12 15:30:20,558 gcron.py:83 takeSnap] INFO Snapshot of vol0 successful
[2015-07-12 15:30:20,558 gcron.py:100 doJob] INFO Job Scheduled-weekly-vol0 succeeded

 gluster snapshot list
Scheduled-weekly-vol0_GMT-2015.07.12-10.00.01

Monthly:
=======
Added a job to take snapshots every first day of the month at 12 AM 

 snap_scheduler.py list
JOB_NAME         SCHEDULE         OPERATION        VOLUME NAME      
--------------------------------------------------------------------
monthly          0 0 1 * *        Snapshot Create  vol0             

changed the date t0 31 SEP 23:58 , at 00:00 on 1 Nov , snapshot creation was successful

snaps/lock_files/Monthly last modified at Thu Oct  1 00:01:15 2015
[2015-11-01 00:00:01,130 gcron.py:98 doJob] DEBUG Processing job Scheduled-Monthly-vol0
[2015-11-01 00:00:01,130 gcron.py:68 takeSnap] DEBUG Running command 'gluster snapshot create Scheduled-Monthly-vol0 vol0'
[2015-11-01 00:00:19,676 gcron.py:75 takeSnap] DEBUG Command 'gluster snapshot create Scheduled-Monthly-vol0 vol0' returned '0'
[2015-11-01 00:00:19,677 gcron.py:83 takeSnap] INFO Snapshot of vol0 successful
[2015-11-01 00:00:19,677 gcron.py:100 doJob] INFO Job Scheduled-Monthly-vol0 succeeded

 gluster snapshot list
Scheduled-Monthly-vol0_GMT-2015.10.31-18.30.01


Yearly: 
======
Added a job to create a snapshot every year on the 1st of Jan 

 snap_scheduler.py list
JOB_NAME         SCHEDULE         OPERATION        VOLUME NAME      
--------------------------------------------------------------------
Yearly           0 0 * 1 *        Snapshot Create  vol0             

Changed the date to 31 Dec 23:58 and at 00:00 on Jan1 snapshots were created successfully 

[2017-01-01 00:00:01,146 gcron.py:98 doJob] DEBUG Processing job Scheduled-Yearly-vol0
[2017-01-01 00:00:01,146 gcron.py:68 takeSnap] DEBUG Running command 'gluster snapshot create Scheduled-Yearly-vol0 vol0'
[2017-01-01 00:00:22,403 gcron.py:75 takeSnap] DEBUG Command 'gluster snapshot create Scheduled-Yearly-vol0 vol0' returned '0'
[2017-01-01 00:00:22,404 gcron.py:83 takeSnap] INFO Snapshot of vol0 successful
[2017-01-01 00:00:22,404 gcron.py:100 doJob] INFO Job Scheduled-Yearly-vol0 succeed

Marking the bug 'Verified'

Comment 6 errata-xmlrpc 2015-07-29 04:38:52 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2015-1495.html