diff options
author | Lingxian Kong <anlin.kong@gmail.com> | 2020-03-17 14:20:52 +1300 |
---|---|---|
committer | Lingxian Kong <anlin.kong@gmail.com> | 2020-03-18 12:22:47 +1300 |
commit | ce23f27bfeccf21c058b806f5c7a54dc1b82ffc3 (patch) | |
tree | 1a72018e0242e3830842b30ed9dfbb01ea51a16b | |
parent | 095a5b0514f800258a3e3cccc94c94135cab8ac5 (diff) | |
download | trove-ce23f27bfeccf21c058b806f5c7a54dc1b82ffc3.tar.gz |
Delete error volumes when deleting instance
Backport candidate.
Change-Id: I799f7b30e1af396a8ae540cff2ba8b548a23f82c
Story: 2007436
Task: 39083
(cherry picked from commit 513e0dd3cd27790718b31c6d0d4b556bd6de0793)
-rw-r--r-- | devstack/plugin.sh | 2 | ||||
-rw-r--r-- | trove/instance/models.py | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/devstack/plugin.sh b/devstack/plugin.sh index 840760ca..5d313d77 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -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 diff --git a/trove/instance/models.py b/trove/instance/models.py index 7a13af2e..a4c959e9 100644 --- a/trove/instance/models.py +++ b/trove/instance/models.py @@ -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", |