From 129b87e17d3333aeaa9e855a70dea51e6581ea63 Mon Sep 17 00:00:00 2001 From: Yun Mao Date: Tue, 5 Jun 2012 14:55:34 -0400 Subject: vm state and task state management partially implements bp task-management fixes bug 997867 also see http://wiki.openstack.org/VMState Refactored the following API/state: * rebuild * migrate * resize * start * stop * delete * soft delete * rework sync_power_state in compute/manager. fix broken tests, add transition diagram in dot Change-Id: I3c5a97508a6dad7175fba12828bd3fa6ef1e50ee --- nova/virt/libvirt/imagecache.py | 9 ++++----- nova/virt/xenapi/host.py | 3 ++- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'nova/virt') diff --git a/nova/virt/libvirt/imagecache.py b/nova/virt/libvirt/imagecache.py index e8536bb46..9e800e3dd 100644 --- a/nova/virt/libvirt/imagecache.py +++ b/nova/virt/libvirt/imagecache.py @@ -29,6 +29,7 @@ import re import time from nova.compute import task_states +from nova.compute import vm_states from nova import db from nova import flags from nova import log as logging @@ -140,11 +141,9 @@ class ImageCacheManager(object): resize_states = [task_states.RESIZE_PREP, task_states.RESIZE_MIGRATING, task_states.RESIZE_MIGRATED, - task_states.RESIZE_FINISH, - task_states.RESIZE_REVERTING, - task_states.RESIZE_CONFIRMING, - task_states.RESIZE_VERIFY] - if instance['task_state'] in resize_states: + task_states.RESIZE_FINISH] + if instance['task_state'] in resize_states or \ + instance['vm_state'] in vm_states.RESIZED: self.instance_names.add(instance['name'] + '_resize') image_ref_str = str(instance['image_ref']) diff --git a/nova/virt/xenapi/host.py b/nova/virt/xenapi/host.py index 387a6b8a5..7fe8a7b77 100644 --- a/nova/virt/xenapi/host.py +++ b/nova/virt/xenapi/host.py @@ -21,6 +21,7 @@ Management class for host-related functions (start, reboot, etc). import logging +from nova.compute import task_states from nova.compute import vm_states from nova import context from nova import db @@ -80,7 +81,7 @@ class Host(object): ctxt, instance.id, {'host': dest, - 'vm_state': vm_states.MIGRATING}) + 'task_state': task_states.MIGRATING}) notifications.send_update(ctxt, old_ref, new_ref) self._session.call_xenapi('VM.pool_migrate', -- cgit