summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLingxian Kong <anlin.kong@gmail.com>2019-12-09 12:04:47 +1300
committerLingxian Kong <anlin.kong@gmail.com>2019-12-10 12:18:32 +1300
commitd93a4109436af6517b9f9276b27c517a30bcd86e (patch)
tree30da3d0f801d5a2af98a0f5c7a44e4f9beb2519e
parentb2a31c5ac5b2abd902a075fa20db07962511faee (diff)
downloadtrove-d93a4109436af6517b9f9276b27c517a30bcd86e.tar.gz
Fix delete instance
Deal with the situation when Trove fails to look for the Nova server when waiting for the db instance ACTIVE Change-Id: I484d45f24176c89d999864d3eb1c48860b3038bd
-rw-r--r--devstack/plugin.sh2
-rwxr-xr-xtrove/taskmanager/models.py20
2 files changed, 16 insertions, 6 deletions
diff --git a/devstack/plugin.sh b/devstack/plugin.sh
index 18b0118a..8f4b3d9e 100644
--- a/devstack/plugin.sh
+++ b/devstack/plugin.sh
@@ -559,7 +559,7 @@ function config_trove_network {
sudo ip route
# Now make sure the conf settings are right
- iniset $TROVE_CONF DEFAULT network_label_regex ${PRIVATE_NETWORK_NAME}
+ iniset $TROVE_CONF DEFAULT network_label_regex ""
iniset $TROVE_CONF DEFAULT ip_regex ""
iniset $TROVE_CONF DEFAULT black_list_regex ""
iniset $TROVE_CONF DEFAULT management_networks ${mgmt_net_id}
diff --git a/trove/taskmanager/models.py b/trove/taskmanager/models.py
index e7a0b400..311e4639 100755
--- a/trove/taskmanager/models.py
+++ b/trove/taskmanager/models.py
@@ -433,20 +433,22 @@ class FreshInstanceTasks(FreshInstance, NotifyMixin, ConfigurationMixin):
TroveInstanceCreate(instance=self,
instance_size=flavor['ram']).notify()
except (TroveError, PollTimeOut) as ex:
- LOG.exception("Failed to create instance %s.", self.id)
+ LOG.error("Failed to create instance %s, error: %s.",
+ self.id, str(ex))
self.update_statuses_on_time_out()
error_message = "%s" % ex
error_details = traceback.format_exc()
except Exception as ex:
- LOG.exception("Failed to send usage create-event for "
- "instance %s.", self.id)
+ LOG.error("Failed to send usage create-event for instance %s, "
+ "error: %s", self.id, str(ex))
error_message = "%s" % ex
error_details = traceback.format_exc()
finally:
if error_message:
inst_models.save_instance_fault(
self.id, error_message, error_details,
- skip_delta=CONF.usage_sleep_time + 1)
+ skip_delta=CONF.usage_sleep_time + 1
+ )
def _create_port(self, network, security_groups, is_mgmt=False,
is_public=False):
@@ -772,7 +774,15 @@ class FreshInstanceTasks(FreshInstance, NotifyMixin, ConfigurationMixin):
raise TroveError(_("Service not active, status: %s") % status)
c_id = self.db_info.compute_instance_id
- server = self.nova_client.servers.get(c_id)
+ try:
+ server = self.nova_client.servers.get(c_id)
+ except Exception as e:
+ raise TroveError(
+ _("Failed to get server %(server)s for instance %(instance)s, "
+ "error: %(error)s"),
+ server=c_id, instance=self.id, error=str(e)
+ )
+
server_status = server.status
if server_status in [InstanceStatus.ERROR,
InstanceStatus.FAILED]: