Merge "vm state and task state management"
This commit is contained in:
commit
973644f1ca
@ -8,6 +8,143 @@ Preconditions for commands
|
||||
The following diagrams show the required virtual machine (VM) states and
|
||||
task states for various commands issued by the user:
|
||||
|
||||
.. graphviz::
|
||||
|
||||
digraph states {
|
||||
node [fontsize=10 fontname="Monospace"]
|
||||
/* states */
|
||||
building [label="BUILDING"]
|
||||
|
||||
active [label="ACTIVE"]
|
||||
paused [label="PAUSED"]
|
||||
suspended [label="SUSPENDED"]
|
||||
stopped [label="STOPPED"]
|
||||
rescued [label="RESCUED"]
|
||||
resized [label="RESIZED"]
|
||||
soft_deleted [label="SOFT_DELETED"]
|
||||
deleted [label="DELETED"]
|
||||
error [label="ERROR"]
|
||||
|
||||
/* apis */
|
||||
create [shape="rectangle"]
|
||||
create -> active
|
||||
create -> error
|
||||
building -> create
|
||||
|
||||
delete [shape="rectangle"]
|
||||
delete -> deleted
|
||||
building -> delete
|
||||
paused -> delete
|
||||
suspended -> delete
|
||||
stopped -> delete
|
||||
rescued -> delete
|
||||
soft_deleted -> delete
|
||||
error -> delete
|
||||
|
||||
soft_delete [shape="rectangle"]
|
||||
soft_delete -> soft_deleted
|
||||
soft_delete -> error
|
||||
active -> soft_delete
|
||||
stopped -> soft_delete
|
||||
|
||||
restore [shape="rectangle"]
|
||||
restore -> active
|
||||
restore -> error
|
||||
soft_deleted -> restore
|
||||
|
||||
pause [shape="rectangle"]
|
||||
pause -> paused
|
||||
pause -> error
|
||||
active -> pause
|
||||
|
||||
unpause [shape="rectangle"]
|
||||
unpause -> active
|
||||
unpause -> error
|
||||
paused -> unpause
|
||||
|
||||
suspend [shape="rectangle"]
|
||||
suspend -> suspended
|
||||
suspend -> error
|
||||
active -> suspend
|
||||
|
||||
resume [shape="rectangle"]
|
||||
resume -> active
|
||||
resume -> error
|
||||
suspended -> resume
|
||||
|
||||
start [shape="rectangle"]
|
||||
start -> active
|
||||
start -> error
|
||||
stopped -> start
|
||||
|
||||
stop [shape="rectangle"]
|
||||
stop -> stopped
|
||||
stop -> error
|
||||
active -> stop
|
||||
|
||||
rescue [shape="rectangle"]
|
||||
rescue -> rescued
|
||||
rescue -> error
|
||||
active -> rescue
|
||||
stopped -> rescue
|
||||
|
||||
unrescue [shape="rectangle"]
|
||||
unrescue -> active
|
||||
rescued -> unrescue
|
||||
|
||||
resize [shape="rectangle"]
|
||||
resize -> resized
|
||||
resize -> error
|
||||
active -> resize
|
||||
stopped -> resize
|
||||
|
||||
confirm_resize [shape="rectangle"]
|
||||
confirm_resize -> active
|
||||
confirm_resize -> error
|
||||
resized -> confirm_resize
|
||||
confirm_resize [shape="rectangle"]
|
||||
|
||||
revert_resize -> active
|
||||
revert_resize -> error
|
||||
resized -> revert_resize
|
||||
|
||||
snapshot [shape="rectangle"]
|
||||
snapshot -> active
|
||||
snapshot -> stopped
|
||||
snapshot -> error
|
||||
active -> snapshot
|
||||
stopped -> snapshot
|
||||
|
||||
backup [shape="rectangle"]
|
||||
backup -> active
|
||||
backup -> stopped
|
||||
backup -> error
|
||||
active -> backup
|
||||
stopped -> backup
|
||||
|
||||
rebuild [shape="rectangle"]
|
||||
rebuild -> active
|
||||
rebuild -> error
|
||||
active -> rebuild
|
||||
stopped -> rebuild
|
||||
|
||||
set_admin_password [shape="rectangle"]
|
||||
set_admin_password -> active
|
||||
set_admin_password -> error
|
||||
active -> set_admin_password
|
||||
|
||||
reboot [shape="rectangle"]
|
||||
reboot -> active
|
||||
reboot -> error
|
||||
active -> reboot
|
||||
stopped -> reboot
|
||||
rescued -> reboot
|
||||
|
||||
live_migrate [shape="rectangle"]
|
||||
live_migrate -> active
|
||||
live_migrate -> error
|
||||
active -> live_migrate
|
||||
}
|
||||
|
||||
.. image:: /images/PowerStates1.png
|
||||
|
||||
|
@ -24,7 +24,7 @@ Scheduler base class that all Schedulers should inherit from
|
||||
from nova.compute import api as compute_api
|
||||
from nova.compute import power_state
|
||||
from nova.compute import rpcapi as compute_rpcapi
|
||||
from nova.compute import vm_states
|
||||
from nova.compute import task_states
|
||||
from nova import db
|
||||
from nova import exception
|
||||
from nova import flags
|
||||
@ -228,7 +228,7 @@ class Scheduler(object):
|
||||
disk_over_commit)
|
||||
|
||||
# Changing instance_state.
|
||||
values = {"vm_state": vm_states.MIGRATING}
|
||||
values = {"task_state": task_states.MIGRATING}
|
||||
|
||||
# update instance state and notify
|
||||
(old_ref, new_instance_ref) = db.instance_update_and_get_original(
|
||||
|
@ -22,6 +22,7 @@ Tests For Scheduler
|
||||
from nova.compute import api as compute_api
|
||||
from nova.compute import power_state
|
||||
from nova.compute import rpcapi as compute_rpcapi
|
||||
from nova.compute import task_states
|
||||
from nova.compute import vm_states
|
||||
from nova import context
|
||||
from nova import db
|
||||
@ -454,7 +455,7 @@ class SchedulerTestCase(test.TestCase):
|
||||
self.driver._live_migration_common_check(self.context, instance,
|
||||
dest, block_migration, disk_over_commit)
|
||||
db.instance_update_and_get_original(self.context, instance['id'],
|
||||
{"vm_state": vm_states.MIGRATING}).AndReturn(
|
||||
{"task_state": task_states.MIGRATING}).AndReturn(
|
||||
(instance, instance))
|
||||
|
||||
driver.cast_to_compute_host(self.context, instance['host'],
|
||||
@ -563,7 +564,7 @@ class SchedulerTestCase(test.TestCase):
|
||||
).AndReturn(True)
|
||||
|
||||
db.instance_update_and_get_original(self.context, instance['id'],
|
||||
{"vm_state": vm_states.MIGRATING}).AndReturn(
|
||||
{"task_state": task_states.MIGRATING}).AndReturn(
|
||||
(instance, instance))
|
||||
|
||||
driver.cast_to_compute_host(self.context, instance['host'],
|
||||
|
@ -26,7 +26,7 @@ import time
|
||||
|
||||
from nova import test
|
||||
|
||||
from nova.compute import task_states
|
||||
from nova.compute import vm_states
|
||||
from nova import db
|
||||
from nova import flags
|
||||
from nova import log
|
||||
@ -150,16 +150,19 @@ class ImageCacheManagerTestCase(test.TestCase):
|
||||
'host': FLAGS.host,
|
||||
'name': 'inst-1',
|
||||
'uuid': '123',
|
||||
'vm_state': '',
|
||||
'task_state': ''},
|
||||
{'image_ref': '2',
|
||||
'host': FLAGS.host,
|
||||
'name': 'inst-2',
|
||||
'uuid': '456',
|
||||
'vm_state': '',
|
||||
'task_state': ''},
|
||||
{'image_ref': '2',
|
||||
'host': 'remotehost',
|
||||
'name': 'inst-3',
|
||||
'uuid': '789',
|
||||
'vm_state': '',
|
||||
'task_state': ''}])
|
||||
|
||||
image_cache_manager = imagecache.ImageCacheManager()
|
||||
@ -183,7 +186,8 @@ class ImageCacheManagerTestCase(test.TestCase):
|
||||
'host': FLAGS.host,
|
||||
'name': 'inst-1',
|
||||
'uuid': '123',
|
||||
'task_state': task_states.RESIZE_VERIFY}])
|
||||
'vm_state': vm_states.RESIZED,
|
||||
'task_state': None}])
|
||||
|
||||
image_cache_manager = imagecache.ImageCacheManager()
|
||||
image_cache_manager._list_running_instances(None)
|
||||
@ -766,11 +770,13 @@ class ImageCacheManagerTestCase(test.TestCase):
|
||||
'host': FLAGS.host,
|
||||
'name': 'instance-1',
|
||||
'uuid': '123',
|
||||
'vm_state': '',
|
||||
'task_state': ''},
|
||||
{'image_ref': '1',
|
||||
'host': FLAGS.host,
|
||||
'name': 'instance-2',
|
||||
'uuid': '456',
|
||||
'vm_state': '',
|
||||
'task_state': ''}])
|
||||
|
||||
image_cache_manager = imagecache.ImageCacheManager()
|
||||
@ -865,11 +871,13 @@ class ImageCacheManagerTestCase(test.TestCase):
|
||||
'host': FLAGS.host,
|
||||
'name': 'instance-1',
|
||||
'uuid': '123',
|
||||
'vm_state': '',
|
||||
'task_state': ''},
|
||||
{'image_ref': '1',
|
||||
'host': FLAGS.host,
|
||||
'name': 'instance-2',
|
||||
'uuid': '456',
|
||||
'vm_state': '',
|
||||
'task_state': ''}])
|
||||
|
||||
def touch(filename):
|
||||
|
Loading…
Reference in New Issue
Block a user