Merge "Translate the snapshot_pending state for old instances"
This commit is contained in:
commit
462e752f54
|
@ -436,6 +436,13 @@ class Instance(base.NovaPersistentObject, base.NovaObject):
|
|||
updates['cleaned'] = 0
|
||||
|
||||
if expected_task_state is not None:
|
||||
if (self.VERSION == '1.9' and
|
||||
expected_task_state == 'image_snapshot'):
|
||||
# NOTE(danms): Icehouse introduced a pending state which
|
||||
# Havana doesn't know about. If we're an old instance,
|
||||
# tolerate the pending state as well
|
||||
expected_task_state = [
|
||||
expected_task_state, 'image_snapshot_pending']
|
||||
updates['expected_task_state'] = expected_task_state
|
||||
if expected_vm_state is not None:
|
||||
updates['expected_vm_state'] = expected_vm_state
|
||||
|
|
|
@ -258,7 +258,13 @@ class _TestInstanceObject(object):
|
|||
if exp_vm_state:
|
||||
expected_updates['expected_vm_state'] = exp_vm_state
|
||||
if exp_task_state:
|
||||
expected_updates['expected_task_state'] = exp_task_state
|
||||
if (exp_task_state == 'image_snapshot' and
|
||||
'instance_version' in save_kwargs and
|
||||
save_kwargs['instance_version'] == '1.9'):
|
||||
expected_updates['expected_task_state'] = [
|
||||
'image_snapshot', 'image_snapshot_pending']
|
||||
else:
|
||||
expected_updates['expected_task_state'] = exp_task_state
|
||||
self.mox.StubOutWithMock(db, 'instance_get_by_uuid')
|
||||
self.mox.StubOutWithMock(db, 'instance_update_and_get_original')
|
||||
self.mox.StubOutWithMock(db, 'instance_info_cache_update')
|
||||
|
@ -295,6 +301,8 @@ class _TestInstanceObject(object):
|
|||
self.mox.ReplayAll()
|
||||
|
||||
inst = instance.Instance.get_by_uuid(self.context, old_ref['uuid'])
|
||||
if 'instance_version' in save_kwargs:
|
||||
inst.VERSION = save_kwargs.pop('instance_version')
|
||||
self.assertEqual('old', inst.task_state)
|
||||
self.assertEqual('old', inst.vm_state)
|
||||
self.assertEqual('old', inst.user_data)
|
||||
|
@ -323,6 +331,11 @@ class _TestInstanceObject(object):
|
|||
def test_save_exp_task_state(self):
|
||||
self._save_test_helper(None, {'expected_task_state': ['meow']})
|
||||
|
||||
def test_save_exp_task_state_havana(self):
|
||||
self._save_test_helper(None, {
|
||||
'expected_task_state': 'image_snapshot',
|
||||
'instance_version': '1.9'})
|
||||
|
||||
def test_save_exp_vm_state_api_cell(self):
|
||||
self._save_test_helper('api', {'expected_vm_state': ['meow']})
|
||||
|
||||
|
|
Loading…
Reference in New Issue