Change the order of config updates in some LUs
authorIustin Pop <iustin@google.com>
Sun, 30 Mar 2008 14:54:34 +0000 (14:54 +0000)
committerIustin Pop <iustin@google.com>
Sun, 30 Mar 2008 14:54:34 +0000 (14:54 +0000)
commitfe48262190eea55a2e8d5ac3147f0aa6e59ea55b
tree4088849b57557b82015e6e43056db4d54fb40481
parent5e66b7e6ad595fa497ae45fe1789bcbfd3703a22
Change the order of config updates in some LUs

In the start and stop instance LUs, the configuration update is done
right at the end. This means that if, for example, the instance shutdown
succeeds, but the drive deactivation fails, the next run of the watcher
will start the instance again, as it's still marked in running mode.

This patch changes these two LUs so that first the update the
configuration to the desired state, and only then we proceed to update
the config. This ensures that the state saved is the desired state.

Because the config might be updated even though the LU failed, this
patch also modifies the mcpu.Processor.ExecOpCode method to run the
RunConfigUpdate hook in a finally: phase while the lu.Exec is done in
its try phase. This ensures that config update hooks (tries to) run at
all times when the config is updated.

Reviewed-by: schreiberal
lib/cmdlib.py
lib/mcpu.py