Add timestamps to Nodes, PCUs and Interfaces to make concrete
authorStephen Soltesz <soltesz@cs.princeton.edu>
Fri, 2 Jul 2010 23:56:48 +0000 (19:56 -0400)
committerStephen Soltesz <soltesz@cs.princeton.edu>
Fri, 2 Jul 2010 23:56:48 +0000 (19:56 -0400)
commit5d8a25ab329d0c44d34645b0ddeacba2f02331eb
tree5a107b314c63015731575d601f9f3e6ee2c88c4c
parentd15fad5be58c081c4ba49fbfa1f2ab0a48046ae3
Add timestamps to Nodes, PCUs and Interfaces to make concrete
statements about a node's configuration state.

Added:
    Node.last_boot             -- updated by BootUpdateNode()
    Node.last_download         -- updated by GetBootMedium()
    Node.last_pcu_reboot       -- updated by RebootNodeWithPCU()
    Node.last_pcu_confirmation -- updated by BootUpdateNode()
    Interface.last_updated     -- updated by UpdateInterface()
    PCU.last_updated           -- updated by UpdatePCU()

With these timestamps we can implement isValid() routines that indicate
whether the DB state is consistent with respect to the external deployment.
Previously, the DB state could be inconsistent, but there was no way to
identify this until runtime.  These checks should make it possible to validate
the DB state prior to runtime.

Also, isValid() is different from whether a node is online.  A node can be
offline and have a valid DB state.

For instance (in pseudocode):

    def Node.isValid():
        return Node.last_download < Node.last_boot &&
                Node.PCU.isValid(Node) &&
                Node.Interface.isValid(Node)

    def PCU.isValid(Node):
        return PCU.last_updated < Node.last_pcu_confirmation

    def Interface.isValid(Node):
        return Interface.last_updated < Node.last_download

In other words, if the primary interface for a node is updated more recently
than a bootimage is downloaded, then the DB configuration is out of sync with
the node deployment.

If the PCU is updated more recently than the last confirmed use of the PCU,
then the DB configuration is potentially out of sync with the deployment.

If the Node has downloaded a boot image prior to rebooting, then the DB config
is potentially out of sync with the deployment.

All of these states can be flagged in the GUI to help a technical contact
known the status of his configuration and deployment more easily.  The
recommended steps to take should be straight forward based on the conditions
above.  i.e. Create new boot image, reboot node, verify PCU, etc.
PLC/Interfaces.py
PLC/Methods/BootUpdateNode.py
PLC/Methods/GetBootMedium.py
PLC/Methods/RebootNodeWithPCU.py
PLC/Methods/UpdateInterface.py
PLC/Methods/UpdatePCU.py
PLC/Nodes.py
PLC/PCUs.py
planetlab5.sql