Merge "Remove containers before removing associated storage"

This commit is contained in:
Zuul 2019-09-27 19:43:52 +00:00 committed by Gerrit Code Review
commit 89b3f2db38

View File

@ -176,14 +176,7 @@ def rm_container(name):
if cmd_stderr:
log.debug(cmd_stderr)
log.info('Removing container: %s' % name)
rm_cli_cmd = [cli_cmd, 'rm']
# --storage is used as a mitigation of
# https://github.com/containers/libpod/issues/3906
# Also look https://bugzilla.redhat.com/show_bug.cgi?id=1747885
if container_cli == 'podman':
rm_cli_cmd.extend(['--storage'])
rm_cli_cmd.append(name)
def run_cmd(rm_cli_cmd):
subproc = subprocess.Popen(rm_cli_cmd,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
@ -196,6 +189,18 @@ def rm_container(name):
'No such container: {}\n'.format(name):
log.debug(cmd_stderr)
log.info('Removing container: %s' % name)
rm_cli_cmd = [cli_cmd, 'rm']
rm_cli_cmd.append(name)
run_cmd(rm_cli_cmd)
# rm --storage is used as a mitigation of
# https://github.com/containers/libpod/issues/3906
# Also look https://bugzilla.redhat.com/show_bug.cgi?id=1747885
if container_cli == 'podman':
rm_storage_cli_cmd = [cli_cmd, 'rm', '--storage']
rm_storage_cli_cmd.append(name)
run_cmd(rm_storage_cli_cmd)
process_count = int(os.environ.get('PROCESS_COUNT',
multiprocessing.cpu_count()))