From 62ca3783ce4fcc0b03e96936972abc83b54c772f Mon Sep 17 00:00:00 2001 From: YangLei Date: Tue, 21 May 2013 15:00:53 +0800 Subject: No relevant message when stop a stopped VM When user tries to stop a stopped VM, there is no need to stop it again, and We need return it's vm_state. Fixes bug 1181934 Change-Id: I71772dfcead440cb49b6ccdbb4e1a891475bb75e --- nova/tests/compute/test_compute.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'nova/tests') diff --git a/nova/tests/compute/test_compute.py b/nova/tests/compute/test_compute.py index 3101e3aa2..6711de77f 100644 --- a/nova/tests/compute/test_compute.py +++ b/nova/tests/compute/test_compute.py @@ -5119,6 +5119,16 @@ class ComputeAPITestCase(BaseTestCase): db.instance_destroy(self.context, instance['uuid']) + def test_stop_a_stopped_inst(self): + instance = jsonutils.to_primitive(self._create_fake_instance( + {'vm_state': vm_states.STOPPED})) + + self.assertRaises(exception.InstanceInvalidState, + self.compute_api.stop, + self.context, instance) + + db.instance_destroy(self.context, instance['uuid']) + def test_stop_no_host(self): instance = self._create_fake_instance(params={'host': ''}) -- cgit