summaryrefslogtreecommitdiffstats
path: root/geo-replication/syncdaemon/master.py
diff options
context:
space:
mode:
authorKotresh HR <khiremat@redhat.com>2015-04-10 17:03:02 +0530
committerVijay Bellur <vbellur@redhat.com>2015-05-04 02:25:23 -0700
commit06cc6b5e4d59619b6c2b99ab86a44bf18c18ad1e (patch)
tree166f816cea38e21874e79ecbb0116a890a757a37 /geo-replication/syncdaemon/master.py
parentf972f21fa810f4c14701a14b8a1cd1f3db92f313 (diff)
geo-rep: Adhering to the common storage for geo-rep
Making geo-rep 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/". Geo-rep will create a directory called 'geo-rep' in the meta-volume and all the lock files are created inside it. BUG: 1217939 Change-Id: I1d88798376d68340e2b2eff018c7e4f0121a608a Signed-off-by: Kotresh HR <khiremat@redhat.com> Reviewed-on: http://review.gluster.org/10196 Reviewed-on: http://review.gluster.org/10503 Tested-by: NetBSD Build System Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Aravinda VK <avishwan@redhat.com>
Diffstat (limited to 'geo-replication/syncdaemon/master.py')
-rw-r--r--geo-replication/syncdaemon/master.py30
1 files changed, 20 insertions, 10 deletions
diff --git a/geo-replication/syncdaemon/master.py b/geo-replication/syncdaemon/master.py
index 7707efa7cea..0de384b73b0 100644
--- a/geo-replication/syncdaemon/master.py
+++ b/geo-replication/syncdaemon/master.py
@@ -454,9 +454,23 @@ class GMasterCommon(object):
"""Take management volume lock """
bname = str(gconf.volume_id) + "_subvol_" + str(gconf.subvol_num) \
+ ".lock"
- path = os.path.join(gconf.working_dir, gconf.meta_volume, bname)
+ mgmt_lock_dir = os.path.join(gconf.meta_volume_mnt, "geo-rep")
+ path = os.path.join(mgmt_lock_dir, bname)
logging.debug("lock_file_path: %s" % path)
- fd = os.open(path, os.O_CREAT | os.O_RDWR)
+ try:
+ fd = os.open(path, os.O_CREAT | os.O_RDWR)
+ except OSError:
+ ex = sys.exc_info()[1]
+ if ex.errno == ENOENT:
+ logging.info("Creating geo-rep directory in meta volume...")
+ try:
+ os.makedirs(mgmt_lock_dir)
+ except OSError:
+ ex = sys.exc_info()[1]
+ if ex.errno == EEXIST:
+ pass
+ else:
+ raise
try:
fcntl.lockf(fd, fcntl.LOCK_EX | fcntl.LOCK_NB)
except:
@@ -472,16 +486,12 @@ class GMasterCommon(object):
def should_crawl(self):
- if not gconf.meta_volume:
+ if not gconf.use_meta_volume:
return gconf.glusterd_uuid in self.master.server.node_uuid()
- mgmt_mnt = os.path.join(gconf.working_dir, gconf.meta_volume)
- if not os.path.ismount(mgmt_mnt):
- po = Popen(["mount", "-t", "glusterfs", "localhost:%s"
- % gconf.meta_volume, mgmt_mnt], stdout=PIPE,
- stderr=PIPE)
- po.wait()
- po.terminate_geterr()
+ if not os.path.ismount(gconf.meta_volume_mnt):
+ logging.error("Meta-volume is not mounted. Worker Exiting...")
+ sys.exit(1)
return self.mgmt_lock()