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
This commit is contained in:
Feng Shengqin 2018-08-15 14:47:34 +08:00
parent c3418885fa
commit a1d45aeb1c
1 changed files with 2 additions and 2 deletions

View File

@ -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,