ManageIQ/manageiq — pull request #481 by blomquisg (2014-08-29 19:09:43+00:00)
Title: Introduce VM raw_power_state to deal with various VM state issues

Instead of storing a calculated version of VM power state normalized across the various providers, this PR makes ManageIQ to store the raw power state supplied by the provider.

This allows ManageIQ to react to various states directly instead of having to guess at the correct action. For instance, Openstack has many different VM states[1] and very specific allowed state transitions. Previously, ManageIQ attempted to "resume" all "stopped" openstack VMs. This only works if all "stopped" openstack VMs were actually "suspended". However, "paused" VMs can only be "unpaused", and "stopped" VMs can only be "started".

Replacing the VM's `power_state` field with the `raw_power_state` field, required several other sweeping changes because templates, cloud and infra VMs all share the same database table. This requires that several different types of entities know how to either directly handle, or elegantly sidestep, raw power states.

https://bugzilla.redhat.com/show_bug.cgi?id=1115546
https://bugzilla.redhat.com/show_bug.cgi?id=1115557

[1]: http://docs.openstack.org/developer/nova/devref/vmstates.html