It seems like the idea is to delete a specific image, and it's just trying to clean up the container in case it's now empty. You said it was sporadic, but it seems like if you've got multiple images in a container, deleting the first one should reliably trip the 409. Probably want to get the opinion of someone better acquainted with glance, but I think we might just need that last line to be something like
try:
# try to clean up the container, too connection.delete_container(location.store_location.container)
except swiftclient.ClientException as e:
if e.http_status != http_client.CONFLICT:
raise
# else, must not be empty yet
Oh, so it does.
Stepping back a bit, it looks like the only container delete in glance_store is in MultiTenantStor e.delete: https:/ /github. com/openstack/ glance_ store/blob/ master/ glance_ store/_ drivers/ swift/store. py#L1507- L1512
It seems like the idea is to delete a specific image, and it's just trying to clean up the container in case it's now empty. You said it was sporadic, but it seems like if you've got multiple images in a container, deleting the first one should reliably trip the 409. Probably want to get the opinion of someone better acquainted with glance, but I think we might just need that last line to be something like
try:
connection. delete_ container( location. store_location. container) ClientException as e: CONFLICT:
# try to clean up the container, too
except swiftclient.
if e.http_status != http_client.
raise
# else, must not be empty yet