Skip to content

Instantly share code, notes, and snippets.

@vilobhmm
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vilobhmm/2255592994b14f3b7cfd to your computer and use it in GitHub Desktop.
Save vilobhmm/2255592994b14f3b7cfd to your computer and use it in GitHub Desktop.
Added respective exceptions in nova/exception.py
nova/service.py
try:
self.servicegroup_api.start(self.host)
except exception.ToozBackendConnectionError:
msg = _("Error connecting to coordination backend")
raise exc.HTTPServiceUnavailable(explanation=msg)
except exception.ToozBackendUrlFormatNotsupported:
msg = _("Tooz Backend url format not supported)
raise exc.HTTPBadRequest(explanation=msg)
tz.py
def start(self, member_id):$
backend_url = cfg.CONF.coordination.backend_url$
try:$
self._coordinator = tooz.coordination.get_coordinator($
backend_url, member_id)$
self._coordinator.start()$
self._started = True$
LOG.info(_LI('Coordination backend started successfully'))$
except tooz.coordination.ToozError:$
self._started = False$
LOG.exception(_LE('Error connecting to coordination backend'))$
raise exception.ToozBackendConnectionError()$
except RuntimeError:$
self._started = False$
raise exception.ToozBackendUrlFormatNotsupported()$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment