Don't raise missing ceph peer alarm on simplex

A missing ceph peer alarm was raised on an AIO-SX node.
Since an AIO-SX node only has one node, such an alarm makes
no sense on this kind of setup and it should not be raised.

Note: also added some extra empty lines for improved code
      readability.

Change-Id: Ie6debccad4667e840859eba3d5e369e8932e782a
Closes-bug: 1846287
Signed-off-by: Stefan Dinescu <stefan.dinescu@windriver.com>
This commit is contained in:
Stefan Dinescu 2019-10-08 15:18:29 +03:00
parent ffcb95ba8a
commit d838e22ac6
3 changed files with 13 additions and 2 deletions

View File

@ -1,3 +1,3 @@
SRC_DIR="ceph-manager"
COPY_LIST_TO_TAR="files scripts"
TIS_PATCH_VER=5
TIS_PATCH_VER=6

View File

@ -88,3 +88,6 @@ SB_TIER_TYPE_CEPH = sysinv_constants.SB_TIER_TYPE_CEPH
SB_TIER_SUPPORTED = sysinv_constants.SB_TIER_SUPPORTED
SB_TIER_DEFAULT_NAMES = sysinv_constants.SB_TIER_DEFAULT_NAMES
SB_TIER_CEPH_POOLS = sysinv_constants.SB_TIER_CEPH_POOLS
# System
SYSTEM_MODE_SIMPLEX = sysinv_constants.SYSTEM_MODE_SIMPLEX

View File

@ -22,6 +22,8 @@ from ceph_manager.i18n import _LE
from ceph_manager import constants
from ceph_manager import exception
from tsconfig import tsconfig
LOG = logging.getLogger(__name__)
@ -486,6 +488,7 @@ class Monitor(HandleUpgradesMixin):
reasons = set()
degraded_hosts = set()
severity = fm_constants.FM_ALARM_SEVERITY_CRITICAL
for host_id in hosts:
if len(osds[host_id]) == 0:
reasons.add(constants.ALARM_REASON_NO_OSD)
@ -501,13 +504,16 @@ class Monitor(HandleUpgradesMixin):
elif osd_tree[osd_id]['status'] == 'down':
reasons.add(constants.ALARM_REASON_OSDS_DOWN)
degraded_hosts.add(host_id)
if constants.ALARM_REASON_OSDS_OUT in reasons \
and constants.ALARM_REASON_OSDS_DOWN in reasons:
reasons.add(constants.ALARM_REASON_OSDS_DOWN_OUT)
reasons.remove(constants.ALARM_REASON_OSDS_OUT)
if constants.ALARM_REASON_OSDS_DOWN in reasons \
and constants.ALARM_REASON_OSDS_DOWN_OUT in reasons:
reasons.remove(constants.ALARM_REASON_OSDS_DOWN)
reason = "/".join(list(reasons))
if severity == fm_constants.FM_ALARM_SEVERITY_CRITICAL:
reason = "{} {}: {}".format(
@ -519,8 +525,10 @@ class Monitor(HandleUpgradesMixin):
fm_constants.ALARM_MAJOR_REPLICATION,
osd_tree[group_id]['name'],
reason)
if len(degraded_hosts) == 0:
if len(hosts) < 2:
if (len(hosts) < 2 and
tsconfig.system_mode != constants.SYSTEM_MODE_SIMPLEX):
fn_report_alarm(
osd_tree[group_id]['name'],
"{} {}: {}".format(