summaryrefslogtreecommitdiffstats
path: root/geo-replication/syncdaemon/gsyncd.py
diff options
context:
space:
mode:
Diffstat (limited to 'geo-replication/syncdaemon/gsyncd.py')
-rw-r--r--geo-replication/syncdaemon/gsyncd.py29
1 files changed, 26 insertions, 3 deletions
diff --git a/geo-replication/syncdaemon/gsyncd.py b/geo-replication/syncdaemon/gsyncd.py
index da5de0f40f..f41756a0b9 100644
--- a/geo-replication/syncdaemon/gsyncd.py
+++ b/geo-replication/syncdaemon/gsyncd.py
@@ -27,7 +27,7 @@ from ipaddr import IPAddress, IPNetwork
from gconf import gconf
from syncdutils import FreeObject, norm, grabpidfile, finalize
-from syncdutils import log_raise_exception, privileged
+from syncdutils import log_raise_exception, privileged, boolify
from syncdutils import GsyncdError, select, set_term_handler
from configinterface import GConffile, upgrade_config_file
import resource
@@ -37,6 +37,8 @@ from subprocess import PIPE
import subprocess
from changelogagent import agent, Changelog
from gsyncdstatus import set_monitor_status, GeorepStatus
+from libcxattr import Xattr
+import struct
ParseError = XET.ParseError if hasattr(XET, 'ParseError') else SyntaxError
@@ -253,9 +255,9 @@ def main_i():
action='callback', callback=store_abs)
op.add_option('-l', '--log-file', metavar='LOGF', type=str,
action='callback', callback=store_abs)
- op.add_option('--iprefix', metavar='LOGD', type=str,
+ op.add_option('--iprefix', metavar='LOGD', type=str,
action='callback', callback=store_abs)
- op.add_option('--changelog-log-file', metavar='LOGF', type=str,
+ op.add_option('--changelog-log-file', metavar='LOGF', type=str,
action='callback', callback=store_abs)
op.add_option('--log-file-mbr', metavar='LOGF', type=str,
action='callback', callback=store_abs)
@@ -355,6 +357,9 @@ def main_i():
action='callback', callback=store_local)
op.add_option('--delete', dest='delete', action='callback',
callback=store_local_curry(True))
+ op.add_option('--path-list', dest='path_list', action='callback',
+ type=str, callback=store_local)
+ op.add_option('--reset-sync-time', default=False, action='store_true')
op.add_option('--status-get', dest='status_get', action='callback',
callback=store_local_curry(True))
op.add_option('--debug', dest="go_daemon", action='callback',
@@ -572,6 +577,10 @@ def main_i():
delete = rconf.get('delete')
if delete:
logging.info('geo-replication delete')
+ # remove the stime xattr from all the brick paths so that
+ # a re-create of a session will start sync all over again
+ stime_xattr_name = getattr(gconf, 'master.stime_xattr_name', None)
+
# Delete pid file, status file, socket file
cleanup_paths = []
if getattr(gconf, 'pid_file', None):
@@ -604,6 +613,20 @@ def main_i():
# To delete temp files
for f in glob.glob(path + "*"):
_unlink(f)
+
+ reset_sync_time = boolify(gconf.reset_sync_time)
+ if reset_sync_time and stime_xattr_name:
+ path_list = rconf.get('path_list')
+ paths = []
+ for p in path_list.split('--path='):
+ stripped_path = p.strip()
+ if stripped_path != "":
+ # set stime to (0,0) to trigger full volume content resync
+ # to slave on session recreation
+ # look at master.py::Xcrawl hint: zero_zero
+ Xattr.lsetxattr(stripped_path, stime_xattr_name,
+ struct.pack("!II", 0, 0))
+
return
if restricted and gconf.allow_network: