Delete error volumes when deleting instance
Backport candidate.
Change-Id: I799f7b30e1af396a8ae540cff2ba8b548a23f82c
Story: 2007436
Task: 39083
(cherry picked from commit 513e0dd3cd
)
This commit is contained in:
parent
095a5b0514
commit
ce23f27bfe
|
@ -387,7 +387,7 @@ function setup_mgmt_network() {
|
|||
|
||||
if [[ "$IP_VERSION" =~ 4.* ]]; then
|
||||
NEW_SUBNET_ID=$(create_mgmt_subnet_v4 ${PROJECT_ID} ${network_id} ${SUBNET_NAME} ${SUBNET_RANGE})
|
||||
openstack router add subnet $ROUTER_ID $NEW_SUBNET_ID
|
||||
# openstack router add subnet $ROUTER_ID $NEW_SUBNET_ID
|
||||
fi
|
||||
# Trove doesn't support IPv6 for now.
|
||||
# if [[ "$IP_VERSION" =~ .*6 ]]; then
|
||||
|
|
|
@ -783,7 +783,9 @@ class BaseInstance(SimpleInstance):
|
|||
try:
|
||||
if self.volume_id:
|
||||
volume = self.volume_client.volumes.get(self.volume_id)
|
||||
if volume.status == "available":
|
||||
if volume.status in ["available", "error"]:
|
||||
LOG.info("Deleting volume %s for instance %s",
|
||||
self.volume_id, self.id)
|
||||
volume.delete()
|
||||
except Exception as e:
|
||||
LOG.warning("Failed to delete volume for instance %s, error: %s",
|
||||
|
|
Loading…
Reference in New Issue