summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAvra Sengupta <asengupt@redhat.com>2015-04-09 19:39:12 +0530
committerKrishnan Parthasarathi <kparthas@redhat.com>2015-04-10 08:20:12 +0000
commit7a999ac6b1d0dad7e0b6ab6ee0868e97f76fada6 (patch)
tree7325526e3052b957b6f2e03bbb94a6d6e650b901
parentda48df4e91b69b8f586d658de9573287cad2ce64 (diff)
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>
-rwxr-xr-xextras/snap_scheduler/gcron.py4
-rwxr-xr-xextras/snap_scheduler/snap_scheduler.py25
2 files changed, 21 insertions, 8 deletions
diff --git a/extras/snap_scheduler/gcron.py b/extras/snap_scheduler/gcron.py
index e52a8c8c30c..e67e48cc932 100755
--- a/extras/snap_scheduler/gcron.py
+++ b/extras/snap_scheduler/gcron.py
@@ -19,9 +19,9 @@ import logging.handlers
import fcntl
-GCRON_TASKS = "/var/run/gluster/snaps/shared_storage/glusterfs_snap_cron_tasks"
+GCRON_TASKS = "/var/run/gluster/shared_storage/snaps/glusterfs_snap_cron_tasks"
GCRON_CROND_TASK = "/etc/cron.d/glusterfs_snap_cron_tasks"
-LOCK_FILE_DIR = "/var/run/gluster/snaps/shared_storage/lock_files/"
+LOCK_FILE_DIR = "/var/run/gluster/shared_storage/snaps/lock_files/"
log = logging.getLogger("gcron-logger")
start_time = 0.0
diff --git a/extras/snap_scheduler/snap_scheduler.py b/extras/snap_scheduler/snap_scheduler.py
index d383bf23e12..7353e4f2df7 100755
--- a/extras/snap_scheduler/snap_scheduler.py
+++ b/extras/snap_scheduler/snap_scheduler.py
@@ -23,14 +23,14 @@ from errno import EEXIST
SCRIPT_NAME = "snap_scheduler"
scheduler_enabled = False
log = logging.getLogger(SCRIPT_NAME)
-SHARED_STORAGE_DIR="/var/run/gluster/snaps/shared_storage/"
-GCRON_DISABLED = SHARED_STORAGE_DIR+"gcron_disabled"
-GCRON_ENABLED = SHARED_STORAGE_DIR+"gcron_enabled"
-GCRON_TASKS = SHARED_STORAGE_DIR+"glusterfs_snap_cron_tasks"
+SHARED_STORAGE_DIR="/var/run/gluster/shared_storage"
+GCRON_DISABLED = SHARED_STORAGE_DIR+"/snaps/gcron_disabled"
+GCRON_ENABLED = SHARED_STORAGE_DIR+"/snaps/gcron_enabled"
+GCRON_TASKS = SHARED_STORAGE_DIR+"/snaps/glusterfs_snap_cron_tasks"
GCRON_CROND_TASK = "/etc/cron.d/glusterfs_snap_cron_tasks"
-LOCK_FILE_DIR = SHARED_STORAGE_DIR+"lock_files/"
+LOCK_FILE_DIR = SHARED_STORAGE_DIR+"/snaps/lock_files/"
LOCK_FILE = LOCK_FILE_DIR+"lock_file"
-TMP_FILE = SHARED_STORAGE_DIR+"tmp_file"
+TMP_FILE = SHARED_STORAGE_DIR+"/snaps/tmp_file"
GCRON_UPDATE_TASK = "/etc/cron.d/gcron_update_task"
tasks = {}
longest_field = 12
@@ -526,6 +526,19 @@ def main():
output("Failed: Shared storage is not mounted at "+SHARED_STORAGE_DIR)
return ret
+ if not os.path.exists(SHARED_STORAGE_DIR+"/snaps/"):
+ try:
+ os.makedirs(SHARED_STORAGE_DIR+"/snaps/")
+ except IOError as (errno, strerror):
+ if errno != EEXIST:
+ log.error("Failed to create %s : %s", SHARED_STORAGE_DIR+"/snaps/", strerror)
+ output("Failed to create %s. Error: %s"
+ % (SHARED_STORAGE_DIR+"/snaps/", strerror))
+
+ if not os.path.exists(GCRON_ENABLED):
+ f = os.open(GCRON_ENABLED, os.O_CREAT | os.O_NONBLOCK, 0644)
+ os.close(f)
+
if not os.path.exists(LOCK_FILE_DIR):
try:
os.makedirs(LOCK_FILE_DIR)