Implement power_off/power_on for the FakeDriver

When trying to recreate hundreds of instance action
events for scale testing with the FakeDriver, a nice
simple way to do that is by stopping those instances
and starting them again.

However, since power_off/on aren't implemented, once
you "stop" them the sync_instance_power_state periodic
task in the compute manager thinks they are still running
on the "hypervisor" and will stop them again via the API,
which records yet another instance action and set of
events.

This just toggles the power state bit on the fake instance
in the FakeDriver to make the periodic task do the right
thing.

As a result, we also have more realistic API and
notification samples.

Change-Id: Ie621686053ad774c4ae4f22bb2a455f98900b611
This commit is contained in:
Matt Riedemann
2017-10-05 19:19:36 -04:00
parent cc6f84ebd4
commit 211e9b1961
12 changed files with 23 additions and 15 deletions
@@ -50,7 +50,7 @@
"reservation_id":"r-npxv0e40",
"state":"shelved",
"task_state":null,
"power_state":"running",
"power_state":"shutdown",
"tenant_id":"6f70656e737461636b20342065766572",
"terminated_at":null,
"auto_disk_config":"MANUAL",