18 Commits

Author SHA1 Message Date
Avra Sengupta
71f27128cb snapshot/scheduler: Reload /etc/cron.d/glusterfs_snap_cron_tasks when shared storage is available
If shared storage is not accessible, create a flag in /var/run/gluster/
So that when /etc/cron.d/glusterfs_snap_cron_tasks is
available again, the flag will tell us, to reload
/etc/cron.d/glusterfs_snap_cron_tasks

Change-Id: I41b19f57ff0b8f7e0b820eaf592b0fdedb0a5d86
BUG: 1218573
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
Reviewed-on: http://review.gluster.org/11139
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
2015-06-11 00:08:17 -07:00
Avra Sengupta
5b05d3e376 snapshot/scheduler: Check if GCRON_TASKS exists before
accessing it's mtime

Change-Id: I873c83d21620527b20d7de428d11582c5499d1af
BUG: 1228613
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
Reviewed-on: http://review.gluster.org/11138
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
2015-06-10 03:02:20 -07:00
Avra Sengupta
d835219a30 snapshot/scheduler: Handle OSError in os. callbacks
Handle OSError and not IOError in os. callbacks.

Change-Id: I2b5bfb629bacbd2d2e410d96034b4e2c11c4931e
BUG: 1218060
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
Reviewed-on: http://review.gluster.org/11087
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Aravinda VK <avishwan@redhat.com>
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
2015-06-09 23:40:52 -07:00
nnDarshan
b15ee49c94 snapshot/scheduler: Modified main() function to take arguments.
Modified the main function to take script arguments, so that this
script can be used as a module by other programs .

Change-Id: I902f0bc7ddfbf0d335cc087f51b1a7af4b7157fc
BUG: 1220670
Signed-off-by: n Darshan <dnarayan@redhat.com>
Reviewed-on: http://review.gluster.org/10760
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Aravinda VK <avishwan@redhat.com>
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
2015-06-04 00:00:40 -07:00
Avra Sengupta
9798a24feb snapshot/scheduler: Return proper error code in case of failure
ENUM                              RETCODE     ERROR
----------------------------------------------------------
INTERNAL_ERROR                    2           Internal Error
SHARED_STORAGE_DIR_DOESNT_EXIST   3           Shared Storage Dir
                                              does not exist
SHARED_STORAGE_NOT_MOUNTED        4           Shared storage is not mounted
ANOTHER_TRANSACTION_IN_PROGRESS   5           Another transaction is in progress
INIT_FAILED                       6           Initialisation failed
SCHEDULING_ALREADY_DISABLED       7           Scheduler is already disabled
SCHEDULING_ALREADY_ENABLED        8           Scheduler is already enabled
NODE_NOT_INITIALISED              9           Node not initialised
ANOTHER_SCHEDULER_ACTIVE          10          Another scheduler is active
JOB_ALREADY_EXISTS                11          Job already exists
JOB_NOT_FOUND                     12          Job not found
INVALID_JOBNAME                   13          Jobname is invalid
INVALID_VOLNAME                   14          Volname is invalid
INVALID_SCHEDULE                  15          Schedule is invalid
INVALID_ARG                       16          Argument is invalid

Change-Id: Ia1da166659099f4c951fcdb4d755529e41167b80
BUG: 1218055
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
Reviewed-on: http://review.gluster.org/11005
Reviewed-by: Aravinda VK <avishwan@redhat.com>
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Krishnan Parthasarathi <kparthas@redhat.com>
2015-06-02 23:49:35 -07:00
Avra Sengupta
d67eb34b2a snapshot/scheduler: Do not enable scheduler if another scheduler is running
Check if another snapshot scheduler is running before
enabling the scheduler.

Also introducing a hidden option, disable_force

"snapshot_scheduler.py disable_force" will disable the
cli snapshot scheduler from any node, even though the node
has not been initialised for the scheduler, as long as the
shared storage is mounted

This option is hidden, because we don't want to encourage
users to use all commands from nodes that are not initialised.

Change-Id: I7ad941fbbab834225a36e740c61f8e740813e7c8
BUG: 1219442
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
Reviewed-on: http://review.gluster.org/10641
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
Tested-by: NetBSD Build System
Reviewed-by: Kaushal M <kaushal@redhat.com>
2015-05-28 19:25:18 -07:00
Avra Sengupta
466289f755 snapshot/scheduler: Use os.path.realpath() for path validation
In order to accomodate systems, where /var/run is a symlink to
/run, we are using os.path.realpath() for path validations.

Change-Id: I4eae536867ec6c88f92c762b92f5c1966b622bde
BUG: 1216931
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
Reviewed-on: http://review.gluster.org/10464
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Krishnan Parthasarathi <kparthas@redhat.com>
2015-05-05 02:44:52 -07:00
Avra Sengupta
0be5e3d7c5 snapshot/scheduler: Use shutil.move instead of os.rename()
os.rename is a wrapper on top of the rename function,
which fails with invalid cross-device link if /tmp
is a tmpfs. Hence using shutil.move

Change-Id: Ia026d2a810b725ccd398db895e612c53bc6a2f95
BUG: 1214574
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
Reviewed-on: http://review.gluster.org/10347
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
Reviewed-by: Aravinda VK <avishwan@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
2015-04-30 01:28:16 -07:00
Avra Sengupta
7a999ac6b1 snapshot/scheduler: Adhering to the common storage for scheduler
Making snapshot scheduler use the common storage
shared by nfs, snapshot and geo-rep. The meta volume
should be named as gluster_shared_storage, and it
should be mounted at "/var/run/gluster/shared_storage/".

Each component(nfs, snapshot, and geo-rep) should have
their own repos inside the shared storage, and perform
their operations in the shared storage

Change-Id: I4f670bf089c80037bd2b0716ddf743f48d7411ca
BUG: 1210344
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
Reviewed-on: http://review.gluster.org/10183
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Aravinda VK <avishwan@redhat.com>
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Krishnan Parthasarathi <kparthas@redhat.com>
2015-04-10 08:20:12 +00:00
Avra Sengupta
10ed06a5a1 snapshot/scheduler: Validate the number of entries in schedule
A valid schedule entry in snapshot schedule must have
six elements and adhere to the following format

* * * * *
| | | | |
| | | | +---- Day of the Week   (range: 1-7, 1 standing for Monday)
| | | +------ Month of the Year (range: 1-12)
| | +-------- Day of the Month  (range: 1-31)
| +---------- Hour              (range: 0-23)
+------------ Minute            (range: 0-59)

Change-Id: Idf03a3c43a461295dd3e2026bbcd0420319dd0e0
BUG: 1209408
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
Reviewed-on: http://review.gluster.org/10169
Reviewed-by: Aravinda VK <avishwan@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Krishnan Parthasarathi <kparthas@redhat.com>
2015-04-10 05:03:11 +00:00
Avra Sengupta
14dcabf21d snapshot/scheduler: Fix deleting of snapshot schedule
Check if the argument has an attribute before
validating the attribute.

Change-Id: Ia4c6c91c2fca2ec3e82b47d81fbc19a5e0f17eb4
BUG: 1210204
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
Reviewed-on: http://review.gluster.org/10168
Reviewed-by: Aravinda VK <avishwan@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Krishnan Parthasarathi <kparthas@redhat.com>
2015-04-10 05:01:39 +00:00
Avra Sengupta
3f21a34793 snapshot/scheduler: Only run if shared storage is mounted
Before running any snapshot scheduler op command,
verify if /var/run/gluster/snaps/shared_storage/ exists
and if the shared storage is mounted at it.

Change-Id: Ibb6ba6c01c227cacf9a19d1bf9264500373a4ed6
BUG: 1209112
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
Reviewed-on: http://review.gluster.org/10135
Reviewed-by: Aravinda VK <avishwan@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Krishnan Parthasarathi <kparthas@redhat.com>
2015-04-10 04:59:32 +00:00
Avra Sengupta
057d2bed41 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>
2015-04-07 06:50:45 -07:00
Avra Sengupta
1a22f3e10c snapshot/scheduler: Remove unwanted schedule enable check
Allow add, edit, list, delete of schedules even when 
snapshot scheduling is disabled.

Change-Id: Ie55ea7d6e9b3fccd914a786cc54bb323ac765a98
BUG: 1209117
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
Reviewed-on: http://review.gluster.org/10136
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Aravinda VK <avishwan@redhat.com>
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
2015-04-07 06:44:27 -07:00
Avra Sengupta
6816c7d466 snapshot/scheduler: Check the correctness of Jobname and Volname
Check for the correctness of Jobname and Volname. They should
not be empty, and should contain only one word. 

If this condition is met, the rest of the whitespaces are 
also striped, before processing the command.

Change-Id: I2c9503ab86456e0f4b37e31d483ee8b2d0b0e1af
BUG: 1209120
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
Reviewed-on: http://review.gluster.org/10137
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Aravinda VK <avishwan@redhat.com>
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
2015-04-07 06:37:32 -07:00
Avra Sengupta
f7a14c0fe5 snapshot/scheduler: Fix the snapshot create command.
The create command being executed was sent with wrong
parameters.

Change-Id: I9b3cf23b3a02cf8309d50bf70439ad02b37f191a
BUG: 1208067
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
Reviewed-on: http://review.gluster.org/10114
Reviewed-by: Aravinda VK <avishwan@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
2015-04-04 10:49:58 -07:00
Niels de Vos
61489c1725 build: correctly install the snap_scheduler tools
The current way of installing the snap-scheduler tools breaks the
building of RPMs. The tools should be installed in /usr/sbin and there
is no need to change the attributes/permissions after the installation.

Change-Id: I1b8e206748617fb000d956b1b5da52d126971c29
BUG: 1203557
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Reviewed-on: http://review.gluster.org/9939
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
2015-03-19 07:46:52 -07:00
Avra Sengupta
7c4461329b snapshot/scheduling: A cron based scheduler for snapshot scheduling
GlusterFS volume snapshot provides point-in-time copy
of a GlusterFS volume. Currently, GlusterFS volume
snapshots can be easily scheduled by setting up 
cron jobs on one of the nodes in the GlusterFS
trusted storage pool. This has a single point failure (SPOF),
as scheduled jobs can be missed if the node running the cron
jobs dies.

The solution to the above problems is addressed in this patch.
The snap_scheduler.py helper script expects the user to install
the argparse python module before using it.

Further details for the same are available at:

http://www.gluster.org/community/documentation/index.php/Features/Scheduling_of_Snapshot

Change-Id: I2c357af5b7d3e66f270d20eef50cdeecdcbe15c7
BUG: 1198027
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
Signed-off-by: Aravinda VK <avishwan@redhat.com>
Reviewed-on: http://review.gluster.org/9788
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
2015-03-18 18:31:54 -07:00