diff options
author | Lingxian Kong <anlin.kong@gmail.com> | 2019-12-09 12:04:47 +1300 |
---|---|---|
committer | Lingxian Kong <anlin.kong@gmail.com> | 2019-12-21 10:37:44 +0000 |
commit | 3e7b8cf83af78d05f247e7113d560746ef5dde61 (patch) | |
tree | 9f9463d023c9e399d8ba69d113668e4c27074989 | |
parent | 27bdfcf7535d77664ad0d0548e3657be1b9af6dd (diff) | |
download | trove-3e7b8cf83af78d05f247e7113d560746ef5dde61.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
(cherry picked from commit d93a4109436af6517b9f9276b27c517a30bcd86e)
-rw-r--r-- | devstack/plugin.sh | 2 | ||||
-rwxr-xr-x | trove/taskmanager/models.py | 20 |
2 files changed, 16 insertions, 6 deletions
diff --git a/devstack/plugin.sh b/devstack/plugin.sh index 3d4b28de..840760ca 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -555,7 +555,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 c1b3d220..8d480188 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): @@ -774,7 +776,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 LOG.debug("Server status of instance %s is %s", self.id, server_status) if server_status in [InstanceStatus.ERROR, |