summaryrefslogtreecommitdiffstats
path: root/extras/snap_scheduler
Commit message (Collapse)AuthorAgeFilesLines
* python: remove shebangs of non-main scripts and make others executableNiels de Vos2018-10-021-1/+0
| | | | | | | | | | | | | | | Some of the scripts that have a #!/usr/bin/python3 shebang do not have a main() like function. These scripts will not get executed but only imported. They do not need the shebang. A few others are not installed with 'make install', but do have a main() like function. These scripts are expected to be used by developers for different tasks (mostly code generation). Marking these scripts executable to make it easier to identify them. Change-Id: I73541471deb7e0830766b804786244e73dfe4221 Updates: #411 Signed-off-by: Niels de Vos <ndevos@redhat.com>
* python3: Fix python3 compatibilityNigel Babu2018-09-242-42/+44
| | | | | | Updates: #411 Change-Id: I7c1eaa92cd4ac05c3667b760e0db2cddcfbbaed8 Signed-off-by: Nigel Babu <nigelb@redhat.com>
* core: python3Kaleb S. KEITHLEY2018-09-033-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | see https://review.gluster.org/#/c/19788/, https://review.gluster.org/#/c/19871/, https://review.gluster.org/#/c/19952/, https://review.gluster.org/#/c/20104/, https://review.gluster.org/#/c/20162/, https://review.gluster.org/#/c/20185/, https://review.gluster.org/#/c/20207/, https://review.gluster.org/#/c/20227/, https://review.gluster.org/#/c/20307/, https://review.gluster.org/#/c/20320/, https://review.gluster.org/#/c/20332/, https://review.gluster.org/#/c/20364/, https://review.gluster.org/#/c/20441/, and https://review.gluster.org/#/c/20484 shebangs changed from /usr/bin/python2 to /usr/bin/python3. (Reminder, various distribution packaging guidelines require use of explicit python version and don't allow '#!/usr/bin/env python', regardless of how handy that idiom may be.) glusterfs.spec(.in) package python{2,3}-gluster and python2 or python3 dependencies as appropriate. configure(.ac): + test for and use python2 or python3 as appropriate. If build machine has python2 and python3, use python3. Override by setting PYTHON=/usr/bin/python2 when running configure. + PYTHONDEV_CPPFLAGS from python[23]-config --includes is a better match to the original python sysconfig.get_python_inc(). All those other extraneous flags breaks the build. + Only change the shebangs once. Changing them over and over again, e.g., during a `make glusterrpms` in extras/LinuxRPM just sends make (is it really make that's looping?) into an infinite loop. If you figure out why, let me know. + Oldest python2 is python2.6 on CentOS 6 and Debian 8 (Jessie). Everything else has 2.7 or 3.x + logic from https://review.gluster.org/c/glusterfs/+/21050, which needs to be removed/merged after that patch is merged. Builds on CentOS 6, CentOS 7, Fedora 28, Fedora rawhide, and the mysterious RHEL > 7. Change-Id: Idae21d3b6f58b32372e1daa0d234e491e563198f updates: #411 Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
* All: run codespell on the code and fix issues.Yaniv Kaul2018-07-221-6/+6
| | | | | | | | | | | | Please review, it's not always just the comments that were fixed. I've had to revert of course all calls to creat() that were changed to create() ... Only compile-tested! Change-Id: I7d02e82d9766e272a7fd9cc68e51901d69e5aab5 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* gcron: create the lockfile if it is missingNiels de Vos2018-06-181-1/+1
| | | | | | | | | The lockfile for the job may not exist yet. If that is the case, it should be created upon the first time it is accessed. Change-Id: I4da2b3ecdb79cc63ed82cc7bfa026c8f08d4d043 Fixes: bz#1590193 Signed-off-by: Niels de Vos <ndevos@redhat.com>
* gcron: catch OSError as well as IOErrorNiels de Vos2018-06-181-2/+2
| | | | | | | | | | In case os.open() fails because the file does not exist, an OSError is raised. To prevent the script to abort uncleanly, catch the OSError in addition to the IOError. Change-Id: I48e5b23e17d63639cc33db51b4229249a9887880 Fixes: bz#1590193 Signed-off-by: Niels de Vos <ndevos@redhat.com>
* core/various: python3 compat, prepare for python2 -> python3Kaleb S. KEITHLEY2018-05-302-12/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | see https://review.gluster.org/#/c/19788/ and https://review.gluster.org/#/c/19871/ Selected small fixes from 2to3 utility. Specifically apply, basestring, funcattrs, idioms, numliterals, set_literal, types, urllib, zip Note: these 2to3 fixes report no changes are necessary: exec, execfile, exitfunc, filter, getcwdu, intern, itertools, metaclass, methodattrs, ne, next, nonzero, operator, paren, raw_input, reduce, reload, renames, repr, standarderror, sys_exc, throw, tuple_params, xreadlines. Any 2to3 fixes not in the above two lists have more extensive changes which will follow in separate patches. most unicode changes suggested by 2to3 will need to be applied at the same time as changing the shebangs from python2 to python3. Prashanth notes that unicode strings in py2 need 'u' prefix; unicode strings in py3 3.0, 3.1, and 3.2 a 'u' prefix will throw an error, but in py3 3.3+ it is legal (or just ignored). All Linux dists we care about have 3.3 or later so we can leave 'u' prefixes on unicode strings. Change-Id: I49bba2f328b0ee24b9a8115a7183be979981563e updates: #411 Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
* core/build/various: python3 compat, prepare for python2 -> python3Kaleb S. KEITHLEY2018-04-123-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Note 1) we're not supposed to be using #!/usr/bin/env python, see https://fedoraproject.org/wiki/Packaging:Guidelines?rd=Packaging/Guidelines#Shebang_lines Note 2) we're also not supposed to be using "!/usr/bin/python, see https://fedoraproject.org/wiki/Changes/Avoid_usr_bin_python_in_RPM_Build#Quick_Opt-Out The previous patch (https://review.gluster.org/19767) tried to do too much in one patch, so it was abandoned. This patch does two things: 1) minor cleanup of configure(.ac) to explicitly use python2 2) change all the shebang lines to #!/usr/bin/python2 and add them where they were missing based on warnings emitted during rpmbuild. In a follow-up patch python2 will eventually be changed to python3. Before that python2-isms (e.g. print, string.join(), etc.) need to be converted to python3. Some of those can be rewritten in version agnostic python. E.g. print statements become print() with "from __future_ import print_function". The python 2to3 utility will be used for some of those. Also Aravinda has given guidance in the comments to the first patch for changes. updates: #411 Change-Id: I471730962b2526022115a1fc33629fb078b74338 Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
* build: add --without-server optionNiels de Vos2018-02-191-0/+2
| | | | | | | | | | | | | | | | With Gluster 4.0 we will not provide the server components for EL6 and older. At one point Gluster 4.x will get GlusterD2, which requires Golang tools in the distribution. EL6 does not contain these at the moment. With this change, it is possible to `./configure --without-server` which prevents building glusterd and the xlators for the bricks. Building RPMs can pass `--without server` and the glusterfs-server sub-package will not be created. Change-Id: I97f5ccf9f2c76e60d9af83915fc59fae57ad6d25 BUG: 1074947 Signed-off-by: Niels de Vos <ndevos@redhat.com>
* snapshot/scheduler: handle the exception when SELinux is absentRishabh Dave2017-10-311-2/+7
| | | | | | | | | When SELinux is absent on an given system, snapshot_scheduler.py raises an exception; handle it and report it in the log. Change-Id: I21bc179e090d34f8061063e6d662521ee5046cce BUG: 1502253 Signed-off-by: Rishabh Dave <rishabhddave@gmail.com>
* snapshot/scheduler: Set sebool cron_system_cronjob_use_shares to onAvra Sengupta2017-02-221-0/+90
| | | | | | | | | | | | | | | | | | | Rhel 7.1 onwards, the user has to manually set the selinux boolean 'cron_system_cronjob_use_shares' as on, if selinux is enabled for snapshot scheduler to work. With this fix, we are automating that bit, in init step of snapshot scheduler Change-Id: I5c1d23c14133c64770e84a77999ce647526f6711 BUG: 1395643 Signed-off-by: Avra Sengupta <asengupt@redhat.com> Reviewed-on: https://review.gluster.org/15857 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Aravinda VK <avishwan@redhat.com>
* snapshot/scheduler: Removing dependency of scheduler on eventingAvra Sengupta2016-11-201-16/+61
| | | | | | | | | | | | Change-Id: I7de156d8186c32092ec5e9d174d023f4782947c0 BUG: 1396364 Signed-off-by: Avra Sengupta <asengupt@redhat.com> Reviewed-on: http://review.gluster.org/15876 Reviewed-by: Aravinda VK <avishwan@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
* snapshot/eventsapi: Integrate snapshot events with eventsapiAvra Sengupta2016-09-013-3/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. EVENT_SNAPSHOT_CREATED : snapshot_name=snap1 volume_name=test_vol snapshot_uuid=26dd6c52-6021-40b1-a507-001a80401d70 2. EVENT_SNAPSHOT_CREATE_FAILED : snapshot_name=snap1 volume_name=test_vol error=Snapshot snap1 already exists 3. EVENT_SNAPSHOT_ACTIVATED : snapshot_name=snap1 snapshot_uuid=26dd6c52-6021-40b1-a507-001a80401d70 4. EVENT_SNAPSHOT_ACTIVATE_FAILED: snapshot_name=snap1 error=Snapshot snap1 is already activated. 5. EVENT_SNAPSHOT_DEACTIVATED : snapshot_name=snap1 snapshot_uuid=26dd6c52-6021-40b1-a507-001a80401d70 6. EVENT_SNAPSHOT_DEACTIVATE_FAILED : snapshot_name=snap3 error=Snapshot (snap3) does not exist. 7. EVENT_SNAPSHOT_SOFT_LIMIT_REACHED : volume_name=test_vol volume_id=2ace2616-5591-4b9b-be2a-38592dda5758 8. EVENT_SNAPSHOT_HARD_LIMIT_REACHED : volume_name=test_vol volume_id=2ace2616-5591-4b9b-be2a-38592dda5758 9. EVENT_SNAPSHOT_RESTORED : snapshot_name=snap1 volume_name=test_vol snapshot_uuid=3a840ec5-08da-4f2b-850d-1d5539a5d14d 10. EVENT_SNAPSHOT_RESTORE_FAILED : snapshot_name=snap10 error=Snapshot (snap10) does not exist 11. EVENT_SNAPSHOT_DELETED : snapshot_name=snap1 snapshot_uuid=d9ff3d4f-f579-4345-a4da-4f9353f0950c 12. EVENT_SNAPSHOT_DELETE_FAILED : snapshot_name=snap2 error=Snapshot (snap2) does not exist 13. EVENT_SNAPSHOT_CLONED : clone_uuid=93ba9f06-cb9c-4ace-aa52-2616e7f31022 snapshot_name=snap1 clone_name=clone2 14. EVENT_SNAPSHOT_CLONE_FAILED : snapshot_name=snap1 clone_name=clone2 error=Volume with name:clone2 already exists 15. EVENT_SNAPSHOT_CONFIG_UPDATED : auto-delete=enable config_type=system_config config_type=volume_config hard_limit=100 16. EVENT_SNAPSHOT_CONFIG_UPDATE_FAILED : error=Invalid snap-max-soft-limit 110. Expected range 1 - 100 17. EVENT_SNAPSHOT_SCHEDULER_INITIALISED : status=Success 18. EVENT_SNAPSHOT_SCHEDULER_INIT_FAILED 19. EVENT_SNAPSHOT_SCHEDULER_ENABLED : status=Successfuly Enabled 20. EVENT_SNAPSHOT_SCHEDULER_ENABLE_FAILED : error=Snapshot scheduler is already enabled. 21. EVENT_SNAPSHOT_SCHEDULER_SCHEDULE_ADDED : status=Successfuly added job job1 22. EVENT_SNAPSHOT_SCHEDULER_SCHEDULE_ADD_FAILED : status=Failed to add job job1 error=The job already exists. 23. EVENT_SNAPSHOT_SCHEDULER_SCHEDULE_EDITED : status=Successfuly edited job job1 24. EVENT_SNAPSHOT_SCHEDULER_SCHEDULE_EDIT_FAILED : status=Failed to edit job job2 error=The job cannot be found. 25. EVENT_SNAPSHOT_SCHEDULER_SCHEDULE_DELETED : status=Successfuly deleted job job1 26. EVENT_SNAPSHOT_SCHEDULER_SCHEDULE_DELETE_FAILED : status=Failed to delete job job1 error=The job cannot be found. 27. EVENT_SNAPSHOT_SCHEDULER_DISABLED : status=Successfuly Disabled 28. EVENT_SNAPSHOT_SCHEDULER_DISABLE_FAILED : error=Snapshot scheduler is already disabled. Change-Id: I3479cc3fb7af3c76ded67cf289f99547d0a55d21 BUG: 1370567 Signed-off-by: Avra Sengupta <asengupt@redhat.com> Reviewed-on: http://review.gluster.org/15329 Tested-by: Aravinda VK <avishwan@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
* snapshot/scheduler: Check if volume exists before adding/editing schedulesAvra Sengupta2015-08-231-21/+67
| | | | | | | | | | | | | | | Before adding or editing a scheduler, check if the volume name provided in the schedule, exists in the cluster or not. Added return code VOLUME_DOES_NOT_EXIST(17) for the same. Change-Id: Ia3fe3cc1e1568ddd10f9193bbf40a098f0fe990a BUG: 1213349 Signed-off-by: Avra Sengupta <asengupt@redhat.com> Reviewed-on: http://review.gluster.org/11830 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: mohammed rafi kc <rkavunga@redhat.com> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
* snapshot/scheduler: Output correction of initialisationAvra Sengupta2015-08-231-2/+2
| | | | | | | | | | | Change-Id: I4a6e00805da7b254b8b08e7bb142960fb6c64923 BUG: 1218164 Signed-off-by: Avra Sengupta <asengupt@redhat.com> Reviewed-on: http://review.gluster.org/11924 Tested-by: Gluster Build System <jenkins@build.gluster.com> Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: mohammed rafi kc <rkavunga@redhat.com> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
* snapshot/scheduler: Use /var/run/gluster/shared_storage/snaps/tmp_fileAvra Sengupta2015-07-081-6/+6
| | | | | | | | | | | | | | | | | | | for writing data into tmp file and then making an atomic rename to the required filename. The reason for using this location is that it adheres to the selinux policies. Also moving the update of the current_scheduler file, under the lock so as to avoid multiple writes Change-Id: I61e62b5daf6f1bce2319f64f7b1dfb8b93726077 BUG: 1239269 Signed-off-by: Avra Sengupta <asengupt@redhat.com> Reviewed-on: http://review.gluster.org/11535 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
* snapshot/scheduler: Reload /etc/cron.d/glusterfs_snap_cron_tasks when shared ↵Avra Sengupta2015-06-111-0/+33
| | | | | | | | | | | | | | | | | 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>
* snapshot/scheduler: Check if GCRON_TASKS exists beforeAvra Sengupta2015-06-101-0/+4
| | | | | | | | | | | | 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>
* snapshot/scheduler: Handle OSError in os. callbacksAvra Sengupta2015-06-091-8/+8
| | | | | | | | | | | | | 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>
* snapshot/scheduler: Modified main() function to take arguments.nnDarshan2015-06-041-3/+3
| | | | | | | | | | | | | | 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>
* snapshot/scheduler: Return proper error code in case of failureAvra Sengupta2015-06-021-61/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* snapshot/scheduler: Do not enable scheduler if another scheduler is runningAvra Sengupta2015-05-281-2/+85
| | | | | | | | | | | | | | | | | | | | | | | 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>
* snapshot/scheduler: Use os.path.realpath() for path validationAvra Sengupta2015-05-051-1/+1
| | | | | | | | | | | | | | 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>
* snapshot/scheduler: Use shutil.move instead of os.rename()Avra Sengupta2015-04-301-2/+3
| | | | | | | | | | | | | | | 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>
* snapshot/scheduler: Adhering to the common storage for schedulerAvra Sengupta2015-04-102-8/+21
| | | | | | | | | | | | | | | | | | | | 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>
* snapshot/scheduler: Validate the number of entries in scheduleAvra Sengupta2015-04-101-0/+12
| | | | | | | | | | | | | | | | | | | | | | 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>
* snapshot/scheduler: Fix deleting of snapshot scheduleAvra Sengupta2015-04-101-9/+10
| | | | | | | | | | | | | | 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>
* snapshot/scheduler: Only run if shared storage is mountedAvra Sengupta2015-04-101-39/+70
| | | | | | | | | | | | | | | 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>
* snapshot/scheduler: Don't append timestamp in scheduled snapshotsAvra Sengupta2015-04-071-7/+11
| | | | | | | | | | | | | | | | | | | | | 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>
* snapshot/scheduler: Remove unwanted schedule enable checkAvra Sengupta2015-04-071-109/+74
| | | | | | | | | | | | | | 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>
* snapshot/scheduler: Check the correctness of Jobname and VolnameAvra Sengupta2015-04-071-0/+27
| | | | | | | | | | | | | | | | | 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>
* snapshot/scheduler: Fix the snapshot create command.Avra Sengupta2015-04-041-1/+2
| | | | | | | | | | | | 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>
* build: correctly install the snap_scheduler toolsNiels de Vos2015-03-191-1/+1
| | | | | | | | | | | | | 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>
* snapshot/scheduling: A cron based scheduler for snapshot schedulingAvra Sengupta2015-03-184-0/+803
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>