BIND 10 trac213, updated. d83a117a090eaf417698eea6697ae750dc45c135 [213] Purge invalid items in TODO

BIND 10 source code commits bind10-changes at lists.isc.org
Mon Oct 17 16:58:57 UTC 2011


The branch, trac213 has been updated
  discards  64864ebe66d735bdca2ebd4050e83de3f1efb0e3 (commit)
  discards  544eddbd71a9e721b8a7f4df9440712128c6daa0 (commit)
  discards  54e45bdd0c4cbc6fcf946a3f9a3614f432d895c4 (commit)
  discards  4548fb5208e174b188374deefac98b1ede014c0e (commit)
  discards  efeedc6fcc731f671173f6d4e8c4e5f1313733c2 (commit)
  discards  0d15980542bb1a1d4a3e82dfdd98aba236642110 (commit)
  discards  86a0673fe4b3b855120d70a07e632010cf80af60 (commit)
  discards  40e47cae104a30b318348eae3bd40b5305cae620 (commit)
  discards  e8e7e9bd02c509454760eb25542e45d8e8374276 (commit)
  discards  9945b1d13a165e1bbfed513040cc0c7536ca6099 (commit)
  discards  0e00158cef2a24bcbcab0f70ffd8c3938b67e61d (commit)
       via  d83a117a090eaf417698eea6697ae750dc45c135 (commit)
       via  ea7f5ad5d326b7ed2d5f0ac1729c2301555b6417 (commit)
       via  68ac89fcb9de65cb1c649aa58b317be3fc793fb7 (commit)
       via  7f1dcc956a864b70e395d10ba095c0787db802a7 (commit)
       via  a3e7bf95ad016c9badd98c16614de4a9c168bad1 (commit)
       via  debb22346698f1be3bbbac4955fd6bd247aa41f4 (commit)
       via  c2d03d1688ae502c4e0b1eb23427ebae5307a091 (commit)
       via  3439230170effea0daec2a106a616965d4830968 (commit)
       via  ca54736634e25786f6d54317e97f3e4db71064f0 (commit)
       via  911b53ae021dbd04a6c12f69aa106fd2d868d54f (commit)
       via  1e465d5417011d24cb9aa9ffaf80a369b6511e2c (commit)
       via  c82f6195acb5a12e91d61956b8b958ceb0a0f821 (commit)
       via  b458fc09d6749b7435cd3c95952b9ab22322cb49 (commit)
       via  d059d370074b13b36db3ab685c307ba668faeda6 (commit)
       via  d8e223ad5439cdf9916e96178a4320403615b507 (commit)
       via  b8031ec74703c03eec1be362f0d3e321c4d8ebe5 (commit)
       via  2117c1db277b10f3bcc48b51d2ca0f821af79f2f (commit)
       via  e5d4874ace76b0caff412f2394a15a042492560b (commit)
       via  76335a521773c8118b7137d79e5f6397614f1904 (commit)
       via  292665a460ed22219490c742d52785b503002029 (commit)
       via  31cf6504b544e20f5ac84e3f74afcaff817c3693 (commit)
       via  0e6639a8432999f2880473b815d8fbeb335a6808 (commit)
       via  196b9474f5eeb11a8d96e52fed500270331dabc6 (commit)
       via  296a70859ceb0b168c3818a3869991e8b51c3932 (commit)
       via  f6f425b5e49110b76e9954dc71d152806503c0bf (commit)
       via  fa9b8636e68a97293c26f51f4ecf50a2753965e4 (commit)
       via  e438bc6f5d4da2cc953cb76b9a924077d11fe347 (commit)
       via  043963cf999791194e2db9e59fb5920ec30fc20f (commit)

This update added new revisions after undoing existing revisions.  That is
to say, the old revision is not a strict subset of the new revision.  This
situation occurs when you --force push a change and generate a repository
containing something like this:

 * -- * -- B -- O -- O -- O (64864ebe66d735bdca2ebd4050e83de3f1efb0e3)
            \
             N -- N -- N (d83a117a090eaf417698eea6697ae750dc45c135)

When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.

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 d83a117a090eaf417698eea6697ae750dc45c135
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Fri Oct 14 21:05:25 2011 +0200

    [213] Purge invalid items in TODO

commit ea7f5ad5d326b7ed2d5f0ac1729c2301555b6417
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Mon Oct 17 17:56:55 2011 +0200

    [213] Don't restart when already shutting down

commit 68ac89fcb9de65cb1c649aa58b317be3fc793fb7
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Mon Oct 17 17:56:27 2011 +0200

    [213] Log when the plan is interrupted in the middle

commit 7f1dcc956a864b70e395d10ba095c0787db802a7
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Mon Oct 17 17:54:30 2011 +0200

    [213] Sort correctly even when no priority
    
    Because it failed in real life.

commit a3e7bf95ad016c9badd98c16614de4a9c168bad1
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Mon Oct 17 17:53:59 2011 +0200

    [213] Make parameters optional
    
    Not all parameters were optional before, now they are.

commit debb22346698f1be3bbbac4955fd6bd247aa41f4
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Mon Oct 17 18:13:34 2011 +0200

    [213] Startup/shutdown fixes (order of running=False)

commit c2d03d1688ae502c4e0b1eb23427ebae5307a091
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Mon Oct 17 17:52:16 2011 +0200

    [213] Spec file

commit 3439230170effea0daec2a106a616965d4830968
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Fri Oct 14 22:06:43 2011 +0200

    [213] Propagation of config with tests
    
    The propagation from the config handler.

commit ca54736634e25786f6d54317e97f3e4db71064f0
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Mon Oct 17 18:12:34 2011 +0200

    [213] Make component_configurator accessible to tests

commit 911b53ae021dbd04a6c12f69aa106fd2d868d54f
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Mon Oct 17 17:43:54 2011 +0200

    [213] Remove some dead code after rip-out

commit 1e465d5417011d24cb9aa9ffaf80a369b6511e2c
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Mon Oct 17 18:34:47 2011 +0200

    [213] Logging for components

commit c82f6195acb5a12e91d61956b8b958ceb0a0f821
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Mon Oct 17 18:33:47 2011 +0200

    [213] Documentation in component.py

commit b458fc09d6749b7435cd3c95952b9ab22322cb49
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Mon Oct 17 17:29:34 2011 +0200

    [213] Post-shutdown killing in boss
    
    When the shutdown doesn't work.

commit d059d370074b13b36db3ab685c307ba668faeda6
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Mon Oct 17 18:05:55 2011 +0200

    [213] Minor component fixes

commit d8e223ad5439cdf9916e96178a4320403615b507
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Mon Oct 17 17:25:32 2011 +0200

    [213] Add pid and name to the components
    
    And use it in some log messages

commit b8031ec74703c03eec1be362f0d3e321c4d8ebe5
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Mon Oct 17 18:30:25 2011 +0200

    [213] Propagate exit code, use component_shutdown
    
    Components use component_shutdown, as boss already had a shutdown
    function, used for different purpose.
    
    The exit code from there is propagated.

commit 2117c1db277b10f3bcc48b51d2ca0f821af79f2f
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Mon Oct 17 17:47:41 2011 +0200

    [213] Disable brittle mode tests
    
    As the brittle mode does no longer work. Maybe it might not be needed in
    future, in which time the tests should be removed.

commit e5d4874ace76b0caff412f2394a15a042492560b
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Mon Oct 17 13:06:24 2011 +0200

    [213] The core components to start
    
    They are the sockcreator (present already before), msgq and cfgmgr

commit 76335a521773c8118b7137d79e5f6397614f1904
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Mon Oct 17 18:43:32 2011 +0200

    [213] Rip out the old start/stop support

commit 292665a460ed22219490c742d52785b503002029
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Mon Oct 17 18:39:38 2011 +0200

    [213] More parameters for the components
    
    Like the address and parameters.

commit 31cf6504b544e20f5ac84e3f74afcaff817c3693
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Mon Oct 17 12:50:19 2011 +0200

    [213] Boss tells the component that it failed

commit 0e6639a8432999f2880473b815d8fbeb335a6808
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Mon Oct 17 12:48:54 2011 +0200

    [213] Register a process to boss
    
    It adds the support for a process to register itself inside boss.
    
    The sockcreator already does that.

commit 196b9474f5eeb11a8d96e52fed500270331dabc6
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Mon Oct 17 12:47:00 2011 +0200

    [213] Don't fail if stopped component isn't running
    
    This will be possible in future, when there's a timeout before
    restarting.

commit 296a70859ceb0b168c3818a3869991e8b51c3932
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Mon Oct 17 18:39:17 2011 +0200

    [213] Start the sockcreator the new way

commit f6f425b5e49110b76e9954dc71d152806503c0bf
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Mon Oct 17 12:55:52 2011 +0200

    [213] Common component starts are delegated to boss

commit fa9b8636e68a97293c26f51f4ecf50a2753965e4
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Mon Oct 17 12:42:16 2011 +0200

    [213] Special components are delegated to boss

commit e438bc6f5d4da2cc953cb76b9a924077d11fe347
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Mon Oct 17 12:39:33 2011 +0200

    [213] LIBEXECDIR in bind10_config.py
    
    So we don't need to have so many generated files.

commit 043963cf999791194e2db9e59fb5920ec30fc20f
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Mon Oct 17 12:38:12 2011 +0200

    [213] Makefile simplification
    
    Branch-unrelated change.
    
    The noinst_ prefix does this, no need to go through explicitly defining
    bunch of variables.

-----------------------------------------------------------------------

Summary of changes:
 src/bin/bind10/bind10_messages.mes                |    5 ++
 src/bin/bind10/bind10_src.py.in                   |   25 +++++----
 src/bin/bind10/bob.spec                           |   60 +++++++++++++++++---
 src/lib/python/isc/bind10/component.py            |   57 +++++++++++--------
 src/lib/python/isc/bind10/tests/component_test.py |   21 +++++++
 5 files changed, 124 insertions(+), 44 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/bin/bind10/bind10_messages.mes b/src/bin/bind10/bind10_messages.mes
index a4a62b5..501a515 100644
--- a/src/bin/bind10/bind10_messages.mes
+++ b/src/bin/bind10/bind10_messages.mes
@@ -54,6 +54,11 @@ A debug message. This indicates that the configurator is building a plan
 how to change configuration from the older one to newer one. This does no
 real work yet, it just does the planning what needs to be done.
 
+% BIND10_CONFIGURATOR_PLAN_INTERRUPTED configurator plan interrupted, only %1 of %2 done
+There was an exception during some planned task. The plan will not continue and
+only some tasks of the plan were completed. The rest is aborted. The exception
+will propagate.
+
 % BIND10_CONFIGURATOR_RECONFIGURE reconfiguring running components
 A different configuration of which components should be running is being
 installed. All components that are no longer needed will be stopped and
diff --git a/src/bin/bind10/bind10_src.py.in b/src/bin/bind10/bind10_src.py.in
index 19e1b14..ae9bf0b 100755
--- a/src/bin/bind10/bind10_src.py.in
+++ b/src/bin/bind10/bind10_src.py.in
@@ -340,8 +340,8 @@ class BoB:
         logger.info(BIND10_KILLING_ALL_PROCESSES)
 
         for pid in self.processes:
-            logger.info(BIND10_KILL_PROCESS, self.processes[pid].name)
-            self.processes[pid].process.kill()
+            logger.info(BIND10_KILL_PROCESS, self.processes[pid].name())
+            os.kill(self.processes[pid].pid(), signal.SIGTERM)
         self.processes = {}
         if self._component_configurator.running():
             self._component_configurator.shutdown()
@@ -476,8 +476,8 @@ class BoB:
         self.log_starting(name, port, address)
         newproc = ProcessInfo(name, args, c_channel_env)
         newproc.spawn()
-        self.processes[newproc.pid] = newproc
         self.log_started(newproc.pid)
+        return newproc
 
     def start_simple(self, name):
         """
@@ -496,7 +496,7 @@ class BoB:
             args += ['-v']
 
         # ... and start the process
-        self.start_process(name, args, self.c_channel_env)
+        return self.start_process(name, args, self.c_channel_env)
 
     # The next few methods start up the rest of the BIND-10 processes.
     # Although many of these methods are little more than a call to
@@ -504,7 +504,7 @@ class BoB:
     # where modifications can be made if the process start-up sequence changes
     # for a given process.
 
-    def start_auth(self, c_channel_env):
+    def start_auth(self):
         """
             Start the Authoritative server
         """
@@ -517,9 +517,9 @@ class BoB:
             authargs += ['-v']
 
         # ... and start
-        self.start_process("b10-auth", authargs, c_channel_env)
+        return self.start_process("b10-auth", authargs, self.c_channel_env)
 
-    def start_resolver(self, c_channel_env):
+    def start_resolver(self):
         """
             Start the Resolver.  At present, all these arguments and switches
             are pure speculation.  As with the auth daemon, they should be
@@ -534,16 +534,17 @@ class BoB:
             resargs += ['-v']
 
         # ... and start
-        self.start_process("b10-resolver", resargs, c_channel_env)
+        return self.start_process("b10-resolver", resargs, self.c_channel_env)
 
-    def start_cmdctl(self, c_channel_env):
+    def start_cmdctl(self):
         """
             Starts the command control process
         """
         args = ["b10-cmdctl"]
         if self.cmdctl_port is not None:
             args.append("--port=" + str(self.cmdctl_port))
-        self.start_process("b10-cmdctl", args, c_channel_env, self.cmdctl_port)
+        return self.start_process("b10-cmdctl", args, self.c_channel_env,
+                                  self.cmdctl_port)
 
     def start_all_processes(self):
         """
@@ -684,7 +685,9 @@ class BoB:
             if pid in self.processes:
                 # One of the processes we know about.  Get information on it.
                 component = self.processes.pop(pid)
-                if component.running():
+                # Tell it it failed, but only if it matters at all (eg. it is
+                # running and we are running - if not, it should stop anyway)
+                if component.running() and self.runnable:
                     component.failed()
             else:
                 logger.info(BIND10_UNKNOWN_CHILD_PROCESS_ENDED, pid)
diff --git a/src/bin/bind10/bob.spec b/src/bin/bind10/bob.spec
index b4cfac6..bc4b4e3 100644
--- a/src/bin/bind10/bob.spec
+++ b/src/bin/bind10/bob.spec
@@ -4,16 +4,58 @@
     "module_description": "Master process",
     "config_data": [
       {
-        "item_name": "start_auth",
-        "item_type": "boolean",
+        "item_name": "components",
+        "item_type": "named_set",
         "item_optional": false,
-        "item_default": true
-      },
-      {
-        "item_name": "start_resolver",
-        "item_type": "boolean",
-        "item_optional": false,
-        "item_default": false
+        "item_default": {
+          "b10-xfrin": { "address": "Xfrin" },
+          "b10-xfrout": { "address": "Xfrout" },
+          "b10-auth": { "special": "auth", "kind": "needed" },
+          "b10-zonemgr": { "address": "Zonemgr" },
+          "b10-stats": { "address": "Stats" },
+          "b10-stats-httpd": { "address": "StatsHttpd" },
+          "b10-cmdctl": { "special": "cmdctl", "kind": "needed" }
+        },
+        "named_set_item_spec": {
+          "item_name": "component",
+          "item_type": "map",
+          "item_optional": false,
+          "item_default": { },
+          "map_item_spec": [
+            {
+              "item_name": "special",
+              "item_optional": true,
+              "item_type": "string"
+            },
+            {
+              "item_name": "process",
+              "item_optional": true,
+              "item_type": "string"
+            },
+            {
+              "item_name": "kind",
+              "item_optional": true,
+              "item_type": "string",
+              "item_default": "dispensable"
+            },
+            {
+              "item_name": "address",
+              "item_optional": true,
+              "item_type": "string"
+            },
+            {
+              "item_name": "params",
+              "item_optional": true,
+              "item_type": "list",
+              "list_item_spec": {
+                "item_name": "param",
+                "item_optional": false,
+                "item_type": "string",
+                "item_default": ""
+              }
+            }
+          ]
+        }
       }
     ],
     "commands": [
diff --git a/src/lib/python/isc/bind10/component.py b/src/lib/python/isc/bind10/component.py
index c0f2ba4..b37a235 100644
--- a/src/lib/python/isc/bind10/component.py
+++ b/src/lib/python/isc/bind10/component.py
@@ -73,7 +73,7 @@ class Component:
         self.__running = False
         # Dead like really dead. No resurrection possible.
         self.__dead = False
-        self.__kind = kind
+        self._kind = kind
         self._boss = boss
         self._process = process
         self._start_func = None
@@ -134,8 +134,8 @@ class Component:
         if not self.running():
             raise ValueError("Can't stop a component which is not running")
         logger.info(BIND10_COMPONENT_STOP, self.name())
-        self.stop_internal()
         self.__running = False
+        self.stop_internal()
 
     def stop_internal(self):
         """
@@ -157,8 +157,8 @@ class Component:
         self.failed_internal()
         # If it is a core component or the needed component failed to start
         # (including it stopped really soon)
-        if self.__kind == 'core' or \
-            (self.__kind == 'needed' and time.time() - 10 < self.__start_time):
+        if self._kind == 'core' or \
+            (self._kind == 'needed' and time.time() - 10 < self.__start_time):
             self.__dead = True
             logger.fatal(BIND10_COMPONENT_UNSATISFIED, self.name())
             self._boss.component_shutdown(1)
@@ -334,8 +334,8 @@ class Configurator:
             raise ValueError("Trying to shutdown the component " +
                              "configurator while it's not yet running")
         logger.info(BIND10_CONFIGURATOR_STOP)
-        self.__reconfigure_internal(self._old_config, {})
         self._running = False
+        self.__reconfigure_internal(self._old_config, {})
 
     def reconfigure(self, configuration):
         """
@@ -391,7 +391,8 @@ class Configurator:
                     # TODO: Better error handling
                     creator = specials[params['special']]
                 component = creator(params.get('process', cname), self.__boss,
-                                    params['kind'], params.get('address'),
+                                    params.get('kind', 'dispensable'),
+                                    params.get('address'),
                                     params.get('params'))
                 priority = params.get('priority', 0)
                 # We store tuples, priority first, so we can easily sort
@@ -402,7 +403,9 @@ class Configurator:
                 }))
         # Push the starts there sorted by priority
         plan.extend([command for (_, command) in sorted(plan_add,
-                                                        reverse=True)])
+                                                        reverse=True,
+                                                        key=lambda command:
+                                                            command[0])])
         return plan
 
     def running(self):
@@ -419,20 +422,26 @@ class Configurator:
         * start
         * stop
         """
-        logger.debug(DBG_TRACE_DATA, BIND10_CONFIGURATOR_RUN, len(plan))
-        for task in plan:
-            component = task['component']
-            command = task['command']
-            logger.debug(DBG_TRACE_DETAILED, BIND10_CONFIGURATOR_TASK, command,
-                         component.name())
-            if command == 'start':
-                component.start()
-                self._components[task['name']] = component
-            elif command == 'stop':
-                if component.running():
-                    component.stop()
-                del self._components[task['name']]
-            else:
-                # Can Not Happen (as the plans are generated by ourself).
-                # Therefore not tested.
-                raise NotImplementedError("Command unknown: " + command)
+        done = 0
+        try:
+            logger.debug(DBG_TRACE_DATA, BIND10_CONFIGURATOR_RUN, len(plan))
+            for task in plan:
+                component = task['component']
+                command = task['command']
+                logger.debug(DBG_TRACE_DETAILED, BIND10_CONFIGURATOR_TASK, command,
+                             component.name())
+                if command == 'start':
+                    component.start()
+                    self._components[task['name']] = component
+                elif command == 'stop':
+                    if component.running():
+                        component.stop()
+                    del self._components[task['name']]
+                else:
+                    # Can Not Happen (as the plans are generated by ourself).
+                    # Therefore not tested.
+                    raise NotImplementedError("Command unknown: " + command)
+                done += 1
+        except:
+            logger.error(BIND10_CONFIGURATOR_PLAN_INTERRUPTED, done, len(plan))
+            raise
diff --git a/src/lib/python/isc/bind10/tests/component_test.py b/src/lib/python/isc/bind10/tests/component_test.py
index 7b4d72d..e183437 100644
--- a/src/lib/python/isc/bind10/tests/component_test.py
+++ b/src/lib/python/isc/bind10/tests/component_test.py
@@ -631,8 +631,20 @@ class ConfiguratorTest(BossUtils, unittest.TestCase):
         self.assertEqual('component', component.name())
         self.assertEqual([1, 2], component._params)
         self.assertEqual('address', component._address)
+        self.assertEqual('needed', component._kind)
         # We don't use isinstance on purpose, it would allow a descendand
         self.assertTrue(type(component) is Component)
+        plan = configurator._build_plan({}, {
+            'component': { }
+        })
+        self.assertEqual(1, len(plan))
+        self.assertEqual('start', plan[0]['command'])
+        self.assertEqual('component', plan[0]['name'])
+        component = plan[0]['component']
+        self.assertEqual('component', component.name())
+        self.assertIsNone(component._params)
+        self.assertIsNone(component._address)
+        self.assertEqual('dispensable', component._kind)
 
     def __do_switch(self, option, value):
         """
@@ -737,6 +749,15 @@ class ConfiguratorTest(BossUtils, unittest.TestCase):
         # It can't be stopped twice
         self.assertRaises(ValueError, configurator.shutdown)
 
+    def test_sort_no_prio(self):
+        """
+        There was a bug if there were two things with the same priority
+        (or without priority), it failed as it couldn't compare the dicts
+        there. This tests it doesn't crash.
+        """
+        configurator = Configurator(self)
+        configurator._build_plan({}, {"c1": {}, "c2": {}})
+
 if __name__ == '__main__':
     isc.log.init("bind10") # FIXME Should this be needed?
     isc.log.resetUnitTestRootLogger()




More information about the bind10-changes mailing list