Commit 78ad260c authored by Mac Newbold's avatar Mac Newbold

libdb changes:

- add functions to recursively dump hashes and arrays into a string
  suitable for printing as debugging output (great for data structures)

- add three new trigger strings

- add 'use strict', do corresponding cleanup

stated changes:

- move special-cased stuff in handleEvent for PXEBOOTING and BOOTING into
  triggers (PXEBOOTING, BOOTING, and CHECKGENISUP)

- clarify (via comments) the existing kinds of triggers and which ones run
  when, and add a new kind (global "any-mode" triggers). We already had
  per-node mode-specific, per-node any-mode, and global mode-specific
  triggers. Now you can have a trigger that is good for any mode in a
  given state, that can be overridden on a mode-specific basis. This is
  great for PXEBOOTING, BOOTING, and ISUP, since they each have a trigger
  list that should be run regardless of what mode you're in. Now they only
  require 3 entries instead of 3*N that have to be maintained per mode.

     # A note about triggers:
     #
     # "per-node" triggers only affect their specific node in a
     # particular mode/state, and are run first of all. "global"
     # triggers are triggers for a given mode/state that affect all
     # nodes, and are run after any per-node triggers. "Any-mode"
     # triggers are tied to a state, and occur in that state in any
     # mode. The any-mode triggers are over-ridden by global triggers,
     # and if an "Any-mode" trigger for state XYZ exists as well as a
     # global trigger for mode FOOBAR state XYZ, then when I arrive in
     # XYZ any per-node triggers will be run. Then, if I'm in mode
     # FOOBAR, only the global trigger will run. If I'm in any other
     # mode, only the any-mode trigger will run.

     # (our "*" is stored as $TBANYMODE)
     # Per-node triggers have a specific node_id
     # Global triggers have "*" as the node_id
     # Any-mode triggers have "*" as the mode, and can be global or per-node

  The updated table looks like this in the accompanying change to
  database-fill.sql:

+---------+----------+------------+-----------------------+
| node_id | op_mode  | state      | trigger               |
+---------+----------+------------+-----------------------+
| *       | *        | BOOTING    | BOOTING, CHECKGENISUP |
| *       | *        | ISUP       | RESET                 |
| *       | *        | PXEBOOTING | PXEBOOT               |
| *       | RELOAD   | RELOADDONE | RESET, RELOADDONE     |
| *       | ALWAYSUP | SHUTDOWN   | ISUP                  |
+---------+----------+------------+-----------------------+

- I also cleaned up the functions that add, get, and delete triggers.
  Before, the get function didn't include global triggers. Now it does,
  and has an option to just get the per-node triggers. Add and delete are
  still just per-node, of course.

- Also found and fixed some little bugs while I was in there. (global
  triggers not taking a list,

These changes are me getting ready to re-add all the changes I made months
ago in order to do a before-and-after experiment for my thesis. Between
now and the end of next week I'll be working on taking before numbers,
patching stated with the changes, and getting after numbers.

The problems I'm trying to replicate are the problems and slowdowns we
used to get when os_{load,setup} would reboot a node, thinking it had
timed out, when it really didn't know whether it was making progress or
not. The fix includes making os_{load,setup} depend on stated to watch for
progress and timeouts, and do any appropriate retries. Part of that is the
StateWait stuff, that lets programs watch for events easily, and the
node_reboot-with-events stuff that puts stated in control of nodes as they
reboot.
parent cb802d48
This diff is collapsed.
This diff is collapsed.
......@@ -287,6 +287,7 @@ REPLACE INTO state_timeouts VALUES ('PXEKERNEL','PXEWAKEUP',20,'REBOOT');
REPLACE INTO state_transitions VALUES ('ALWAYSUP','ISUP','SHUTDOWN','Reboot');
REPLACE INTO state_transitions VALUES ('ALWAYSUP','SHUTDOWN','ISUP','BootDone');
REPLACE INTO state_transitions VALUES ('PCVM','ISUP','BOOTING','Crash');
REPLACE INTO state_transitions VALUES ('EXPTSTATE','TERMINATING','SWAPPED','Error');
REPLACE INTO state_transitions VALUES ('EXPTSTATE','TERMINATING','ENDED','NoError');
REPLACE INTO state_transitions VALUES ('EXPTSTATE','MODIFY_RESWAP','SWAPPING','Nonrecover Error');
......@@ -339,7 +340,6 @@ REPLACE INTO state_transitions VALUES ('WIDEAREA','SHUTDOWN','SHUTDOWN','Retry')
REPLACE INTO state_transitions VALUES ('PCVM','BOOTING','SHUTDOWN','Error');
REPLACE INTO state_transitions VALUES ('PCVM','BOOTING','TBSETUP','BootOK');
REPLACE INTO state_transitions VALUES ('PCVM','ISUP','SHUTDOWN','Reboot');
REPLACE INTO state_transitions VALUES ('PCVM','ISUP','BOOTING','Crash');
REPLACE INTO state_transitions VALUES ('PCVM','SHUTDOWN','BOOTING','DHCP');
REPLACE INTO state_transitions VALUES ('PCVM','TBSETUP','ISUP','BootDone');
REPLACE INTO state_transitions VALUES ('PCVM','TBSETUP','SHUTDOWN','Error');
......@@ -356,6 +356,7 @@ REPLACE INTO state_transitions VALUES ('NORMALv1','PXEBOOTING','BOOTING','BootIn
REPLACE INTO state_transitions VALUES ('BATCHSTATE','POSTED','ACTIVATING','SwapIn');
REPLACE INTO state_transitions VALUES ('NORMAL','REBOOTING','PXEBOOTING','DHCP');
REPLACE INTO state_transitions VALUES ('NORMALv1','ISUP','PXEBOOTING','KernelChange');
REPLACE INTO state_transitions VALUES ('PXEKERNEL','PXEWAIT','PXEBOOTING','Retry');
REPLACE INTO state_transitions VALUES ('PXEKERNEL','PXEBOOTING','PXEWAIT','Free');
REPLACE INTO state_transitions VALUES ('BATCHSTATE','ACTIVATING','SWAPPED','NonBatch');
REPLACE INTO state_transitions VALUES ('NORMAL','ISUP','SHUTDOWN','Reboot');
......@@ -410,7 +411,6 @@ REPLACE INTO state_transitions VALUES ('PXEKERNEL','SHUTDOWN','PXEBOOTING','Boot
REPLACE INTO state_transitions VALUES ('PXEKERNEL','PXEBOOTING','PXEBOOTING','Retry');
REPLACE INTO state_transitions VALUES ('PXEKERNEL','PXEBOOTING','BOOTING','Not Free');
REPLACE INTO state_transitions VALUES ('PXEKERNEL','PXEWAKEUP','PXEWAKEUP','Retry');
REPLACE INTO state_transitions VALUES ('PXEKERNEL','PXEWAIT','PXEBOOTING','Retry');
REPLACE INTO state_transitions VALUES ('NORMALv2','SHUTDOWN','SHUTDOWN','Retry');
REPLACE INTO state_transitions VALUES ('NORMALv2','SHUTDOWN','PXEBOOTING','DHCP');
REPLACE INTO state_transitions VALUES ('NORMALv2','ISUP','PXEBOOTING','KernelChange');
......@@ -428,14 +428,11 @@ REPLACE INTO state_transitions VALUES ('NETBOOT','PXEBOOTING','BOOTING','BootInf
--
REPLACE INTO state_triggers VALUES ('*','NORMAL','ISUP','RESET');
REPLACE INTO state_triggers VALUES ('*','NORMALv1','ISUP','RESET');
REPLACE INTO state_triggers VALUES ('*','MINIMAL','ISUP','RESET');
REPLACE INTO state_triggers VALUES ('*','RELOAD','RELOADDONE','RESET, RELOADDONE');
REPLACE INTO state_triggers VALUES ('*','ALWAYSUP','SHUTDOWN','ISUP');
REPLACE INTO state_triggers VALUES ('*','PCVM','ISUP','RESET');
REPLACE INTO state_triggers VALUES ('*','PXEFBSD','ISUP','RESET');
REPLACE INTO state_triggers VALUES ('*','NORMALv2','ISUP','RESET');
REPLACE INTO state_triggers VALUES ('*','*','ISUP','RESET');
REPLACE INTO state_triggers VALUES ('*','*','PXEBOOTING','PXEBOOT');
REPLACE INTO state_triggers VALUES ('*','*','BOOTING','BOOTING, CHECKGENISUP');
--
-- Dumping data for table `table_regex`
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment