BIND 10 master, updated. c7bb38c99c9afa049c7336ea3f827aa41a1b2ea0 [master] update new entry
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Apr 6 08:42:05 UTC 2011
The branch, master has been updated
via c7bb38c99c9afa049c7336ea3f827aa41a1b2ea0 (commit)
via 1c269cbdc76f5dc2baeb43387c4d7ccc6dc863d2 (commit)
via d8c55247d888cd9f5e2e474e49f8bd97b96623cf (commit)
via ba876505740d4782b58169848605af49325b11ed (commit)
via 4d505b0cef54209575173d52e4f9a3e6e244dab3 (commit)
via 6ff2a83cb7a6c04a258e84818257fe6eda9634a6 (commit)
via 682ea37cfb7e20366521fd48fc98826a21344942 (commit)
via de3c708f962db8fe15287c9a5704d3aa8b257b03 (commit)
via 9b90408108142c710c2adb403e61af374fe1b24c (commit)
via 00cb2ff77044b185fe80dcf3f577a9b4793638b0 (commit)
via 00b37501ae500c81657b1727dfff0105c2202f07 (commit)
via 7b794844b6afc77cf05bb93828477fe5cc48408d (commit)
via 75b29aaa4aabf843b0d80400eb2cf8c39c4dd8f0 (commit)
from 1ec7e1ccd24b25501902e0fc29fddf400f2ebdb1 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit c7bb38c99c9afa049c7336ea3f827aa41a1b2ea0
Author: Naoki Kambe <kambe at jprs.co.jp>
Date: Wed Apr 6 08:41:21 2011 +0000
[master] update new entry
commit 1c269cbdc76f5dc2baeb43387c4d7ccc6dc863d2
Merge: d8c55247d888cd9f5e2e474e49f8bd97b96623cf 1ec7e1ccd24b25501902e0fc29fddf400f2ebdb1
Author: Naoki Kambe <kambe at jprs.co.jp>
Date: Wed Apr 6 08:39:18 2011 +0000
Merge branch 'master' of ssh://bind10.isc.org/var/bind10/git/bind10
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 10 ++++++++
src/bin/bind10/bind10.py.in | 22 ++++++++---------
src/bin/bind10/bob.spec | 5 ++++
src/bin/bind10/tests/bind10_test.py.in | 40 +++++++++++++++++++++++++++++++-
src/bin/stats/b10-stats.8 | 19 +++++++++++++-
src/bin/stats/b10-stats.xml | 6 +++-
src/bin/stats/stats.py.in | 12 ++++++---
src/bin/stats/tests/b10-stats_test.py | 11 ++++++--
8 files changed, 101 insertions(+), 24 deletions(-)
-----------------------------------------------------------------------
diff --git a/ChangeLog b/ChangeLog
index b426fb2..ae89d67 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+ 213. [bug] naokikambe
+ Solved incorrect datetime of "bind10.boot_time" and also added a new
+ command "sendstats" for Bob. This command is to send statistics data to
+ the stats daemon immediately. The solved problem is that statistics
+ data doesn't surely reach to the daemon because Bob sent statistics
+ data to the daemon while it is starting. So the daemon invokes the
+ command for Bob after it starts up. This command is also useful for
+ resending statistics data via bindctl manually.
+ (Trac #521, git 1c269cbdc76f5dc2baeb43387c4d7ccc6dc863d2)
+
212. [bug] naokikambe
Fixed that the ModuleCCSession object may group_unsubscribe in the
closed CC session in being deleted.
diff --git a/src/bin/bind10/bind10.py.in b/src/bin/bind10/bind10.py.in
index 9224ffa..e6504e1 100755
--- a/src/bin/bind10/bind10.py.in
+++ b/src/bin/bind10/bind10.py.in
@@ -297,7 +297,7 @@ class BoB:
def command_handler(self, command, args):
if self.verbose:
- sys.stdout.write("[bind10] Boss got command: " + command + "\n")
+ sys.stdout.write("[bind10] Boss got command: " + str(command) + "\n")
answer = isc.config.ccsession.create_answer(1, "command not implemented")
if type(command) != str:
answer = isc.config.ccsession.create_answer(1, "bad command")
@@ -305,6 +305,15 @@ class BoB:
if command == "shutdown":
self.runnable = False
answer = isc.config.ccsession.create_answer(0)
+ elif command == "sendstats":
+ # send statistics data to the stats daemon immediately
+ cmd = isc.config.ccsession.create_command(
+ 'set', { "stats_data": {
+ 'bind10.boot_time': time.strftime('%Y-%m-%dT%H:%M:%SZ', _BASETIME)
+ }})
+ seq = self.cc_session.group_sendmsg(cmd, 'Stats')
+ self.cc_session.group_recvmsg(True, seq)
+ answer = isc.config.ccsession.create_answer(0)
elif command == "ping":
answer = isc.config.ccsession.create_answer(0, "pong")
elif command == "show_processes":
@@ -977,17 +986,6 @@ def main():
sys.stdout.write("[bind10] BIND 10 started\n")
dump_pid(options.pid_file)
- # send "bind10.boot_time" to b10-stats
- time.sleep(1) # wait a second
- if options.verbose:
- sys.stdout.write("[bind10] send \"bind10.boot_time\" to b10-stats\n")
- cmd = isc.config.ccsession.create_command('set',
- { "stats_data": {
- 'bind10.boot_time': time.strftime('%Y-%m-%dT%H:%M:%SZ', _BASETIME)
- }
- })
- boss_of_bind.cc_session.group_sendmsg(cmd, 'Stats')
-
# In our main loop, we check for dead processes or messages
# on the c-channel.
wakeup_fd = wakeup_pipe[0]
diff --git a/src/bin/bind10/bob.spec b/src/bin/bind10/bob.spec
index c206b34..1184fd1 100644
--- a/src/bin/bind10/bob.spec
+++ b/src/bin/bind10/bob.spec
@@ -23,6 +23,11 @@
"command_args": []
},
{
+ "command_name": "sendstats",
+ "command_description": "Send data to a statistics module at once",
+ "command_args": []
+ },
+ {
"command_name": "ping",
"command_description": "Ping the boss process",
"command_args": []
diff --git a/src/bin/bind10/tests/bind10_test.py.in b/src/bin/bind10/tests/bind10_test.py.in
index 2d58b61..8432c89 100644
--- a/src/bin/bind10/tests/bind10_test.py.in
+++ b/src/bin/bind10/tests/bind10_test.py.in
@@ -13,7 +13,7 @@
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-from bind10 import ProcessInfo, BoB, parse_args, dump_pid, unlink_pid_file
+from bind10 import ProcessInfo, BoB, parse_args, dump_pid, unlink_pid_file, _BASETIME
# XXX: environment tests are currently disabled, due to the preprocessor
# setup that we have now complicating the environment
@@ -24,6 +24,9 @@ import os
import signal
import socket
from isc.net.addr import IPAddr
+import time
+import isc
+
from isc.testutils.parse_args import TestOptParser, OptsError
class TestProcessInfo(unittest.TestCase):
@@ -123,6 +126,41 @@ class TestBoB(unittest.TestCase):
self.assertEqual(bob.cfg_start_auth, True)
self.assertEqual(bob.cfg_start_resolver, False)
+ def test_command_handler(self):
+ class DummySession():
+ def group_sendmsg(self, msg, group):
+ (self.msg, self.group) = (msg, group)
+ def group_recvmsg(self, nonblock, seq): pass
+ bob = BoB()
+ bob.verbose = True
+ bob.cc_session = DummySession()
+ # a bad command
+ self.assertEqual(bob.command_handler(-1, None),
+ isc.config.ccsession.create_answer(1, "bad command"))
+ # "shutdown" command
+ self.assertEqual(bob.command_handler("shutdown", None),
+ isc.config.ccsession.create_answer(0))
+ self.assertFalse(bob.runnable)
+ # "sendstats" command
+ self.assertEqual(bob.command_handler("sendstats", None),
+ isc.config.ccsession.create_answer(0))
+ self.assertEqual(bob.cc_session.group, "Stats")
+ self.assertEqual(bob.cc_session.msg,
+ isc.config.ccsession.create_command(
+ 'set', { "stats_data": {
+ 'bind10.boot_time': time.strftime('%Y-%m-%dT%H:%M:%SZ', _BASETIME)
+ }}))
+ # "ping" command
+ self.assertEqual(bob.command_handler("ping", None),
+ isc.config.ccsession.create_answer(0, "pong"))
+ # "show_processes" command
+ self.assertEqual(bob.command_handler("show_processes", None),
+ isc.config.ccsession.create_answer(0,
+ bob.get_processes()))
+ # an unknown command
+ self.assertEqual(bob.command_handler("__UNKNOWN__", None),
+ isc.config.ccsession.create_answer(1, "Unknown command"))
+
# Class for testing the BoB without actually starting processes.
# This is used for testing the start/stop components routines and
# the BoB commands.
diff --git a/src/bin/stats/b10-stats.8 b/src/bin/stats/b10-stats.8
index 062ff35..5714234 100644
--- a/src/bin/stats/b10-stats.8
+++ b/src/bin/stats/b10-stats.8
@@ -1,7 +1,7 @@
'\" t
.\" Title: b10-stats
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
-.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
.\" Date: Oct 15, 2010
.\" Manual: BIND10
.\" Source: BIND10
@@ -9,6 +9,15 @@
.\"
.TH "B10\-STATS" "8" "Oct 15, 2010" "BIND10" "BIND10"
.\" -----------------------------------------------------------------
+.\" * Define some portability stuff
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" http://bugs.debian.org/507673
+.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
@@ -35,6 +44,11 @@ with other modules like
\fBbind10\fR,
\fBb10\-auth\fR
and so on\&. It waits for coming data from other modules, then other modules send data to stats module periodically\&. Other modules send stats data to stats module independently from implementation of stats module, so the frequency of sending data may not be constant\&. Stats module collects data and aggregates it\&.
+\fBb10\-stats\fR
+invokes "sendstats" command for
+\fBbind10\fR
+after its initial starting because it\*(Aqs sure to collect statistics data from
+\fBbind10\fR\&.
.SH "OPTIONS"
.PP
The arguments are as follows:
@@ -49,7 +63,8 @@ switches to verbose mode\&. It sends verbose messages to STDOUT\&.
.PP
/usr/local/share/bind10\-devel/stats\&.spec
\(em This is a spec file for
-\fBb10\-stats\fR\&. It contains definitions of statistics items of BIND 10 and commands received vi bindctl\&.
+\fBb10\-stats\fR\&. It contains definitions of statistics items of BIND 10 and commands received via
+bindctl(1)\&.
.SH "SEE ALSO"
.PP
diff --git a/src/bin/stats/b10-stats.xml b/src/bin/stats/b10-stats.xml
index f622439..7ec58dd 100644
--- a/src/bin/stats/b10-stats.xml
+++ b/src/bin/stats/b10-stats.xml
@@ -2,7 +2,7 @@
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
[<!ENTITY mdash "—">]>
<!--
- - Copyright (C) 2010 Internet Systems Consortium, Inc. ("ISC")
+ - Copyright (C) 2010,2011 Internet Systems Consortium, Inc. ("ISC")
-
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted, provided that the above
@@ -64,7 +64,9 @@
send stats data to stats module independently from
implementation of stats module, so the frequency of sending data
may not be constant. Stats module collects data and aggregates
- it.
+ it. <command>b10-stats</command> invokes "sendstats" command
+ for <command>bind10</command> after its initial starting because it's
+ sure to collect statistics data from <command>bind10</command>.
</para>
</refsect1>
diff --git a/src/bin/stats/stats.py.in b/src/bin/stats/stats.py.in
index 15e2980..eeddd92 100755
--- a/src/bin/stats/stats.py.in
+++ b/src/bin/stats/stats.py.in
@@ -1,6 +1,6 @@
#!@PYTHON@
-# Copyright (C) 2010 Internet Systems Consortium.
+# Copyright (C) 2010, 2011 Internet Systems Consortium.
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
@@ -15,8 +15,6 @@
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-__version__ = "$Revision$"
-
import sys; sys.path.append ('@@PYTHONPATH@@')
import os
import signal
@@ -220,7 +218,13 @@ class CCSessionListener(Listener):
self.stats_data['stats.start_time'] = get_datetime()
self.stats_data['stats.last_update_time'] = get_datetime()
self.stats_data['stats.lname'] = self.session.lname
- return self.cc_session.start()
+ self.cc_session.start()
+ # request Bob to send statistics data
+ if self.verbose:
+ sys.stdout.write("[b10-stats] request Bob to send statistics data\n")
+ cmd = isc.config.ccsession.create_command("sendstats", None)
+ seq = self.session.group_sendmsg(cmd, 'Boss')
+ self.session.group_recvmsg(True, seq)
def stop(self):
"""
diff --git a/src/bin/stats/tests/b10-stats_test.py b/src/bin/stats/tests/b10-stats_test.py
index e4e1a1e..3566bc4 100644
--- a/src/bin/stats/tests/b10-stats_test.py
+++ b/src/bin/stats/tests/b10-stats_test.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2010 Internet Systems Consortium.
+# Copyright (C) 2010,2011 Internet Systems Consortium.
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
@@ -13,8 +13,6 @@
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-__version__ = "$Revision$"
-
#
# Tests for the stats module
#
@@ -504,6 +502,13 @@ class TestStats(unittest.TestCase):
self.assertEqual(result_ok(),
self.session.get_message("Stats", None))
+ def test_for_boss(self):
+ last_queue = self.session.old_message_queue.pop()
+ self.assertEqual(
+ last_queue.msg, {'command': ['sendstats']})
+ self.assertEqual(
+ last_queue.env['group'], 'Boss')
+
class TestStats2(unittest.TestCase):
def setUp(self):
More information about the bind10-changes
mailing list