summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCsaba Henk <csaba@gluster.com>2011-04-13 01:46:04 +0000
committerAnand Avati <avati@gluster.com>2011-04-13 04:43:02 -0700
commit13d1856a40122008dee35a96771f832945c220f8 (patch)
treee8a94a012e36987cec92fc2422b0e2420cbcf5af
parentea2e55bae0203b00dc4872a3333dce84cf7bef7d (diff)
syncdaemon: streamline user-visible messages (and control flow a bit, too)
Signed-off-by: Csaba Henk <csaba@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 2644 (no volume-mark, if the behaviour persists have to check if master gsyncd is running.) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2644
-rw-r--r--xlators/features/marker/utils/syncdaemon/master.py18
-rw-r--r--xlators/features/marker/utils/syncdaemon/resource.py4
2 files changed, 11 insertions, 11 deletions
diff --git a/xlators/features/marker/utils/syncdaemon/master.py b/xlators/features/marker/utils/syncdaemon/master.py
index f6403fcf6ef..02cf1be5b05 100644
--- a/xlators/features/marker/utils/syncdaemon/master.py
+++ b/xlators/features/marker/utils/syncdaemon/master.py
@@ -84,7 +84,9 @@ class GMaster(object):
self.volinfo_state = (uuid_preset and {'uuid': uuid_preset}, None)
# the actual volinfo we make use of
self.volinfo = None
+ self.terminate = False
+ def crawl_loop(self):
timo = int(gconf.timeout or 0)
if timo > 0:
def keep_alive():
@@ -108,7 +110,7 @@ class GMaster(object):
t = Thread(target=keep_alive)
t.setDaemon(True)
t.start()
- while True:
+ while not self.terminate:
self.crawl()
def add_job(self, path, label, job, *a, **kw):
@@ -166,7 +168,7 @@ class GMaster(object):
def crawl(self, path='.', xtl=None):
if path == '.':
if self.start:
- logging.info("crawl took %.6f" % (time.time() - self.start))
+ logging.info("... done, took %.6f seconds" % (time.time() - self.start))
time.sleep(1)
self.start = time.time()
volinfo_sys = self.get_sys_volinfo()
@@ -183,14 +185,14 @@ class GMaster(object):
if self.volinfo:
if self.volinfo['retval']:
raise RuntimeError ("master is corrupt")
- logging.info("Crawling as %s (%s master mode) ..." % \
- (self.uuid, self.inter_master and "intermediate" or "primary"))
+ logging.info("%s master with volume id %s ..." % \
+ (self.inter_master and "intermediate" or "primary", self.uuid))
else:
if self.inter_master:
- logging.info("Crawling: waiting for being synced from %s" % \
+ logging.info("waiting for being synced from %s ..." % \
self.volinfo_state[self.KFGN]['uuid'])
else:
- logging.info("Crawling: waiting for volume info")
+ logging.info("waiting for volume info ...")
return
logging.debug("entering " + path)
if not xtl:
@@ -218,8 +220,8 @@ class GMaster(object):
self.change_seen = False
logging.info("finished turn #%s/%s" % (self.turns, self.total_turns))
if self.turns == self.total_turns:
- logging.info("reached turn limit, terminating.")
- os.kill(os.getpid(), signal.SIGTERM)
+ logging.info("reached turn limit")
+ self.terminate = True
return
if path == '.':
self.change_seen = True
diff --git a/xlators/features/marker/utils/syncdaemon/resource.py b/xlators/features/marker/utils/syncdaemon/resource.py
index d1df57d0195..9bf1e441dc6 100644
--- a/xlators/features/marker/utils/syncdaemon/resource.py
+++ b/xlators/features/marker/utils/syncdaemon/resource.py
@@ -220,8 +220,6 @@ class Server(object):
tuple(int(x,16) for x in re.findall('(?:[\da-f]){2}', dct['uuid'])) +
(dct['retval'],) + dct['volume_mark'][0:2] + (dct['timeout'],)))
Xattr.lsetxattr('.', key, val)
- else:
- logging.info('no volume-mark, if the behaviour persists have to check if master gsyncd is running')
cls.last_keep_alive += 1
return cls.last_keep_alive
@@ -427,7 +425,7 @@ class GLUSTER(AbstractUrl, SlaveLocal, SlaveRemote):
def service_loop(self, *args):
if args:
- GMaster(self, args[0]).crawl()
+ GMaster(self, args[0]).crawl_loop()
else:
sup(self, *args)