summaryrefslogtreecommitdiffstats
path: root/nova/compute
diff options
context:
space:
mode:
Diffstat (limited to 'nova/compute')
-rw-r--r--nova/compute/manager.py3
-rw-r--r--nova/compute/power_state.py25
2 files changed, 16 insertions, 12 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index 6a0251a15..3159ffd52 100644
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -306,7 +306,7 @@ class ComputeManager(manager.SchedulerDependentManager):
try:
return self.driver.get_info(instance)["state"]
except exception.NotFound:
- return power_state.FAILED
+ return power_state.NOSTATE
def get_console_topic(self, context, **kwargs):
"""Retrieves the console host for a project on this host.
@@ -2488,7 +2488,6 @@ class ComputeManager(manager.SchedulerDependentManager):
continue
if (vm_power_state in (power_state.NOSTATE,
- power_state.SHUTOFF,
power_state.SHUTDOWN,
power_state.CRASHED)
and db_instance['vm_state'] == vm_states.ACTIVE):
diff --git a/nova/compute/power_state.py b/nova/compute/power_state.py
index c468fe6b3..6d1c00b98 100644
--- a/nova/compute/power_state.py
+++ b/nova/compute/power_state.py
@@ -18,18 +18,26 @@
# License for the specific language governing permissions and limitations
# under the License.
-"""The various power states that a VM can be in."""
-
-#NOTE(justinsb): These are the virDomainState values from libvirt
+"""Power state is the state we get by calling virt driver on a particular
+domain. The hypervisor is always considered the authority on the status
+of a particular VM, and the power_state in the DB should be viewed as a
+snapshot of the VMs's state in the (recent) past. It can be periodically
+updated, and should also be updated at the end of a task if the task is
+supposed to affect power_state.
+"""
+
+# NOTE(maoy): These are *not* virDomainState values from libvirt.
+# The hex value happens to match virDomainState for backward-compatibility
+# reasons.
NOSTATE = 0x00
RUNNING = 0x01
-BLOCKED = 0x02
PAUSED = 0x03
-SHUTDOWN = 0x04
-SHUTOFF = 0x05
+SHUTDOWN = 0x04 # the VM is powered off
CRASHED = 0x06
SUSPENDED = 0x07
-FAILED = 0x08
+
+# TODO(maoy): BUILDING state is only used in bare metal case and should
+# eventually be removed/cleaned up. NOSTATE is probably enough.
BUILDING = 0x09
# TODO(justinsb): Power state really needs to be a proper class,
@@ -38,13 +46,10 @@ BUILDING = 0x09
_STATE_MAP = {
NOSTATE: 'pending',
RUNNING: 'running',
- BLOCKED: 'blocked',
PAUSED: 'paused',
SHUTDOWN: 'shutdown',
- SHUTOFF: 'shutdown',
CRASHED: 'crashed',
SUSPENDED: 'suspended',
- FAILED: 'failed to spawn',
BUILDING: 'building',
}