Cleanup containers in the same loop as they are created
Split delete_missing_and_updated() into 2 methods:
* delete_missing(), that will remove all containers installed on the
host but missing from the given config. This runs outside of the
loop, once.
* delete_updated(), that will remove a container installed on the host
(if present), that is part of the config, if config_data changed or
didn't exist. It runs within the create loop, so the downtime
between a container removal and creation should be shorter than
before.
* make delete_missing(), delete_updated() and rename_containers()
returning True, if any container has been touched by either. Use
that flag in order to keep the container_names contents always
actual.
* in order to make that cached container_names working and saving off
extra podman ps/inspect calls, rework it to return a list instead
of an iterator. There is no huge lists of containers, iterators buy
us nothing here, while podman CLI calls are the more expensive
thing and we optimize the latter instead.
Reviewed: https:/ /review. opendev. org/711426 /git.openstack. org/cgit/ openstack/ paunch/ commit/ ?id=fab6bd7c18a b447f9b7beca75f b00398534e0359
Committed: https:/
Submitter: Zuul
Branch: stable/stein
commit fab6bd7c18ab447 f9b7beca75fb003 98534e0359
Author: Emilien Macchi <email address hidden>
Date: Wed Feb 12 10:21:38 2020 -0500
Cleanup containers in the same loop as they are created
Split delete_ missing_ and_updated( ) into 2 methods:
* delete_missing(), that will remove all containers installed on the
host but missing from the given config. This runs outside of the
loop, once.
* delete_updated(), that will remove a container installed on the host
(if present), that is part of the config, if config_data changed or
didn't exist. It runs within the create loop, so the downtime
between a container removal and creation should be shorter than
before.
* make delete_missing(), delete_updated() and rename_containers()
returning True, if any container has been touched by either. Use
that flag in order to keep the container_names contents always
actual.
* in order to make that cached container_names working and saving off
extra podman ps/inspect calls, rework it to return a list instead
of an iterator. There is no huge lists of containers, iterators buy
us nothing here, while podman CLI calls are the more expensive
thing and we optimize the latter instead.
(cherry picked from commit eb3d3b75bb8bf30 0fb52390610a6a5 3ddbfaa48e) 5287d12f4207489 a13e0891943
Co-Authored-By: Bogdan Dobrelya <email address hidden>
Change-Id: I3c6d0670e11d03
Closes-Bug: #1862954