Pass reboot error threshold down to automaton

Define a configuration option for the reboot error threshold and pass it
down to the automaton to check.

Use this opportunity to ensure that the default for the 2 thresholds are
only being set in one place.

Change-Id: I68619bfac4d1b60eb6fb386592c4ed1efeac9648
Count boot attempts

Count the number of times we try to boot a router VM.

Change-Id: I556e88da715a0b890a64691f00885dc750020ab7
Refactor parameters to State

Change the way we pass parameters to the State instances to make it
easier to add new values. Define a StateParameters class to hold all of
the values, and add property accessors to State to pull them out and use
them.

Change-Id: I96ec994fc67a588eea4919cb1124a03901fd9e48
Add VmManager.set_error()

Add a method to put the router into an error state. The state is cleared
automatically when a boot succeeds.

Change-Id: Ia31d473e4664306edfc96c4d5fa53855dcab4004
Detect reboot loops

Do not try to boot the VM in CreateVM if we have too many previous
failures.

Change-Id: Ie9265319350fa5ca9469353f59c5c4021c502216
Rename success method of BootAttemptCounter

Sometimes we want to reset the counter when we haven't succeeded in
booting.

Change-Id: Ib716c012c1e0ddf71bcdc269534aa01343e539ad
Allow callers to clear errors on VmManager

Change-Id: I2a38a0d02635ad7fb1337e0fa8bd3369256dddfe
Allow explicit rebuild of routers in error state

If a router is in an error state when a rebuild command comes in, reset
its reboot counter and allow the rebuild to continue as normal.

Change-Id: I7a22d3d975ce8ba308feab14ef0dc55414a9f90a
Log which attempt this is to boot the vm

Change-Id: Id8eb1f9cb6b4503d49d8f81e03e685b39cbc2d59
Do not reset error state unless VM is responsive

Don't automatically reset the ERROR state to DOWN or BOOTING when
checking the server status unless the VM does respond, and we can set
the state to CONFIGURED.

Change-Id: Ib88c6bcd4337faeabafa08c6ed7c4cff0388d77d
fix flake8 issues

Change-Id: I28b77634131c4430cb8897736faecf0610019511
remove redundant router id from log message

The router id appears in the logger name, so it does not need to be
included in the message body.

Change-Id: Ifd690154403d9529a9fc2da8ac5bc982c59d7a86
Ignore router status update notifications

When we change the router status, a notification is emitted by
neutron. We know about the event and don't care about it, so ignore
those notifications.

Change-Id: I205cd698960ca0ee796033184ee0e44111d8a5ce
Have PushUpdate return the action

Make PushUpdate return a valid action so we don't end up with None as
the current action to be performed.

Change-Id: I901c62aea7bda517188979f07499861a8f490917
Add a ClearError state

Add a ClearError state to remove the error flag from the VM before doing
anything else with it. Add the new state transition to CalcAction. We
are still protected from boot loops triggered by poll operations because
those are never processed for a router in an error state, but any update
operations or direct commands will be.

Change-Id: I6bf744a33df8f4055a744b5fe2c7ef3d3043c247
update tests from previous commit

Change-Id: Ia1f756d4e3ea3741b85621043e09016924cdbe6b
Fix Automaton setup in debug command

Change-Id: I6be39532fbbe66e10c3b721ed65e2128441a64d7
Fix boot duration timing calculation

We were reporting the time it took to boot an instance every time we
discovered that it was configured, even if we had not just rebooted it.

Change-Id: Ide0fd91eab3dec5133bf2f6212fc43f751692a8a
update debug test

Change-Id: I30fc368fbe0209c555e4e0e44195fe7c5a06da9e
Merge pull request #157 from dhellmann/dhc-2147-detect-reboot-loops

Detect router reboot loops