copr: try to remove also volumes
This commit is contained in:
parent
0562aa35e9
commit
ea46351f09
1 changed files with 14 additions and 0 deletions
|
@ -250,6 +250,20 @@ def delete_instance_attempt(service, instance_name, opts):
|
||||||
assert resp.status_code == 204
|
assert resp.status_code == 204
|
||||||
log.debug("Delete IP request delivered")
|
log.debug("Delete IP request delivered")
|
||||||
|
|
||||||
|
# Query all volumes only after already potentionaly deleting an instance.
|
||||||
|
# The volumes might have been deleted automatically
|
||||||
|
volume_ids = []
|
||||||
|
volumes = service.list_volumes(limit=999).result["volumes"]
|
||||||
|
for volume in volumes:
|
||||||
|
if volume["name"].startswith(instance_name):
|
||||||
|
volume_ids.append(volume["id"])
|
||||||
|
|
||||||
|
if volume_ids:
|
||||||
|
for volume_id in volume_ids:
|
||||||
|
resp = service.delete_volume(volume_id)
|
||||||
|
assert resp.status_code == 204
|
||||||
|
log.debug("Delete volume request delivered")
|
||||||
|
|
||||||
|
|
||||||
def _get_arg_parser():
|
def _get_arg_parser():
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue