Merge "Converting reboot to use instance objects"

This commit is contained in:
Jenkins
2011-11-09 17:18:21 +00:00
committed by Gerrit Code Review
2 changed files with 12 additions and 6 deletions

View File

@@ -332,6 +332,12 @@ class reroute_compute(object):
context and resource id. Derived class should override this."""
context = kwargs.get('context', None)
instance_id = kwargs.get('instance_id', None)
#NOTE(blamar): This is going to get worse before it gets better...
instance = kwargs.get('instance', None)
if instance is not None:
instance_id = instance['uuid']
if len(args) > 0 and not context:
context = args[1]
if len(args) > 1 and not instance_id:

View File

@@ -343,7 +343,7 @@ class ComputeTestCase(test.TestCase):
self.compute.resume_instance(self.context, instance_id)
self.compute.terminate_instance(self.context, instance_id)
def test_soft_reboot_api(self):
def test_reboot_soft_api(self):
"""Ensure instance can be soft rebooted"""
instance_id = self._create_instance()
self.compute.run_instance(self.context, instance_id)
@@ -352,14 +352,14 @@ class ComputeTestCase(test.TestCase):
self.assertEqual(inst_ref['task_state'], None)
reboot_type = "SOFT"
self.compute_api.reboot(self.context, instance_id, reboot_type)
self.compute_api.reboot(self.context, inst_ref, reboot_type)
inst_ref = db.instance_get(self.context, instance_id)
self.assertEqual(inst_ref['task_state'], task_states.REBOOTING)
db.instance_destroy(self.context, instance_id)
def test_soft_reboot(self):
def test_reboot_soft(self):
"""Ensure instance can be soft rebooted"""
instance_id = self._create_instance()
self.compute.run_instance(self.context, instance_id)
@@ -375,7 +375,7 @@ class ComputeTestCase(test.TestCase):
self.compute.terminate_instance(self.context, instance_id)
def test_hard_reboot_api(self):
def test_reboot_hard_api(self):
"""Ensure instance can be hard rebooted"""
instance_id = self._create_instance()
self.compute.run_instance(self.context, instance_id)
@@ -384,14 +384,14 @@ class ComputeTestCase(test.TestCase):
self.assertEqual(inst_ref['task_state'], None)
reboot_type = "HARD"
self.compute_api.reboot(self.context, instance_id, reboot_type)
self.compute_api.reboot(self.context, inst_ref, reboot_type)
inst_ref = db.instance_get(self.context, instance_id)
self.assertEqual(inst_ref['task_state'], task_states.REBOOTING_HARD)
db.instance_destroy(self.context, instance_id)
def test_hard_reboot(self):
def test_reboot_hard(self):
"""Ensure instance can be hard rebooted"""
instance_id = self._create_instance()
self.compute.run_instance(self.context, instance_id)