The first working version of the StateWait library. The API changed a bit:
# $rv = initStateWait(\@states, @nodes); # # Call this first. Make sure to call it _before_ performing any # action that may trigger one or more of the states you're # expecting to see. Each node must see the list of states in the # proper order, ie if @states=(stateA, stateB), it will not # complete until the first time stateB is seen after stateA has # been seen. Returns 0 on success. # # $rv = waitForState(\@finished, \@failed[, $timeout); # # Do the actual waiting. Blocks until each node has either reached the # desired state(s) or failed, or timeout is reached (if given and # non-zero). Returns lists of nodes. # # $rv = endStateWait(); # # Stop listening for states. Call this soon after waitForState. # This must be called before calling initStateWait again. Also, commit a command line tool that uses the lib. The waitForState script can be used by other programs to do the state waiting for you, or you can use the lib directly for more control, using this script as an example of how to do it.
Showing with 221 additions and 18 deletions