diff options
author | Kotresh HR <khiremat@redhat.com> | 2015-04-10 17:03:02 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2015-04-27 21:02:21 -0700 |
commit | b4d909003851e327d2cf448f9409cf5e31893579 (patch) | |
tree | 91b33c1d8ddb18997af7c6eb462dd53cce9a081d /geo-replication | |
parent | ddc8dece96b0c04fca564aa3990f484119713720 (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 have create a directory called 'geo-rep'
in the meta-volume and all the lock files are created
inside it.
Change-Id: I82d0bff9be191f75f643606a9a21d53559047ac4
BUG: 1210344
Signed-off-by: Kotresh HR <khiremat@redhat.com>
Reviewed-on: http://review.gluster.org/10196
Reviewed-by: Aravinda VK <avishwan@redhat.com>
Tested-by: NetBSD Build System
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'geo-replication')
-rw-r--r-- | geo-replication/syncdaemon/gsyncd.py | 5 | ||||
-rw-r--r-- | geo-replication/syncdaemon/master.py | 30 | ||||
-rw-r--r-- | geo-replication/syncdaemon/monitor.py | 20 | ||||
-rw-r--r-- | geo-replication/syncdaemon/syncdutils.py | 3 |
4 files changed, 23 insertions, 35 deletions
diff --git a/geo-replication/syncdaemon/gsyncd.py b/geo-replication/syncdaemon/gsyncd.py index 41055eaae64..b9ee5aec8c7 100644 --- a/geo-replication/syncdaemon/gsyncd.py +++ b/geo-replication/syncdaemon/gsyncd.py @@ -258,8 +258,9 @@ def main_i(): type=int, default=1) op.add_option('--changelog-archive-format', metavar='N', type=str, default="%Y%m") - op.add_option('--meta-volume', metavar='N', - type=str, default="") + op.add_option('--use-meta-volume', default=False, action='store_true') + op.add_option('--meta-volume-mnt', metavar='N', + type=str, default="/var/run/gluster/shared_storage") op.add_option( '--turns', metavar='N', type=int, default=0, help=SUPPRESS_HELP) op.add_option('--allow-network', metavar='IPS', default='') diff --git a/geo-replication/syncdaemon/master.py b/geo-replication/syncdaemon/master.py index b311f4d3591..babf94cbc11 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() diff --git a/geo-replication/syncdaemon/monitor.py b/geo-replication/syncdaemon/monitor.py index e50893c793f..029726c7a5a 100644 --- a/geo-replication/syncdaemon/monitor.py +++ b/geo-replication/syncdaemon/monitor.py @@ -405,26 +405,6 @@ def distribute(*resources): def monitor(*resources): - # Mount geo-rep management volume - if gconf.meta_volume: - mgmt_mnt = os.path.join(gconf.working_dir, gconf.meta_volume) - if not os.path.exists(mgmt_mnt): - try: - os.makedirs(mgmt_mnt) - except OSError: - ex = sys.exc_info()[1] - if ex.errno == EEXIST: - pass - else: - raise - - 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() - # Check if gsyncd restarted in pause state. If # yes, send SIGSTOP to negative of monitor pid # to go back to pause state. diff --git a/geo-replication/syncdaemon/syncdutils.py b/geo-replication/syncdaemon/syncdutils.py index 5037004d9a5..dbbc31deb2a 100644 --- a/geo-replication/syncdaemon/syncdutils.py +++ b/geo-replication/syncdaemon/syncdutils.py @@ -16,7 +16,6 @@ import fcntl import shutil import logging import socket -from subprocess import Popen, PIPE from threading import Lock, Thread as baseThread from errno import EACCES, EAGAIN, EPIPE, ENOTCONN, ECONNABORTED from errno import EINTR, ENOENT, EPERM, ESTALE, errorcode @@ -217,8 +216,6 @@ def finalize(*a, **kw): if sys.exc_info()[0] == OSError: pass - # TODO: Clean up mgmt volume mount point only monitor dies - if gconf.log_exit: logging.info("exiting.") sys.stdout.flush() |