From a1d45aeb1ca7804d349d78a44559df0610bef4bf Mon Sep 17 00:00:00 2001 From: Feng Shengqin Date: Wed, 15 Aug 2018 14:47:34 +0800 Subject: [PATCH] Optimize container_rebuild 1. the status is updated after created in Docker, so it is needless to set CREATED here. 2. it should do some cleanup when failed to create Change-Id: Ib3dfe7a4523c081a030ee8833086241b74fddf1c --- zun/compute/manager.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zun/compute/manager.py b/zun/compute/manager.py index 8ac043475..8c6e1aa1c 100644 --- a/zun/compute/manager.py +++ b/zun/compute/manager.py @@ -652,15 +652,15 @@ class Manager(periodic_task.PeriodicTasks): consts.CONTAINER_CREATING) created_container = self._do_container_create_base( context, container, network_info, vol_info) - self._update_container_state(context, container, consts.CREATED) except Exception as e: with excutils.save_and_reraise_exception(): LOG.error("Rebuild container:%s failed, " "reason of failure is: %s", container.uuid, e) + self._fail_container(context, container, six.text_type(e)) + LOG.info("rebuild container: %s success", created_container.uuid) if ori_status == consts.RUNNING: self._do_container_start(context, created_container) - return def _get_vol_info(self, context, container): volumes = objects.VolumeMapping.list_by_container(context,