Merge "Fix delete instance"

This commit is contained in:
Zuul 2019-12-10 05:40:32 +00:00 committed by Gerrit Code Review
commit 0907c8ec61
2 changed files with 16 additions and 6 deletions

View File

@ -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}

View File

@ -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]: