Browse Source

[master] Merge branch 'trac2137'

Naoki Kambe 12 years ago
parent
commit
d53bb65a43

+ 12 - 12
src/bin/bind10/bind10.8

@@ -1,7 +1,7 @@
 '\" t
 .\"     Title: bind10
 .\"    Author: [see the "AUTHORS" section]
-.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\" Generator: DocBook XSL Stylesheets v1.77.1 <http://docbook.sf.net/>
 .\"      Date: April 12, 2012
 .\"    Manual: BIND10
 .\"    Source: BIND10
@@ -9,6 +9,15 @@
 .\"
 .TH "BIND10" "8" "April 12, 2012" "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
@@ -166,7 +175,7 @@ This defines how required a component is\&. The possible settings for
 \fIkind\fR
 are:
 \fIcore\fR
-(system won\'t start if it won\'t start and
+(system won\*(Aqt start if it won\*(Aqt start and
 \fBbind10\fR
 will shutdown if a
 \(lqcore\(rq
@@ -176,7 +185,7 @@ component crashes),
 will restart failing component), and
 \fIneeded\fR
 (\fBbind10\fR
-will shutdown if component won\'t initially start, but if crashes later, it will attempt to restart)\&. This setting is required\&.
+will shutdown if component won\*(Aqt initially start, but if crashes later, it will attempt to restart)\&. This setting is required\&.
 .RE
 .PP
 \fIpriority\fR
@@ -209,7 +218,6 @@ tells
 to send its statistics data to the
 \fBb10\-stats\fR
 daemon\&. This is an internal command and not exposed to the administrator\&.
-
 .PP
 
 \fBping\fR
@@ -219,14 +227,6 @@ daemon\&. It returns the text
 \(lqpong\(rq\&.
 .PP
 
-\fBsendstats\fR
-tells
-\fBbind10\fR
-to send its statistics data to the
-\fBb10\-stats\fR
-daemon immediately\&.
-.PP
-
 \fBshow_processes\fR
 lists the current processes managed by
 \fBbind10\fR\&. The output is an array in JSON format containing the process ID, the name for each and the address name used on each message bus\&.

+ 3 - 8
src/bin/bind10/bind10.xml

@@ -394,7 +394,6 @@ xfrin
       daemon.
       This is an internal command and not exposed to the administrator.
 <!-- not defined in spec -->
-<!-- TODO: explain difference with sendstat -->
     </para>
 
     <para>
@@ -404,13 +403,6 @@ xfrin
     </para>
 
     <para>
-      <command>sendstats</command> tells <command>bind10</command>
-      to send its statistics data to the <command>b10-stats</command>
-      daemon immediately.
-<!-- TODO: compare with internal command getstats? -->
-    </para>
-
-    <para>
       <command>show_processes</command> lists the current processes
       managed by <command>bind10</command>.
       The output is an array in JSON format containing the process
@@ -490,6 +482,9 @@ xfrin
       <citerefentry>
         <refentrytitle>b10-zonemgr</refentrytitle><manvolnum>8</manvolnum>
       </citerefentry>,
+      <citerefentry>
+        <refentrytitle>b10-stats</refentrytitle><manvolnum>8</manvolnum>
+      </citerefentry>,
       <citetitle>BIND 10 Guide</citetitle>.
     </para>
   </refsect1>

+ 4 - 23
src/bin/bind10/bind10_src.py.in

@@ -286,10 +286,8 @@ class BoB:
         return process_list
 
     def _get_stats_data(self):
-        return { "owner": "Boss",
-                 "data": { 'boot_time':
-                               time.strftime('%Y-%m-%dT%H:%M:%SZ', _BASETIME)
-                           }
+        return { 'boot_time':
+                     time.strftime('%Y-%m-%dT%H:%M:%SZ', _BASETIME)
                  }
 
     def command_handler(self, command, args):
@@ -302,25 +300,8 @@ class BoB:
                 self.runnable = False
                 answer = isc.config.ccsession.create_answer(0)
             elif command == "getstats":
-                answer = isc.config.ccsession.create_answer(0, self._get_stats_data())
-            elif command == "sendstats":
-                # send statistics data to the stats daemon immediately
-                stats_data = self._get_stats_data()
-                valid = self.ccs.get_module_spec().validate_statistics(
-                    True, stats_data["data"])
-                if valid:
-                    cmd = isc.config.ccsession.create_command('set', stats_data)
-                    seq = self.cc_session.group_sendmsg(cmd, 'Stats')
-                    # Consume the answer, in case it becomes a orphan message.
-                    try:
-                        self.cc_session.group_recvmsg(False, seq)
-                    except isc.cc.session.SessionTimeout:
-                        pass
-                    answer = isc.config.ccsession.create_answer(0)
-                else:
-                    logger.fatal(BIND10_INVALID_STATISTICS_DATA);
-                    answer = isc.config.ccsession.create_answer(
-                        1, "specified statistics data is invalid")
+                answer = isc.config.ccsession.create_answer(
+                    0, self._get_stats_data())
             elif command == "ping":
                 answer = isc.config.ccsession.create_answer(0, "pong")
             elif command == "show_processes":

+ 0 - 5
src/bin/bind10/bob.spec

@@ -65,11 +65,6 @@
         "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": []

+ 1 - 14
src/bin/bind10/tests/bind10_test.py.in

@@ -413,20 +413,7 @@ class TestBoB(unittest.TestCase):
         # "getstats" command
         self.assertEqual(bob.command_handler("getstats", None),
                          isc.config.ccsession.create_answer(0,
-                            { "owner": "Boss",
-                              "data": {
-                                'boot_time': time.strftime('%Y-%m-%dT%H:%M:%SZ', _BASETIME)
-                            }}))
-        # "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", { "owner": "Boss",
-                         "data": {
-                        "boot_time": time.strftime("%Y-%m-%dT%H:%M:%SZ", _BASETIME)
-                        }}))
+                            { '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"))