Optimize container CLI for getting unique names

Do not call it twice in the while{} loop. It is pointless to
double-check for a container existence after we have determined weither
its name is in use or not.

This decreases the pressure on the container system.

Change-Id: Ife65f082f389ad4a730b3f9cf07d32ac4be32b45
Signed-off-by: Bogdan Dobrelya <bdobreli@redhat.com>
(cherry picked from commit a6df749249)
This commit is contained in:
Bogdan Dobrelya 2019-07-30 15:19:42 +02:00
parent 90cf8bbb3e
commit 17d23079cc
1 changed files with 1 additions and 0 deletions

View File

@ -155,6 +155,7 @@ class DockerRunner(object):
suffix = ''.join(random.choice(
string.ascii_lowercase + string.digits) for i in range(8))
container_name = '%s-%s' % (container, suffix)
break
return container_name
def discover_container_name(self, container, cid):