class CephManagerException(Exception): message = _("An unknown exception occurred.") def __init__(self, message=None, **kwargs): self.kwargs = kwargs if not message: try: message = self.message % kwargs except TypeError: LOG.warn(_LW('Exception in string format operation')) for name, value in kwargs.items(): LOG.error("%s: %s" % (name, value)) # at least get the core message out if something happened message = self.message super(CephManagerException, self).__init__(message)
def set_flag_require_jewel_osds(self): try: response, body = self.service.ceph_api.osd_set_key( constants.CEPH_FLAG_REQUIRE_JEWEL_OSDS, body='json') LOG.info(_LI("Set require_jewel_osds flag")) except IOError as e: raise exception.CephApiFailure(call="osd_set_key", reason=str(e)) else: if not response.ok: raise exception.CephSetKeyFailure( flag=constants.CEPH_FLAG_REQUIRE_JEWEL_OSDS, extra=_("needed to complete upgrade to Jewel"), response_status_code=response.status_code, response_reason=response.reason, status=body.get('status'), output=body.get('output'))
class CephApiFailure(CephManagerException): message = _("API failure: " "call=%(call)s, reason=%(reason)s")
class CephSetKeyFailure(CephManagerException): message = _("Error setting the Ceph flag " "'%(flag)s' %(extra)s: " "response=%(response_status_code)s:%(response_reason)s, " "status=%(status)s, output=%(output)s")
class CephPoolGetParamFailure(CephManagerException): message = _("Cannot get Ceph OSD pool parameter: " "pool_name=%(pool_name)s, param=%(param)s. " "Reason: %(reason)s")
class CephPoolRulesetFailure(CephManagerException): message = _("Assigning crush ruleset to OSD " "pool %(name)s failed: %(reason)s")
class CephPoolDeleteFailure(CephManagerException): message = _("Deleting OSD pool %(name)s failed: %(reason)s")
class CephPoolGetQuotaFailure(CephManagerException): message = _("Error geting the OSD pool quota for %(pool)s") \ + ": %(reason)s"
class CephPoolSetQuotaFailure(CephManagerException): message = _("Error seting the OSD pool " "quota %(name)s for %(pool)s to %(value)s") \ + ": %(reason)s"
CEPH_HEALTH_ERR = 'HEALTH_ERR' CEPH_HEALTH_DOWN = 'CEPH_DOWN' # Statuses not reported by Ceph CEPH_STATUS_CUSTOM = [CEPH_HEALTH_DOWN] SEVERITY = {CEPH_HEALTH_DOWN: 'critical', CEPH_HEALTH_ERR: 'critical', CEPH_HEALTH_WARN: 'warning'} SERVICE_AFFECTING = {CEPH_HEALTH_DOWN: True, CEPH_HEALTH_ERR: True, CEPH_HEALTH_WARN: False} # TODO this will later change based on parsed health ALARM_REASON_NO_OSD = _('no OSDs') ALARM_REASON_OSDS_DOWN = _('OSDs are down') ALARM_REASON_OSDS_OUT = _('OSDs are out') ALARM_REASON_OSDS_DOWN_OUT = _('OSDs are down/out') ALARM_REASON_PEER_HOST_DOWN = _('peer host down') REPAIR_ACTION_MAJOR_CRITICAL_ALARM = _( 'Ensure storage hosts from replication group are unlocked and available.' 'Check if OSDs of each storage host are up and running.' 'If problem persists, contact next level of support.') REPAIR_ACTION = _('If problem persists, contact next level of support.') SYSINV_CONDUCTOR_TOPIC = 'sysinv.conductor_manager' CEPH_MANAGER_TOPIC = 'sysinv.ceph_manager' SYSINV_CONFIG_FILE = '/etc/sysinv/sysinv.conf'