diff --git a/zun/compute/manager.py b/zun/compute/manager.py index a9fdfd3fa..fb03642bf 100644 --- a/zun/compute/manager.py +++ b/zun/compute/manager.py @@ -98,22 +98,12 @@ class Manager(periodic_task.PeriodicTasks): return if container.task_state == consts.CONTAINER_STOPPING: - if container.status == consts.STOPPED: - LOG.info("Container %s is already stop when stop is called.", - container.uuid) - self._update_task_state(context, container, None) - else: - self.container_stop(context, container, - CONF.docker.default_timeout) + self.container_stop(context, container, + CONF.docker.default_timeout) return if container.task_state == consts.CONTAINER_STARTING: - if container.status == consts.RUNNING: - LOG.info("Container %s is already start when start is called.", - container.uuid) - self._update_task_state(context, container, None) - else: - self.container_start(context, container) + self.container_start(context, container) return def _fail_container(self, context, container, error, unset_host=False): diff --git a/zun/tests/unit/compute/test_compute_manager.py b/zun/tests/unit/compute/test_compute_manager.py index c954aa8b4..8997b235d 100644 --- a/zun/tests/unit/compute/test_compute_manager.py +++ b/zun/tests/unit/compute/test_compute_manager.py @@ -126,15 +126,6 @@ class TestManager(base.TestCase): container_1, 10) - @mock.patch.object(Container, 'save') - def test_init_container_retries_start_already(self, mock_save): - container = Container(self.context, **utils.get_test_container()) - container.task_state = consts.CONTAINER_STARTING - container.status = consts.RUNNING - self.compute_manager._init_container(self.context, container) - self.assertEqual(container.status, consts.RUNNING) - self.assertIsNone(container.task_state) - @mock.patch.object(manager.Manager, 'container_stop') @mock.patch.object(Container, 'save') def test_init_container_retries_stop(self, mock_save, @@ -145,15 +136,6 @@ class TestManager(base.TestCase): mock_container_stop.assert_called_once_with(self.context, container, 60) - @mock.patch.object(Container, 'save') - def test_init_container_retries_stop_already(self, mock_save): - container = Container(self.context, **utils.get_test_container()) - container.task_state = consts.CONTAINER_STOPPING - container.status = consts.STOPPED - self.compute_manager._init_container(self.context, container) - self.assertEqual(container.status, consts.STOPPED) - self.assertIsNone(container.task_state) - @mock.patch.object(manager.Manager, 'container_delete') @mock.patch.object(Container, 'save') def test_init_container_retries_deleting(self, mock_save,