Merge remote-tracking branch 'origin/master' into f/centos8
Signed-off-by: Charles Short <charles.short@windriver.com> Change-Id: I59d1e0fae5c3767febdb2f2c5eaab731c7279268
This commit is contained in:
commit
85bab5d2b3
11
.zuul.yaml
11
.zuul.yaml
|
@ -4,14 +4,17 @@
|
|||
- publish-stx-docs
|
||||
- stx-api-ref-jobs
|
||||
- stx-release-notes-jobs
|
||||
- stx-bandit-jobs
|
||||
check:
|
||||
jobs:
|
||||
- openstack-tox-pep8
|
||||
- openstack-tox-linters
|
||||
- ha-tox-pylint
|
||||
gate:
|
||||
jobs:
|
||||
- openstack-tox-pep8
|
||||
- openstack-tox-linters
|
||||
- ha-tox-pylint
|
||||
post:
|
||||
jobs:
|
||||
- stx-ha-upload-git-mirror
|
||||
|
@ -55,6 +58,14 @@
|
|||
nfv: https://opendev.org/starlingx/nfv
|
||||
update: https://opendev.org/starlingx/update
|
||||
|
||||
- job:
|
||||
name: ha-tox-pylint
|
||||
parent: tox
|
||||
description: |
|
||||
Run pylint test for ha in python2.7
|
||||
nodeset: ubuntu-bionic
|
||||
vars:
|
||||
tox_envlist: pylint
|
||||
- job:
|
||||
name: stx-ha-upload-git-mirror
|
||||
parent: upload-git-mirror
|
||||
|
|
|
@ -50,10 +50,12 @@ source_suffix = '.rst'
|
|||
master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
repository_name = 'openstack/stx-ha'
|
||||
project = u'StarlingX HA'
|
||||
bug_project = 'starlingx'
|
||||
bug_tag = 'stx.ha'
|
||||
|
||||
# openstackdocstheme options
|
||||
openstackdocs_repo_name = 'starlingx/ha'
|
||||
openstackdocs_use_storyboard = True
|
||||
openstackdocs_auto_name = False
|
||||
|
||||
# If true, the current module name will be prepended to all description
|
||||
# unit titles (such as .. function::).
|
||||
|
@ -64,7 +66,7 @@ add_module_names = False
|
|||
show_authors = False
|
||||
|
||||
# The name of the Pygments (syntax highlighting) style to use.
|
||||
pygments_style = 'sphinx'
|
||||
pygments_style = 'native'
|
||||
|
||||
# Grouping the document tree into LaTeX files. List of tuples
|
||||
# (source start file, target name, title, author, documentclass
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
sphinx>=1.6.2
|
||||
openstackdocstheme>=1.26.0 # Apache-2.0
|
||||
sphinx>=2.0.0,!=2.1.0 # BSD
|
||||
openstackdocstheme>=2.2.1 # Apache-2.0
|
||||
|
||||
# Release Notes
|
||||
reno>=0.1.1 # Apache-2.0
|
||||
reno>=3.1.0 # Apache-2.0
|
||||
|
||||
# API Reference Guide
|
||||
os-api-ref>=1.4.0 # Apache-2.0
|
||||
|
|
|
@ -25,11 +25,6 @@ project = u'StarlingX HA'
|
|||
copyright = u'2018, StarlingX'
|
||||
author = u'StarlingX'
|
||||
|
||||
# The short X.Y version
|
||||
version = u''
|
||||
# The full version, including alpha/beta/rc tags
|
||||
release = u'0.1'
|
||||
|
||||
|
||||
# -- General configuration ---------------------------------------------------
|
||||
|
||||
|
@ -56,8 +51,10 @@ source_suffix = '.rst'
|
|||
# The master toctree document.
|
||||
master_doc = 'index'
|
||||
|
||||
bug_project = 'starlingx'
|
||||
bug_tag = 'stx.ha'
|
||||
# openstackdocstheme options
|
||||
openstackdocs_repo_name = 'starlingx/ha'
|
||||
openstackdocs_use_storyboard = True
|
||||
openstackdocs_auto_name = False
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
@ -72,7 +69,7 @@ language = None
|
|||
exclude_patterns = []
|
||||
|
||||
# The name of the Pygments (syntax highlighting) style to use.
|
||||
pygments_style = 'sphinx'
|
||||
pygments_style = 'native'
|
||||
|
||||
|
||||
# -- Options for HTML output -------------------------------------------------
|
||||
|
|
|
@ -41,8 +41,10 @@ extensions = [
|
|||
'reno.sphinxext',
|
||||
]
|
||||
|
||||
bug_project = 'starlingx'
|
||||
bug_tag = 'stx.ha'
|
||||
# openstackdocstheme options
|
||||
openstackdocs_repo_name = 'starlingx/ha'
|
||||
openstackdocs_use_storyboard = True
|
||||
openstackdocs_auto_name = False
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
# templates_path = ['_templates']
|
||||
|
@ -93,7 +95,7 @@ exclude_patterns = []
|
|||
# show_authors = False
|
||||
|
||||
# The name of the Pygments (syntax highlighting) style to use.
|
||||
pygments_style = 'sphinx'
|
||||
pygments_style = 'native'
|
||||
|
||||
# A list of ignored prefixes for module index sorting.
|
||||
# modindex_common_prefix = []
|
||||
|
@ -142,10 +144,6 @@ html_theme = 'starlingxdocs'
|
|||
# directly to the root of the documentation.
|
||||
# html_extra_path = []
|
||||
|
||||
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
||||
# using the given strftime format.
|
||||
html_last_updated_fmt = '%Y-%m-%d %H:%M'
|
||||
|
||||
# If true, SmartyPants will be used to convert quotes and dashes to
|
||||
# typographically correct entities.
|
||||
# html_use_smartypants = True
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
SRC_DIR=sm-api
|
||||
TAR_NAME=sm-api
|
||||
VERSION=1.0
|
||||
TIS_PATCH_VER=4
|
||||
TIS_PATCH_VER=PKG_GITREVCOUNT
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
SRC_DIR=sm-client
|
||||
TAR_NAME=sm-client
|
||||
VERSION=1.0
|
||||
TIS_PATCH_VER=2
|
||||
TIS_PATCH_VER=PKG_GITREVCOUNT
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright (c) 2014-2018 Wind River Systems, Inc.
|
||||
# Copyright (c) 2014-2020 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
SRC_DIR=sm-tools
|
||||
TAR_NAME=sm-tools
|
||||
VERSION=1.0
|
||||
TIS_PATCH_VER=2
|
||||
TIS_PATCH_VER=PKG_GITREVCOUNT
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
SRC_DIR=$PKG_BASE
|
||||
TIS_PATCH_VER=20
|
||||
TIS_PATCH_VER=PKG_GITREVCOUNT+15
|
||||
|
|
|
@ -232,6 +232,11 @@ SmErrorT sm_hw_get_if_state( const char if_name[], bool* enabled )
|
|||
struct ifreq if_data;
|
||||
SmHwThreadInfoT* thread_info;
|
||||
|
||||
if(strcmp(if_name, "lo") == 0)
|
||||
{
|
||||
*enabled = true;
|
||||
return SM_OKAY;
|
||||
}
|
||||
thread_info = sm_hw_find_thread_info();
|
||||
if( NULL == thread_info )
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright (c) 2014-2018 Wind River Systems, Inc.
|
||||
// Copyright (c) 2014-2020 Wind River Systems, Inc.
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
@ -584,3 +584,17 @@ SmErrorT sm_node_utils_is_aio_duplex( bool* is_aio_duplex )
|
|||
return SM_OKAY;
|
||||
}
|
||||
|
||||
// ****************************************************************************
|
||||
// Node Utilities - Clear the unhealthy flag
|
||||
// ==============================
|
||||
extern void sm_node_utils_reset_unhealthy_flag( void )
|
||||
{
|
||||
if( 0 == access( SM_NODE_UNHEALTHY_FILE, F_OK ) )
|
||||
{
|
||||
unlink( SM_NODE_UNHEALTHY_FILE );
|
||||
if( 0 == access( SM_NODE_UNHEALTHY_FILE, F_OK ) )
|
||||
{
|
||||
DPRINTFE("file did not get removed ; %s", SM_NODE_UNHEALTHY_FILE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright (c) 2014 Wind River Systems, Inc.
|
||||
// Copyright (c) 2014,2020 Wind River Systems, Inc.
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
@ -104,6 +104,12 @@ extern SmErrorT sm_node_utils_is_aio_duplex( bool* is_aio_duplex );
|
|||
extern bool sm_node_utils_set_failover( bool to_disable );
|
||||
// ****************************************************************************
|
||||
|
||||
// ****************************************************************************
|
||||
// Node Utilities - Clear the unhealthy flag
|
||||
// ==============================
|
||||
extern void sm_node_utils_reset_unhealthy_flag( void );
|
||||
// ****************************************************************************
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright (c) 2014-2018 Wind River Systems, Inc.
|
||||
// Copyright (c) 2014-2020 Wind River Systems, Inc.
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
@ -173,6 +173,7 @@ _sm_failover_event_mappings[SM_FAILOVER_EVENT_MAX] =
|
|||
{SM_FAILOVER_EVENT_HEARTBEAT_ENABLED, "heartbeat-enabled"},
|
||||
{SM_FAILOVER_EVENT_IF_STATE_CHANGED, "interface-state-changed"},
|
||||
{SM_FAILOVER_EVENT_FAIL_PENDING_TIMEOUT, "fail-pending-timeout"},
|
||||
{SM_FAILOVER_EVENT_FAILED_RECOVERY_AUDIT, "failed-recovery-audit"},
|
||||
{SM_FAILOVER_EVENT_NODE_ENABLED, "node-enabled"}
|
||||
};
|
||||
|
||||
|
@ -186,6 +187,15 @@ _sm_failover_state_mappings[SM_FAILOVER_STATE_MAX] =
|
|||
{SM_FAILOVER_STATE_SURVIVED, "survived"}
|
||||
};
|
||||
|
||||
static SmValueStrMappingT
|
||||
_sm_failover_interface_state_mappings[SM_FAILOVER_INTERFACE_STATE_MAX] =
|
||||
{
|
||||
{SM_FAILOVER_INTERFACE_UNKNOWN, "unknown"},
|
||||
{SM_FAILOVER_INTERFACE_OK, "ok"},
|
||||
{SM_FAILOVER_INTERFACE_MISSING_HEARTBEAT, "missing-heartbeat"},
|
||||
{SM_FAILOVER_INTERFACE_DOWN, "down"}
|
||||
};
|
||||
|
||||
static SmValueStrMappingT
|
||||
_sm_service_domain_neighbor_state_mappings[SM_SERVICE_DOMAIN_NEIGHBOR_STATE_MAX] =
|
||||
{
|
||||
|
@ -993,6 +1003,17 @@ const char* sm_failover_state_str( SmFailoverStateT state )
|
|||
SM_FAILOVER_STATE_MAX,
|
||||
state ) );
|
||||
}
|
||||
|
||||
// ****************************************************************************
|
||||
// Types - Failover Interface State String
|
||||
// =============================================
|
||||
const char* sm_failover_interface_state_str( SmFailoverInterfaceStateT state )
|
||||
{
|
||||
return( sm_mapping_get_str( _sm_failover_interface_state_mappings,
|
||||
SM_FAILOVER_INTERFACE_STATE_MAX,
|
||||
state ) );
|
||||
}
|
||||
|
||||
// ****************************************************************************
|
||||
|
||||
// ****************************************************************************
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright (c) 2014-2018 Wind River Systems, Inc.
|
||||
// Copyright (c) 2014-2020 Wind River Systems, Inc.
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
@ -293,6 +293,7 @@ typedef enum{
|
|||
SM_FAILOVER_EVENT_HEARTBEAT_ENABLED,
|
||||
SM_FAILOVER_EVENT_IF_STATE_CHANGED,
|
||||
SM_FAILOVER_EVENT_FAIL_PENDING_TIMEOUT,
|
||||
SM_FAILOVER_EVENT_FAILED_RECOVERY_AUDIT,
|
||||
SM_FAILOVER_EVENT_NODE_ENABLED,
|
||||
SM_FAILOVER_EVENT_MAX
|
||||
}SmFailoverEventT;
|
||||
|
@ -730,7 +731,8 @@ typedef enum
|
|||
SM_FAILOVER_INTERFACE_UNKNOWN,
|
||||
SM_FAILOVER_INTERFACE_OK,
|
||||
SM_FAILOVER_INTERFACE_MISSING_HEARTBEAT,
|
||||
SM_FAILOVER_INTERFACE_DOWN
|
||||
SM_FAILOVER_INTERFACE_DOWN,
|
||||
SM_FAILOVER_INTERFACE_STATE_MAX
|
||||
}SmFailoverInterfaceStateT;
|
||||
|
||||
// ****************************************************************************
|
||||
|
@ -960,6 +962,10 @@ extern const char* sm_failover_event_str( SmFailoverEventT event );
|
|||
extern const char* sm_failover_state_str( SmFailoverStateT state );
|
||||
// ****************************************************************************
|
||||
|
||||
const char* sm_failover_interface_state_str( SmFailoverInterfaceStateT state );
|
||||
|
||||
// ****************************************************************************
|
||||
|
||||
// ****************************************************************************
|
||||
// Types - Service Domain Neighbor State Value
|
||||
// ===========================================
|
||||
|
|
|
@ -2,4 +2,4 @@ SRC_DIR=`pwd`
|
|||
COPY_LIST="$PKG_BASE/LICENSE"
|
||||
TAR_NAME=sm-db
|
||||
VERSION=1.0.0
|
||||
TIS_PATCH_VER=31
|
||||
TIS_PATCH_VER=PKG_GITREVCOUNT+19
|
||||
|
|
|
@ -52,7 +52,6 @@ INSERT INTO "SERVICE_GROUP_MEMBERS" VALUES(20,'yes','controller-services','mtc-a
|
|||
INSERT INTO "SERVICE_GROUP_MEMBERS" VALUES(22,'yes','controller-services','hw-mon','critical');
|
||||
INSERT INTO "SERVICE_GROUP_MEMBERS" VALUES(23,'yes','controller-services','dnsmasq','critical');
|
||||
INSERT INTO "SERVICE_GROUP_MEMBERS" VALUES(24,'yes','controller-services','fm-mgr','critical');
|
||||
INSERT INTO "SERVICE_GROUP_MEMBERS" VALUES(25,'yes','controller-services','snmp','critical');
|
||||
INSERT INTO "SERVICE_GROUP_MEMBERS" VALUES(26,'yes','cloud-services','keystone','critical');
|
||||
INSERT INTO "SERVICE_GROUP_MEMBERS" VALUES(49,'yes','directory-services','open-ldap','critical');
|
||||
INSERT INTO "SERVICE_GROUP_MEMBERS" VALUES(50,'yes','web-services','lighttpd','critical');
|
||||
|
@ -95,6 +94,8 @@ INSERT INTO "SERVICE_GROUP_MEMBERS" SELECT MAX(id) + 1,'yes','controller-service
|
|||
INSERT INTO "SERVICE_GROUP_MEMBERS" SELECT MAX(id) + 1,'no','distributed-cloud-services','dcdbsync-api','critical' FROM "SERVICE_GROUP_MEMBERS";
|
||||
INSERT INTO "SERVICE_GROUP_MEMBERS" SELECT MAX(id) + 1,'no','controller-services','ironic-ip','critical' FROM "SERVICE_GROUP_MEMBERS";
|
||||
INSERT INTO "SERVICE_GROUP_MEMBERS" SELECT MAX(id) + 1,'no','distributed-cloud-services','dcdbsync-openstack-api','critical' FROM "SERVICE_GROUP_MEMBERS";
|
||||
INSERT INTO "SERVICE_GROUP_MEMBERS" SELECT MAX(id) + 1,'no','distributed-cloud-services','dcmanager-orchestrator','critical' FROM "SERVICE_GROUP_MEMBERS";
|
||||
INSERT INTO "SERVICE_GROUP_MEMBERS" SELECT MAX(id) + 1,'no','distributed-cloud-services','dcmanager-audit-worker','critical' FROM "SERVICE_GROUP_MEMBERS";
|
||||
CREATE TABLE SERVICES ( ID INTEGER PRIMARY KEY AUTOINCREMENT, PROVISIONED CHAR(32), NAME CHAR(32), DESIRED_STATE CHAR(32), STATE CHAR(32), STATUS CHAR(32), CONDITION CHAR(32), MAX_FAILURES INT, FAIL_COUNTDOWN INT, FAIL_COUNTDOWN_INTERVAL INT, MAX_ACTION_FAILURES INT, MAX_TRANSITION_FAILURES INT, PID_FILE CHAR(256) );
|
||||
INSERT INTO "SERVICES" VALUES(1,'yes','oam-ip','initial','initial','none','none',2,1,90000,4,16,'');
|
||||
INSERT INTO "SERVICES" VALUES(2,'yes','management-ip','initial','initial','none','none',2,1,90000,4,16,'');
|
||||
|
@ -117,7 +118,6 @@ INSERT INTO "SERVICES" VALUES(23,'yes','dnsmasq','initial','initial','none','non
|
|||
INSERT INTO "SERVICES" VALUES(24,'yes','fm-mgr','initial','initial','none','none',2,1,90000,4,16,'/var/run/fmManager.pid');
|
||||
INSERT INTO "SERVICES" VALUES(25,'yes','keystone','initial','initial','none','none',2,1,90000,4,16,'/var/run/openstack-keystone.pid');
|
||||
INSERT INTO "SERVICES" VALUES(48,'yes','open-ldap','initial','initial','none','none',2,1,90000,4,16,'/var/run/slapd.pid');
|
||||
INSERT INTO "SERVICES" VALUES(49,'yes','snmp','initial','initial','none','none',32,16,90000,4,16,'/var/run/snmpd.pid');
|
||||
INSERT INTO "SERVICES" VALUES(50,'yes','lighttpd','initial','initial','none','none',2,1,90000,4,16,'/var/run/lighttpd.pid');
|
||||
INSERT INTO "SERVICES" VALUES(51,'yes','horizon','initial','initial','none','none',2,1,90000,4,16,'/var/run/openstack-dashboard.pid');
|
||||
INSERT INTO "SERVICES" VALUES(52,'yes','patch-alarm-manager','initial','initial','none','none',2,1,90000,4,16,'/var/run/patch-alarm-manager.pid');
|
||||
|
@ -158,6 +158,8 @@ INSERT INTO "SERVICES" SELECT MAX(id) + 1,'yes','cluster-host-ip','initial','ini
|
|||
INSERT INTO "SERVICES" SELECT MAX(id) + 1,'no','dcdbsync-api','initial','initial','none','none',2,1,90000,4,16,'/var/run/resource-agents/dcdbsync-api.pid' FROM "SERVICES";
|
||||
INSERT INTO "SERVICES" SELECT MAX(id) + 1,'no','ironic-ip','initial','initial','none','none',2,1,90000,4,16,'' FROM "SERVICES";
|
||||
INSERT INTO "SERVICES" SELECT MAX(id) + 1,'no','dcdbsync-openstack-api','initial','initial','none','none',2,1,90000,4,16,'/var/run/resource-agents/dcdbsync-openstack-api.pid' FROM "SERVICES";
|
||||
INSERT INTO "SERVICES" SELECT MAX(id) + 1,'no','dcmanager-orchestrator','initial','initial','none','none',2,1,90000,4,16,'/var/run/resource-agents/dcmanager-orchestrator.pid' FROM "SERVICES";
|
||||
INSERT INTO "SERVICES" SELECT MAX(id) + 1,'no','dcmanager-audit-worker','initial','initial','none','none',2,1,90000,4,16,'/var/run/resource-agents/dcmanager-audit-worker.pid' FROM "SERVICES";
|
||||
CREATE TABLE SERVICE_HEARTBEAT ( ID INTEGER PRIMARY KEY AUTOINCREMENT, PROVISIONED CHAR(32), NAME CHAR(32), TYPE CHAR(32), SRC_ADDRESS CHAR(108), SRC_PORT INT, DST_ADDRESS CHAR(108), DST_PORT INT, MESSAGE CHAR(256), INTERVAL_IN_MS INT, MISSED_WARN INT, MISSED_DEGRADE INT, MISSED_FAIL INT, STATE CHAR(32), MISSED INT, HEARTBEAT_TIMER_ID INT, HEARTBEAT_SOCKET INT );
|
||||
CREATE TABLE SERVICE_DEPENDENCY ( DEPENDENCY_TYPE CHAR(32), SERVICE_NAME CHAR(32), STATE CHAR(32), ACTION CHAR(32), DEPENDENT CHAR(32), DEPENDENT_STATE CHAR(32), PRIMARY KEY (DEPENDENCY_TYPE, SERVICE_NAME, STATE, ACTION, DEPENDENT));
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','oam-ip','not-applicable','enable','management-ip','enabled-active');
|
||||
|
@ -188,9 +190,6 @@ INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','vim-api','not-applicable','ena
|
|||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','vim-webserver','not-applicable','enable','vim','enabled-active');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','dnsmasq','not-applicable','enable','sysinv-conductor','enabled-active');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','fm-mgr','not-applicable','enable','postgres','enabled-active');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','snmp','not-applicable','enable','oam-ip','enabled-active');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','snmp','not-applicable','enable','postgres','enabled-active');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','snmp','not-applicable','enable','platform-nfs-ip','enabled-active');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','etcd','not-applicable','enable','etcd-fs','enabled-active');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','keystone','not-applicable','enable','postgres','enabled-active');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','keystone','not-applicable','enable','rabbit','enabled-active');
|
||||
|
@ -206,16 +205,19 @@ INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','management-ip','not-applicable
|
|||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','management-ip','not-applicable','disable','rabbit-fs','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','management-ip','not-applicable','disable','platform-fs','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','drbd-pg','not-applicable','go-standby','pg-fs','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','drbd-pg','not-applicable','disable','pg-fs','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','drbd-rabbit','not-applicable','go-standby','rabbit-fs','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','drbd-rabbit','not-applicable','disable','rabbit-fs','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','drbd-platform','not-applicable','go-standby','platform-fs','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','drbd-platform','not-applicable','disable','platform-fs','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','drbd-extension','not-applicable','go-standby','extension-fs','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','drbd-extension','not-applicable','disable','extension-fs','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','pg-fs','not-applicable','disable','postgres','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','rabbit-fs','not-applicable','disable','rabbit','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','nfs-mgmt','not-applicable','disable','platform-fs','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','extension-fs','not-applicable','disable','extension-export-fs','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','platform-nfs-ip','not-applicable','disable','keystone','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','platform-fs','not-applicable','disable','platform-export-fs','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','postgres','not-applicable','disable','snmp','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','postgres','not-applicable','disable','fm-mgr','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','postgres','not-applicable','disable','keystone','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','postgres','not-applicable','disable','sysinv-conductor','disabled');
|
||||
|
@ -239,8 +241,8 @@ INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','drbd-platform','not-applicable
|
|||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','etcd-fs','not-applicable','disable','etcd','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','cinder-lvm','not-applicable','disable','iscsi','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','drbd-cinder','not-applicable','go-standby','cinder-lvm','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','drbd-cinder','not-applicable','disable','cinder-lvm','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','ceph-manager','not-applicable','disable','sysinv-conductor','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','snmp','not-applicable','enable','dnsmasq','enabled-active');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','dcorch-engine','not-applicable','enable','rabbit','enabled-active');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','dcorch-engine','not-applicable','enable','postgres','enabled-active');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','dcorch-engine','not-applicable','enable','management-ip','enabled-active');
|
||||
|
@ -259,8 +261,10 @@ INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','postgres','not-applicable','di
|
|||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','management-ip','not-applicable','disable','dcmanager-manager','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','dcmanager-api','not-applicable','enable','dcmanager-manager','enabled-active');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','dcmanager-manager','not-applicable','disable','dcmanager-api','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','dcmanager-audit','not-applicable','enable','dcmanager-manager','enabled-active');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','dcmanager-manager','not-applicable','disable','dcmanager-audit','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','dcmanager-audit','not-applicable','enable','dcmanager-audit-worker','enabled-active');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','dcmanager-audit-worker','not-applicable','disable','dcmanager-audit','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','dcmanager-orchestrator','not-applicable','enable','dcmanager-manager','enabled-active');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','dcmanager-manager','not-applicable','disable','dcmanager-orchestrator','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','dcorch-sysinv-api-proxy','not-applicable','enable','sysinv-inv','enabled-active');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','dcorch-sysinv-api-proxy','not-applicable','enable','dcorch-engine','enabled-active');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','sysinv-inv','not-applicable','disable','dcorch-sysinv-api-proxy','disabled');
|
||||
|
@ -278,6 +282,7 @@ INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','dcorch-engine','not-applicable
|
|||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','drbd-dc-vault','not-applicable','go-active','management-ip','enabled-active');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','dc-vault-fs','not-applicable','enable','drbd-dc-vault','enabled-active');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','drbd-dc-vault','not-applicable','go-standby','dc-vault-fs','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','drbd-dc-vault','not-applicable','disable','dc-vault-fs','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','dcorch-patch-api-proxy','not-applicable','enable','dcmanager-manager','enabled-active');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','dcmanager-manager','not-applicable','disable','dcorch-patch-api-proxy','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','drbd-etcd','not-applicable','go-active','management-ip','enabled-active');
|
||||
|
@ -295,10 +300,11 @@ INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','dcdbsync-api','not-applicable'
|
|||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','keystone','not-applicable','disable','dcdbsync-api','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','dcdbsync-openstack-api','not-applicable','enable','keystone','enabled-active');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','keystone','not-applicable','disable','dcdbsync-openstack-api','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','dcmanager-audit-worker','not-applicable','enable','dcmanager-manager','enabled-active');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','dcmanager-manager','not-applicable','disable','dcmanager-audit-worker','disabled');
|
||||
CREATE TABLE SERVICE_INSTANCES ( ID INTEGER PRIMARY KEY AUTOINCREMENT, SERVICE_NAME CHAR(32), INSTANCE_NAME CHAR(32), INSTANCE_PARAMETERS CHAR(1024) );
|
||||
INSERT INTO "SERVICE_INSTANCES" VALUES(1,'lighttpd','lighttpd','');
|
||||
INSERT INTO "SERVICE_INSTANCES" VALUES(2,'horizon','horizon','');
|
||||
INSERT INTO "SERVICE_INSTANCES" VALUES(3,'snmp','snmp','');
|
||||
INSERT INTO "SERVICE_INSTANCES" VALUES(4,'patch-alarm-manager','patch-alarm-manager','');
|
||||
INSERT INTO "SERVICE_INSTANCES" VALUES(5,'hw-mon','hw-mon','');
|
||||
INSERT INTO "SERVICE_INSTANCES" VALUES(6,'guest-agent','guest-agent','');
|
||||
|
@ -421,10 +427,6 @@ INSERT INTO "SERVICE_ACTIONS" VALUES('open-ldap','enable','lsb-script','','openl
|
|||
INSERT INTO "SERVICE_ACTIONS" VALUES('open-ldap','disable','lsb-script','','openldap','stop','',1,1,1,15,'');
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('open-ldap','audit-enabled','lsb-script','','openldap','status','',2,2,2,15,40);
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('open-ldap','audit-disabled','lsb-script','','openldap','status','',0,0,0,15,40);
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('snmp','enable','lsb-script','','snmpd','start','',2,2,2,15,'');
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('snmp','disable','lsb-script','','snmpd','stop','',1,1,1,15,'');
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('snmp','audit-enabled','lsb-script','','snmpd','status','',2,2,2,15,40);
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('snmp','audit-disabled','lsb-script','','snmpd','status','',0,0,0,15,40);
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('lighttpd','enable','lsb-script','','lighttpd','start','',2,2,2,15,'');
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('lighttpd','disable','lsb-script','','lighttpd','stop','',1,1,1,15,'');
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('lighttpd','audit-enabled','lsb-script','','lighttpd','status','',2,2,2,15,40);
|
||||
|
@ -499,6 +501,10 @@ INSERT INTO "SERVICE_ACTIONS" VALUES('dcmanager-audit','enable','ocf-script','op
|
|||
INSERT INTO "SERVICE_ACTIONS" VALUES('dcmanager-audit','disable','ocf-script','openstack','dcmanager-audit','stop','',1,1,1,20,'');
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('dcmanager-audit','audit-enabled','ocf-script','openstack','dcmanager-audit','monitor','',2,2,2,20,5);
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('dcmanager-audit','audit-disabled','ocf-script','openstack','dcmanager-audit','monitor','',0,0,0,20,5);
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('dcmanager-orchestrator','enable','ocf-script','openstack','dcmanager-orchestrator','start','',2,2,2,20,'');
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('dcmanager-orchestrator','disable','ocf-script','openstack','dcmanager-orchestrator','stop','',1,1,1,20,'');
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('dcmanager-orchestrator','audit-enabled','ocf-script','openstack','dcmanager-orchestrator','monitor','',2,2,2,20,5);
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('dcmanager-orchestrator','audit-disabled','ocf-script','openstack','dcmanager-orchestrator','monitor','',0,0,0,20,5);
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('dcmanager-api','enable','ocf-script','openstack','dcmanager-api','start','',2,2,2,20,'');
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('dcmanager-api','disable','ocf-script','openstack','dcmanager-api','stop','',1,1,1,20,'');
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('dcmanager-api','audit-enabled','ocf-script','openstack','dcmanager-api','monitor','',2,2,2,20,5);
|
||||
|
@ -572,6 +578,10 @@ INSERT INTO "SERVICE_ACTIONS" VALUES('ironic-ip','enable','ocf-script','heartbea
|
|||
INSERT INTO "SERVICE_ACTIONS" VALUES('ironic-ip','disable','ocf-script','heartbeat','IPaddr2','stop','',1,1,1,20,'');
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('ironic-ip','audit-enabled','ocf-script','heartbeat','IPaddr2','monitor','',2,2,2,20,5);
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('ironic-ip','audit-disabled','ocf-script','heartbeat','IPaddr2','monitor','',0,0,0,20,5);
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('dcmanager-audit-worker','enable','ocf-script','openstack','dcmanager-audit-worker','start','',2,2,2,20,'');
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('dcmanager-audit-worker','disable','ocf-script','openstack','dcmanager-audit-worker','stop','',1,1,1,20,'');
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('dcmanager-audit-worker','audit-enabled','ocf-script','openstack','dcmanager-audit-worker','monitor','',2,2,2,20,5);
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('dcmanager-audit-worker','audit-disabled','ocf-script','openstack','dcmanager-audit-worker','monitor','',0,0,0,20,5);
|
||||
CREATE TABLE SERVICE_ACTION_RESULTS ( PLUGIN_TYPE CHAR(32), PLUGIN_NAME CHAR(80), PLUGIN_COMMAND CHAR(80), PLUGIN_EXIT_CODE CHAR(32), ACTION_RESULT CHAR(32), SERVICE_STATE CHAR(32), SERVICE_STATUS CHAR(32), SERVICE_CONDITION CHAR(32), PRIMARY KEY (PLUGIN_TYPE, PLUGIN_NAME, PLUGIN_COMMAND, PLUGIN_EXIT_CODE));
|
||||
INSERT INTO "SERVICE_ACTION_RESULTS" VALUES('lsb-script','default','status','0','success','enabled-active','unknown','unknown');
|
||||
INSERT INTO "SERVICE_ACTION_RESULTS" VALUES('lsb-script','default','status','1','success','disabled','unknown','unknown');
|
||||
|
@ -642,6 +652,7 @@ INSERT INTO "SERVICES" SELECT MAX(id) + 1,'no','dockerdistribution-fs','initial'
|
|||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','dockerdistribution-fs','not-applicable','enable','drbd-dockerdistribution','enabled-active');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','docker-distribution','not-applicable','enable','dockerdistribution-fs','enabled-active');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','drbd-dockerdistribution','not-applicable','go-standby','dockerdistribution-fs','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','drbd-dockerdistribution','not-applicable','disable','dockerdistribution-fs','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','dockerdistribution-fs','not-applicable','disable','docker-distribution','disabled');
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('dockerdistribution-fs','enable','ocf-script','heartbeat','Filesystem','start','',2,2,2,60,'');
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('dockerdistribution-fs','disable','ocf-script','heartbeat','Filesystem','stop','',1,1,1,180,'');
|
||||
|
@ -656,6 +667,38 @@ INSERT INTO "SERVICE_ACTIONS" VALUES('drbd-dockerdistribution','go-standby','ocf
|
|||
INSERT INTO "SERVICE_ACTIONS" VALUES('drbd-dockerdistribution','audit-enabled','ocf-script','linbit','drbd','monitor','master_max=1,master_node_max=1,clone_max=2,clone_node_max=1,notify=true,globally_unique=false',2,2,2,20,30);
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('drbd-dockerdistribution','audit-disabled','ocf-script','linbit','drbd','monitor','master_max=1,master_node_max=1,clone_max=2,clone_node_max=1,notify=true,globally_unique=false',0,0,0,20,28);
|
||||
|
||||
INSERT INTO "SERVICE_GROUP_MEMBERS" SELECT MAX(id) + 1,'no','controller-services','rook-mon-exit','critical' FROM "SERVICE_GROUP_MEMBERS";
|
||||
INSERT INTO "SERVICES" SELECT MAX(id) + 1, 'no','rook-mon-exit','initial','initial','none','none',2,1,90000,4,16,'' FROM "SERVICES";
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','rook-mon-exit','not-applicable','enable','docker-distribution','enabled-active');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','docker-distribution','not-applicable','disable','rook-mon-exit','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','rook-mon-exit','not-applicable','enable','cluster-host-ip','enabled-active');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','cluster-host-ip','not-applicable','disable','rook-mon-exit','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','rook-mon-exit','not-applicable','enable','etcd','enabled-active');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','etcd','not-applicable','disable','rook-mon-exit','disabled');
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('rook-mon-exit','enable','lsb-script','','rook-mon-exit','start','',2,2,2,30,'');
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('rook-mon-exit','disable','lsb-script','','rook-mon-exit','stop','',0,0,0,360,'');
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('rook-mon-exit','audit-enabled','lsb-script','','rook-mon-exit','status','',2,2,2,15,40);
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('rook-mon-exit','audit-disabled','lsb-script','','rook-mon-exit','status','',0,0,0,15,40);
|
||||
INSERT INTO "SERVICE_GROUP_MEMBERS" SELECT MAX(id) + 1,'no','controller-services','rookmon-fs','critical' FROM "SERVICE_GROUP_MEMBERS";
|
||||
INSERT INTO "SERVICES" SELECT MAX(id) + 1,'no','rookmon-fs','initial','initial','none','none',2,1,90000,4,16,'' FROM "SERVICES";
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','rookmon-fs','not-applicable','enable','drbd-rookmon','enabled-active');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','rook-mon-exit','not-applicable','enable','rookmon-fs','enabled-active');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','drbd-rookmon','not-applicable','go-standby','rookmon-fs','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','drbd-rookmon','not-applicable','disable','rookmon-fs','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','rookmon-fs','not-applicable','disable','rook-mon-exit','disabled');
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('rookmon-fs','enable','ocf-script','heartbeat','Filesystem','start','',2,2,2,60,'');
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('rookmon-fs','disable','ocf-script','heartbeat','Filesystem','stop','',1,1,1,180,'');
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('rookmon-fs','audit-enabled','ocf-script','heartbeat','Filesystem','monitor','',2,2,2,60,40);
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('rookmon-fs','audit-disabled','ocf-script','heartbeat','Filesystem','monitor','',0,0,0,60,40);
|
||||
INSERT INTO "SERVICE_GROUP_MEMBERS" SELECT MAX(id) + 1,'no','controller-services','drbd-rookmon','critical' FROM "SERVICE_GROUP_MEMBERS";
|
||||
INSERT INTO "SERVICES" SELECT MAX(id) + 1,'no','drbd-rookmon','initial','initial','none','none',2,1,90000,4,16,'' FROM "SERVICES";
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('drbd-rookmon','enable','ocf-script','linbit','drbd','start','master_max=1,master_node_max=1,clone_max=2,clone_node_max=1,notify=true,globally_unique=false',2,2,2,90,'');
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('drbd-rookmon','disable','ocf-script','linbit','drbd','stop','master_max=1,master_node_max=1,clone_max=2,clone_node_max=1,notify=true,globally_unique=false',1,1,1,180,'');
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('drbd-rookmon','go-active','ocf-script','linbit','drbd','promote','master_max=1,master_node_max=1,clone_max=2,clone_node_max=1,notify=true,globally_unique=false',2,2,2,180,'');
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('drbd-rookmon','go-standby','ocf-script','linbit','drbd','demote','master_max=1,master_node_max=1,clone_max=2,clone_node_max=1,notify=true,globally_unique=false',2,2,2,180,'');
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('drbd-rookmon','audit-enabled','ocf-script','linbit','drbd','monitor','master_max=1,master_node_max=1,clone_max=2,clone_node_max=1,notify=true,globally_unique=false',2,2,2,20,30);
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('drbd-rookmon','audit-disabled','ocf-script','linbit','drbd','monitor','master_max=1,master_node_max=1,clone_max=2,clone_node_max=1,notify=true,globally_unique=false',0,0,0,20,28);
|
||||
|
||||
INSERT INTO "SERVICE_GROUP_MEMBERS" SELECT MAX(id) + 1,'no','controller-services','ceph-mon','critical' FROM "SERVICE_GROUP_MEMBERS";
|
||||
INSERT INTO "SERVICES" SELECT MAX(id) + 1, 'no','ceph-mon','initial','initial','none','none',2,1,90000,4,16,'/var/run/ceph/mon.controller.pid' FROM "SERVICES";
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','ceph-mon','not-applicable','enable','management-ip','enabled-active');
|
||||
|
@ -669,6 +712,7 @@ INSERT INTO "SERVICES" SELECT MAX(id) + 1,'no','cephmon-fs','initial','initial',
|
|||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','cephmon-fs','not-applicable','enable','drbd-cephmon','enabled-active');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','ceph-mon','not-applicable','enable','cephmon-fs','enabled-active');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','drbd-cephmon','not-applicable','go-standby','cephmon-fs','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','drbd-cephmon','not-applicable','disable','cephmon-fs','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','cephmon-fs','not-applicable','disable','ceph-mon','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','ceph-radosgw','not-applicable','enable','ceph-mon','enabled-active');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','ceph-mon','not-applicable','disable','ceph-radosgw','disabled');
|
||||
|
@ -735,4 +779,25 @@ INSERT INTO "SERVICE_ACTIONS" VALUES('dc-iso-fs','disable','ocf-script','heartbe
|
|||
INSERT INTO "SERVICE_ACTIONS" VALUES('dc-iso-fs','audit-enabled','ocf-script','heartbeat','Filesystem','monitor','',2,2,2,30,40);
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('dc-iso-fs','audit-disabled','ocf-script','heartbeat','Filesystem','monitor','',0,0,0,30,40);
|
||||
|
||||
INSERT INTO "SERVICE_GROUP_MEMBERS" SELECT MAX(id) + 1,'no','controller-services','cert-mon','critical' FROM "SERVICE_GROUP_MEMBERS";
|
||||
INSERT INTO "SERVICES" SELECT MAX(id) + 1,'no','cert-mon','initial','initial','none','none',2,1,90000,4,16,'/var/run/cert-mon.pid' FROM "SERVICES";
|
||||
INSERT INTO "SERVICE_INSTANCES" SELECT MAX(id) + 1,'cert-mon','cert-mon','' FROM "SERVICE_INSTANCES";
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','cert-mon','not-applicable','enable','sysinv-inv','enabled-active');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','sysinv-inv','not-applicable','disable','cert-mon','disabled');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','cert-mon','not-applicable','enable','dcmanager-manager','enabled-active');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','dcmanager-manager','not-applicable','disable','cert-mon','disabled');
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('cert-mon','enable','ocf-script','platform','cert-mon','start','',2,2,2,30,'');
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('cert-mon','disable','ocf-script','platform','cert-mon','stop','',1,1,1,60,'');
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('cert-mon','audit-enabled','ocf-script','platform','cert-mon','monitor','',2,2,2,30,40);
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('cert-mon','audit-disabled','ocf-script','platform','cert-mon','monitor','',0,0,0,30,40);
|
||||
|
||||
INSERT INTO "SERVICE_GROUP_MEMBERS" SELECT MAX(id) + 1,'no','controller-services','device-image-fs','critical' FROM "SERVICE_GROUP_MEMBERS";
|
||||
INSERT INTO "SERVICES" SELECT MAX(id) + 1,'no','device-image-fs','initial','initial','none','none',2,1,90000,4,16,'' FROM "SERVICES";
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','device-image-fs','not-applicable','enable','platform-fs','enabled-active');
|
||||
INSERT INTO "SERVICE_DEPENDENCY" VALUES('action','platform-fs','not-applicable','disable','device-image-fs','disabled');
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('device-image-fs','enable','ocf-script','heartbeat','Filesystem','start','',2,2,2,60,'');
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('device-image-fs','disable','ocf-script','heartbeat','Filesystem','stop','',1,1,1,180,'');
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('device-image-fs','audit-enabled','ocf-script','heartbeat','Filesystem','monitor','',2,2,2,60,40);
|
||||
INSERT INTO "SERVICE_ACTIONS" VALUES('device-image-fs','audit-disabled','ocf-script','heartbeat','Filesystem','monitor','',0,0,0,60,40);
|
||||
|
||||
COMMIT;
|
||||
|
|
|
@ -164,13 +164,18 @@ SmErrorT sm_db_statement_finalize( SmDbStatementT* sm_db_statement )
|
|||
// ****************************************************************************
|
||||
// Database - Connect
|
||||
// ==================
|
||||
SmErrorT sm_db_connect( const char* sm_db_name, SmDbHandleT** sm_db_handle )
|
||||
SmErrorT sm_db_connect( const char* sm_db_name, SmDbHandleT** sm_db_handle, bool readonly )
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = sqlite3_open_v2( sm_db_name, (sqlite3**) sm_db_handle,
|
||||
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE |
|
||||
SQLITE_OPEN_NOMUTEX, NULL );
|
||||
int flag;
|
||||
if (readonly)
|
||||
{
|
||||
flag = SQLITE_OPEN_READONLY | SQLITE_OPEN_NOMUTEX;
|
||||
} else
|
||||
{
|
||||
flag = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_NOMUTEX;
|
||||
}
|
||||
rc = sqlite3_open_v2( sm_db_name, (sqlite3**) sm_db_handle, flag, NULL );
|
||||
if( SQLITE_OK != rc )
|
||||
{
|
||||
DPRINTFE( "Failed to connect to database (%s), rc=%i.", sm_db_name, rc );
|
||||
|
@ -1128,4 +1133,4 @@ SmErrorT sm_db_finalize( void )
|
|||
|
||||
return( SM_OKAY );
|
||||
}
|
||||
// ****************************************************************************
|
||||
// ****************************************************************************
|
||||
|
|
|
@ -59,7 +59,7 @@ extern SmErrorT sm_db_statement_finalize( SmDbStatementT* sm_db_statement );
|
|||
// Database - Connect
|
||||
// ==================
|
||||
extern SmErrorT sm_db_connect( const char* sm_db_name,
|
||||
SmDbHandleT** sm_db_handle );
|
||||
SmDbHandleT** sm_db_handle, bool readonly = false );
|
||||
// ****************************************************************************
|
||||
|
||||
// ****************************************************************************
|
||||
|
|
|
@ -123,7 +123,7 @@ SmErrorT sm_db_iterator_initialize( const char* db_name,
|
|||
|
||||
memset( it, 0, sizeof(SmDbIteratorT) );
|
||||
|
||||
error = sm_db_connect( db_name, &(it->sm_db_handle) );
|
||||
error = sm_db_connect( db_name, &(it->sm_db_handle), true );
|
||||
if( SM_OKAY != error )
|
||||
{
|
||||
DPRINTFE( "Failed to connect to database (%s), error=%s.", db_name,
|
||||
|
|
|
@ -2,4 +2,4 @@ SRC_DIR=$PKG_BASE
|
|||
COPY_LIST="$PKG_BASE/LICENSE"
|
||||
TAR_NAME=sm
|
||||
VERSION=1.0.0
|
||||
TIS_PATCH_VER=33
|
||||
TIS_PATCH_VER=PKG_GITREVCOUNT+24
|
||||
|
|
|
@ -11,6 +11,8 @@ ExecStart=/etc/init.d/sm start
|
|||
ExecStop=/etc/init.d/sm stop
|
||||
PIDFile=/var/run/sm.pid
|
||||
KillMode=process
|
||||
RestartSec=10
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "sm_limits.h"
|
||||
#include "sm_selobj.h"
|
||||
#include "sm_worker_thread.h"
|
||||
#include "sm_node_utils.h"
|
||||
|
||||
// uncomment when debugging this module to enabled DPRINTFD output to log file
|
||||
// #define __DEBUG__MSG__
|
||||
|
@ -44,6 +45,7 @@ static const unsigned int size_of_msg_header =
|
|||
bool operator==(const SmClusterHbsInfoT& lhs, const SmClusterHbsInfoT& rhs)
|
||||
{
|
||||
return lhs.storage0_responding == rhs.storage0_responding &&
|
||||
lhs.sm_heartbeat_fail == rhs.sm_heartbeat_fail &&
|
||||
lhs.number_of_node_reachable == rhs.number_of_node_reachable;
|
||||
}
|
||||
|
||||
|
@ -86,25 +88,29 @@ void log_cluster_hbs_state(const SmClusterHbsStateT& state)
|
|||
|
||||
if(state.storage0_enabled)
|
||||
{
|
||||
DPRINTFI("Cluster hbs last updated %d secs ago, storage-0 is provisioned, "
|
||||
"from controller-0: %d nodes enabled, %d nodes reachable, storage-0 %s responding "
|
||||
"from controller-1: %d nodes enabled, %d nodes reachable, storage-0 %s responding",
|
||||
DPRINTFI("Cluster hbs last updated %d secs ago, storage-0 is provisioned,\n"
|
||||
"from controller-0: SM %s, %d nodes enabled, %d nodes reachable, storage-0 %s responding\n"
|
||||
"from controller-1: SM %s, %d nodes enabled, %d nodes reachable, storage-0 %s responding",
|
||||
secs_since_update,
|
||||
state.controllers[0].sm_heartbeat_fail ? "FAILED": "ok ",
|
||||
state.controllers[0].number_of_node_enabled,
|
||||
state.controllers[0].number_of_node_reachable,
|
||||
state.controllers[0].storage0_responding ? "is" : "is not",
|
||||
state.controllers[1].sm_heartbeat_fail ? "FAILED": "ok ",
|
||||
state.controllers[1].number_of_node_enabled,
|
||||
state.controllers[1].number_of_node_reachable,
|
||||
state.controllers[1].storage0_responding ? "is" : "is not"
|
||||
);
|
||||
}else
|
||||
{
|
||||
DPRINTFI("Cluster hbs last updated %d secs ago, storage-0 is not provisioned, "
|
||||
"from controller-0: %d nodes enabled, %d nodes reachable, "
|
||||
"from controller-1: %d nodes enabled, %d nodes reachable",
|
||||
DPRINTFI("Cluster hbs last updated %d secs ago, storage-0 is not provisioned,\n"
|
||||
"from controller-0: SM %s, %d nodes enabled, %d nodes reachable,\n"
|
||||
"from controller-1: SM %s, %d nodes enabled, %d nodes reachable",
|
||||
secs_since_update,
|
||||
state.controllers[0].sm_heartbeat_fail ? "FAILED": "ok ",
|
||||
state.controllers[0].number_of_node_enabled,
|
||||
state.controllers[0].number_of_node_reachable,
|
||||
state.controllers[1].sm_heartbeat_fail ? "FAILED": "ok ",
|
||||
state.controllers[1].number_of_node_enabled,
|
||||
state.controllers[1].number_of_node_reachable
|
||||
);
|
||||
|
@ -117,6 +123,10 @@ int SmClusterHbsInfoMsg::_sock = -1;
|
|||
SmClusterHbsStateT SmClusterHbsInfoMsg::_cluster_hbs_state_current;
|
||||
SmClusterHbsStateT SmClusterHbsInfoMsg::_cluster_hbs_state_previous;
|
||||
SmClusterHbsInfoMsg::hbs_query_respond_callback SmClusterHbsInfoMsg::_callbacks;
|
||||
int SmClusterHbsInfoMsg::this_controller_index = -1;
|
||||
int SmClusterHbsInfoMsg::peer_controller_index = -1;
|
||||
char SmClusterHbsInfoMsg::server_port[SM_CONFIGURATION_VALUE_MAX_CHAR + 1] = {0};
|
||||
char SmClusterHbsInfoMsg::client_port[SM_CONFIGURATION_VALUE_MAX_CHAR + 1] = {0};
|
||||
|
||||
const SmClusterHbsStateT& SmClusterHbsInfoMsg::get_current_state()
|
||||
{
|
||||
|
@ -128,6 +138,47 @@ const SmClusterHbsStateT& SmClusterHbsInfoMsg::get_previous_state()
|
|||
return _cluster_hbs_state_previous;
|
||||
}
|
||||
|
||||
int SmClusterHbsInfoMsg::get_peer_controller_index()
|
||||
{
|
||||
if(peer_controller_index == -1)
|
||||
{
|
||||
get_controller_index();
|
||||
}
|
||||
return peer_controller_index;
|
||||
}
|
||||
|
||||
int SmClusterHbsInfoMsg::get_this_controller_index()
|
||||
{
|
||||
if(this_controller_index == -1)
|
||||
{
|
||||
get_controller_index();
|
||||
}
|
||||
return this_controller_index;
|
||||
}
|
||||
|
||||
SmErrorT SmClusterHbsInfoMsg::get_controller_index()
|
||||
{
|
||||
char host_name[SM_NODE_NAME_MAX_CHAR];
|
||||
SmErrorT error = sm_node_utils_get_hostname(host_name);
|
||||
if( SM_OKAY != error )
|
||||
{
|
||||
DPRINTFE( "Failed to get hostname, error=%s.",
|
||||
sm_error_str( error ) );
|
||||
return SM_FAILED;
|
||||
}
|
||||
|
||||
if(0 == strncmp(SM_NODE_CONTROLLER_0_NAME, host_name, sizeof(SM_NODE_CONTROLLER_0_NAME)))
|
||||
{
|
||||
this_controller_index = 0;
|
||||
peer_controller_index = 1;
|
||||
}else
|
||||
{
|
||||
this_controller_index = 1;
|
||||
peer_controller_index = 0;
|
||||
}
|
||||
return SM_OKAY;
|
||||
}
|
||||
|
||||
bool SmClusterHbsInfoMsg::_process_cluster_hbs_history(mtce_hbs_cluster_history_type history, SmClusterHbsStateT& state)
|
||||
{
|
||||
if(history.controller >= max_controllers)
|
||||
|
@ -156,6 +207,13 @@ bool SmClusterHbsInfoMsg::_process_cluster_hbs_history(mtce_hbs_cluster_history_
|
|||
|
||||
SmClusterHbsInfoT& controller_state = state.controllers[history.controller];
|
||||
controller_state.storage0_responding = history.storage0_responding;
|
||||
controller_state.sm_heartbeat_fail = (history.sm_heartbeat_fail == 1);
|
||||
if(controller_state.sm_heartbeat_fail)
|
||||
{
|
||||
const char* controllers[] = {"controller-0", "controller-1"};
|
||||
DPRINTFI("%s SM to hbsAgent alive pulse failed.", controllers[history.controller]);
|
||||
}
|
||||
|
||||
if(entry.hosts_responding > controller_state.number_of_node_reachable)
|
||||
{
|
||||
controller_state.number_of_node_reachable = entry.hosts_responding;
|
||||
|
@ -241,7 +299,7 @@ void SmClusterHbsInfoMsg::_cluster_hbs_info_msg_received( int selobj, int64_t us
|
|||
}
|
||||
}
|
||||
|
||||
SmErrorT SmClusterHbsInfoMsg::_get_address(const char* port_key, struct sockaddr_in* addr)
|
||||
SmErrorT SmClusterHbsInfoMsg::_get_address(struct sockaddr_in* addr)
|
||||
{
|
||||
struct addrinfo *address = NULL;
|
||||
struct addrinfo hints;
|
||||
|
@ -254,17 +312,10 @@ SmErrorT SmClusterHbsInfoMsg::_get_address(const char* port_key, struct sockaddr
|
|||
hints.ai_addr = NULL;
|
||||
hints.ai_next = NULL;
|
||||
|
||||
char port[SM_CONFIGURATION_VALUE_MAX_CHAR + 1];
|
||||
if( SM_OKAY != sm_configuration_table_get(port_key, port, sizeof(port) - 1) )
|
||||
{
|
||||
DPRINTFE("Runtime error: system configuration %s undefined", port_key);
|
||||
return SM_FAILED;
|
||||
}
|
||||
|
||||
int result = getaddrinfo(LOOPBACK_IP, port, &hints, &address);
|
||||
int result = getaddrinfo(LOOPBACK_IP, server_port, &hints, &address);
|
||||
if(result != 0)
|
||||
{
|
||||
DPRINTFE("Failed to get addrinfo %s:%s", LOOPBACK_IP, port);
|
||||
DPRINTFE("Failed to get addrinfo %s:%s", LOOPBACK_IP, server_port);
|
||||
return SM_FAILED;
|
||||
}
|
||||
|
||||
|
@ -285,15 +336,8 @@ static SmSimpleAction _query_hbs_cluster_info_action("send hbs-cluster query", s
|
|||
// trigger a query of cluster hbs info.
|
||||
// return true if request sent successfully, false otherwise.
|
||||
// ========================
|
||||
bool SmClusterHbsInfoMsg::cluster_hbs_info_query(cluster_hbs_query_ready_callback callback)
|
||||
bool SmClusterHbsInfoMsg::cluster_hbs_info_query(cluster_hbs_query_ready_callback callback, bool alive_pulse)
|
||||
{
|
||||
char server_port[SM_CONFIGURATION_VALUE_MAX_CHAR + 1];
|
||||
if( SM_OKAY != sm_configuration_table_get(SM_SERVER_PORT_KEY, server_port, sizeof(server_port) - 1) )
|
||||
{
|
||||
DPRINTFE("Runtime error: system configuration %s undefined", SM_SERVER_PORT_KEY);
|
||||
return false;
|
||||
}
|
||||
|
||||
int port = atoi(server_port);
|
||||
if(0 > port)
|
||||
{
|
||||
|
@ -306,18 +350,24 @@ bool SmClusterHbsInfoMsg::cluster_hbs_info_query(cluster_hbs_query_ready_callbac
|
|||
struct timespec ts;
|
||||
{
|
||||
mutex_holder holder(&_mutex);
|
||||
if(0 != clock_gettime(CLOCK_REALTIME, &ts))
|
||||
if(alive_pulse)
|
||||
{
|
||||
DPRINTFE("Failed to get realtime");
|
||||
reqid = (unsigned short)1;
|
||||
reqid = 0;
|
||||
}else
|
||||
{
|
||||
unsigned short* v = (unsigned short*)(&ts.tv_nsec);
|
||||
reqid = (*v) % 0xFFFE + 1;
|
||||
if(0 != clock_gettime(CLOCK_REALTIME, &ts))
|
||||
{
|
||||
DPRINTFE("Failed to get realtime");
|
||||
reqid = (unsigned short)1;
|
||||
}else
|
||||
{
|
||||
unsigned short* v = (unsigned short*)(&ts.tv_nsec);
|
||||
reqid = (*v) % 0xFFFE + 1;
|
||||
}
|
||||
}
|
||||
|
||||
struct sockaddr_in addr;
|
||||
if(SM_OKAY != _get_address(SM_SERVER_PORT_KEY, &addr))
|
||||
if(SM_OKAY != _get_address(&addr))
|
||||
{
|
||||
DPRINTFE("Failed to get address");
|
||||
return false;
|
||||
|
@ -325,7 +375,10 @@ bool SmClusterHbsInfoMsg::cluster_hbs_info_query(cluster_hbs_query_ready_callbac
|
|||
|
||||
int msg_size = snprintf(query, sizeof(query), json_fmt, reqid);
|
||||
|
||||
DPRINTFD("send %d bytes %s", msg_size, query);
|
||||
if (reqid != 0)
|
||||
{
|
||||
DPRINTFI("send hbs cluster query [%d]", reqid);
|
||||
}
|
||||
if(0 > sendto(_sock, query, msg_size, 0, (sockaddr*)&addr, sizeof(addr)))
|
||||
{
|
||||
DPRINTFE("Failed to send msg. Error %s", strerror(errno));
|
||||
|
@ -339,6 +392,11 @@ bool SmClusterHbsInfoMsg::cluster_hbs_info_query(cluster_hbs_query_ready_callbac
|
|||
return true;
|
||||
}
|
||||
|
||||
bool SmClusterHbsInfoMsg::send_alive_pulse()
|
||||
{
|
||||
return cluster_hbs_info_query(NULL, true);
|
||||
}
|
||||
|
||||
SmErrorT SmClusterHbsInfoMsg::open_socket()
|
||||
{
|
||||
struct addrinfo *address = NULL;
|
||||
|
@ -353,28 +411,13 @@ SmErrorT SmClusterHbsInfoMsg::open_socket()
|
|||
hints.ai_next = NULL;
|
||||
struct sockaddr_in addr;
|
||||
|
||||
char client_port[SM_CONFIGURATION_VALUE_MAX_CHAR + 1];
|
||||
char server_port[SM_CONFIGURATION_VALUE_MAX_CHAR + 1];
|
||||
if( SM_OKAY != sm_configuration_table_get(SM_CLIENT_PORT_KEY, client_port, sizeof(client_port) - 1) )
|
||||
int port = atoi(server_port);
|
||||
if(0 > port)
|
||||
{
|
||||
DPRINTFE("Runtime error: system configuration %s undefined", SM_CLIENT_PORT_KEY);
|
||||
DPRINTFE("Invalid configuration %s: %s", SM_SERVER_PORT_KEY, server_port);
|
||||
return SM_FAILED;
|
||||
}
|
||||
|
||||
if( SM_OKAY != sm_configuration_table_get(SM_SERVER_PORT_KEY, server_port, sizeof(server_port) - 1) )
|
||||
{
|
||||
DPRINTFE("Runtime error: system configuration %s undefined", SM_SERVER_PORT_KEY);
|
||||
return SM_FAILED;
|
||||
}else
|
||||
{
|
||||
int port = atoi(server_port);
|
||||
if(0 > port)
|
||||
{
|
||||
DPRINTFE("Invalid configuration %s: %s", SM_SERVER_PORT_KEY, server_port);
|
||||
return SM_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
int result = getaddrinfo(LOOPBACK_IP, client_port, &hints, &address);
|
||||
if(result != 0)
|
||||
{
|
||||
|
@ -441,6 +484,39 @@ SmErrorT SmClusterHbsInfoMsg::initialize()
|
|||
return SM_FAILED;
|
||||
}
|
||||
|
||||
error = get_controller_index();
|
||||
if(SM_OKAY != error)
|
||||
{
|
||||
DPRINTFE("Failed to get controller index");
|
||||
return SM_FAILED;
|
||||
}
|
||||
|
||||
if( SM_OKAY != sm_configuration_table_get(SM_SERVER_PORT_KEY, server_port, sizeof(server_port) - 1) )
|
||||
{
|
||||
DPRINTFE("Runtime error: system configuration %s undefined", SM_SERVER_PORT_KEY);
|
||||
return SM_FAILED;
|
||||
}
|
||||
|
||||
int port = atoi(server_port);
|
||||
if(0 > port)
|
||||
{
|
||||
DPRINTFE("Runtime error: Invalid configuration %s: %s", SM_SERVER_PORT_KEY, server_port);
|
||||
return SM_FAILED;
|
||||
}
|
||||
|
||||
if( SM_OKAY != sm_configuration_table_get(SM_CLIENT_PORT_KEY, client_port, sizeof(client_port) - 1) )
|
||||
{
|
||||
DPRINTFE("Runtime error: system configuration %s undefined", SM_CLIENT_PORT_KEY);
|
||||
return SM_FAILED;
|
||||
}
|
||||
|
||||
port = atoi(client_port);
|
||||
if(0 > port)
|
||||
{
|
||||
DPRINTFE("Runtime error: Invalid configuration %s: %s", SM_CLIENT_PORT_KEY, client_port);
|
||||
return SM_FAILED;
|
||||
}
|
||||
|
||||
error = open_socket();
|
||||
if(SM_OKAY != error)
|
||||
{
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "sm_types.h"
|
||||
#include "sm_timer.h"
|
||||
#include "sm_util_types.h"
|
||||
#include "sm_limits.h"
|
||||
|
||||
// ****************************************************************************
|
||||
// struct SmClusterHbsInfoT
|
||||
|
@ -22,9 +23,11 @@ struct _SmClusterHbsInfoT
|
|||
bool storage0_responding;
|
||||
int number_of_node_reachable;
|
||||
int number_of_node_enabled;
|
||||
bool sm_heartbeat_fail;
|
||||
_SmClusterHbsInfoT() : storage0_responding(false),
|
||||
number_of_node_reachable(0),
|
||||
number_of_node_enabled(0)
|
||||
number_of_node_enabled(0),
|
||||
sm_heartbeat_fail(false)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
@ -74,8 +77,11 @@ class SmClusterHbsInfoMsg
|
|||
static SmErrorT finalize();
|
||||
static const SmClusterHbsStateT& get_current_state();
|
||||
static const SmClusterHbsStateT& get_previous_state();
|
||||
static bool cluster_hbs_info_query(cluster_hbs_query_ready_callback callback = NULL);
|
||||
static bool cluster_hbs_info_query(cluster_hbs_query_ready_callback callback = NULL, bool alive_pulse = false);
|
||||
static bool send_alive_pulse();
|
||||
static void dump_hbs_record(FILE* fp);
|
||||
static int get_peer_controller_index();
|
||||
static int get_this_controller_index();
|
||||
|
||||
private:
|
||||
static int _sock;
|
||||
|
@ -85,11 +91,17 @@ class SmClusterHbsInfoMsg
|
|||
static SmClusterHbsStateT _cluster_hbs_state_previous;
|
||||
static hbs_query_respond_callback _callbacks;
|
||||
static SmErrorT open_socket();
|
||||
static SmErrorT get_controller_index();
|
||||
|
||||
static SmErrorT _get_address(const char* port_key, struct sockaddr_in* addr);
|
||||
static SmErrorT _get_address(struct sockaddr_in* addr);
|
||||
static void _cluster_hbs_info_msg_received( int selobj, int64_t user_data );
|
||||
static bool _process_cluster_hbs_history(mtce_hbs_cluster_history_type history,
|
||||
SmClusterHbsStateT& state);
|
||||
|
||||
static char server_port[SM_CONFIGURATION_VALUE_MAX_CHAR + 1];
|
||||
static char client_port[SM_CONFIGURATION_VALUE_MAX_CHAR + 1];
|
||||
static int peer_controller_index;
|
||||
static int this_controller_index;
|
||||
};
|
||||
|
||||
#endif // __SM_CLUSTER_HBS_INFO_MSG_H__
|
|
@ -11,6 +11,9 @@
|
|||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
#include <json-c/json.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "sm_service_domain_interface_table.h"
|
||||
#include "sm_debug.h"
|
||||
|
@ -44,6 +47,8 @@
|
|||
#define SM_FAILOVER_RECOVERY_INTERVAL_IN_SEC 100
|
||||
#define SM_FAILOVER_INTERFACE_STATE_REPORT_INTERVAL_MS 20000
|
||||
|
||||
const char* RESET_PEER_NOW = "/var/run/.sm_reset_peer";
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SM_FAILOVER_ACTION_RESULT_OK,
|
||||
|
@ -816,12 +821,25 @@ static SmErrorT sm_ensure_leader_scheduler()
|
|||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
bool file_exist(const char* filename)
|
||||
{
|
||||
if( 0 != access(filename, F_OK ) )
|
||||
{
|
||||
if( ENOENT == errno )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// ****************************************************************************
|
||||
// Failover - set system to scheduled status
|
||||
// ==================
|
||||
SmErrorT sm_failover_set_system(const SmSystemFailoverStatus& failover_status)
|
||||
{
|
||||
//valid combinations of target system scheduling are:
|
||||
// valid combinations of target system scheduling are:
|
||||
// active/standby
|
||||
// active/failed
|
||||
SmFailoverActionResultT result;
|
||||
|
@ -829,6 +847,47 @@ SmErrorT sm_failover_set_system(const SmSystemFailoverStatus& failover_status)
|
|||
host_target_state = failover_status.get_host_schedule_state();
|
||||
peer_target_state = failover_status.get_peer_schedule_state();
|
||||
SmHeartbeatStateT heartbeat_state = failover_status.get_heartbeat_state();
|
||||
|
||||
if(SM_NODE_STATE_ACTIVE == host_target_state &&
|
||||
SM_NODE_STATE_FAILED == peer_target_state &&
|
||||
failover_status.peer_stall())
|
||||
{
|
||||
int seconds_to_wait = sm_failover_get_reset_peer_wait_time();
|
||||
|
||||
int fd = open(RESET_PEER_NOW, O_RDWR | O_CREAT, S_IRUSR | S_IRGRP | S_IROTH);
|
||||
if( 0 > fd )
|
||||
{
|
||||
DPRINTFE("Failed to create file (%s), error=%s.", RESET_PEER_NOW, strerror(errno) );
|
||||
}else
|
||||
{
|
||||
close(fd);
|
||||
}
|
||||
|
||||
for(int i = 0; i < seconds_to_wait * 10; i ++)
|
||||
{
|
||||
//wait up to 30 seconds for mtce to reset peer.
|
||||
if(!file_exist(RESET_PEER_NOW))
|
||||
{
|
||||
DPRINTFI("%s is gone.", RESET_PEER_NOW);
|
||||
break;
|
||||
}else
|
||||
{
|
||||
usleep(100000); // 100ms
|
||||
if(i % 10 == 0)
|
||||
{
|
||||
// log every second
|
||||
DPRINTFI("Wait for %s to be removed", RESET_PEER_NOW);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(file_exist(RESET_PEER_NOW))
|
||||
{
|
||||
DPRINTFE("%s still exists after %d seconds. Start activating the controller.",
|
||||
RESET_PEER_NOW, seconds_to_wait);
|
||||
}
|
||||
}
|
||||
|
||||
if(SM_HEARTBEAT_OK != heartbeat_state)
|
||||
{
|
||||
if(SM_OKAY != sm_ensure_leader_scheduler())
|
||||
|
@ -1102,6 +1161,9 @@ SmErrorT sm_failover_disable_peer()
|
|||
{
|
||||
DPRINTFE("Failed to disable peer %s", _peer_name);
|
||||
return SM_FAILED;
|
||||
}else
|
||||
{
|
||||
DPRINTFI("Request mtce to reset peer");
|
||||
}
|
||||
return SM_OKAY;
|
||||
}
|
||||
|
@ -1138,6 +1200,8 @@ SmFailoverInterfaceStateT sm_failover_get_interface_info(SmInterfaceTypeT interf
|
|||
static void sm_failover_interface_change_callback(
|
||||
SmHwInterfaceChangeDataT* if_change )
|
||||
{
|
||||
SmFailoverInterfaceInfo* iter;
|
||||
SmServiceDomainInterfaceT* interface;
|
||||
switch ( if_change->interface_state )
|
||||
{
|
||||
case SM_INTERFACE_STATE_DISABLED:
|
||||
|
@ -1147,8 +1211,20 @@ static void sm_failover_interface_change_callback(
|
|||
sm_failover_interface_up(if_change->interface_name);
|
||||
break;
|
||||
default:
|
||||
DPRINTFI("Interface %s state changed to %d",
|
||||
if_change->interface_name, if_change->interface_state);
|
||||
// skip logging the state change of interfaces that are not monitored
|
||||
// by SM.
|
||||
for(iter = _my_if_list; iter < _my_if_list + _total_interfaces; iter ++)
|
||||
{
|
||||
interface = iter->get_interface();
|
||||
if(strncmp(interface->interface_name, if_change->interface_name,
|
||||
sizeof(if_change->interface_name)) == 0)
|
||||
{
|
||||
DPRINTFI("Interface %s state changed to %d",
|
||||
if_change->interface_name, if_change->interface_state);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1183,7 +1259,7 @@ SmErrorT sm_failover_initialize( void )
|
|||
_system_mode = sm_node_utils_get_system_mode();
|
||||
DPRINTFI("System mode %s", sm_system_mode_str(_system_mode));
|
||||
|
||||
error = sm_db_connect( SM_DATABASE_NAME, &_sm_db_handle );
|
||||
error = sm_db_connect( SM_DATABASE_NAME, &_sm_db_handle, true );
|
||||
if( SM_OKAY != error )
|
||||
{
|
||||
DPRINTFE( "Failed to connect to database (%s), error=%s.",
|
||||
|
@ -1292,12 +1368,6 @@ SmErrorT sm_failover_initialize( void )
|
|||
return SM_FAILED;
|
||||
}
|
||||
|
||||
error = SmClusterHbsInfoMsg::initialize();
|
||||
if(SM_OKAY != error)
|
||||
{
|
||||
DPRINTFE("Failed to initialize cluster hbs info messaging");
|
||||
}
|
||||
|
||||
return SM_OKAY;
|
||||
}
|
||||
// ****************************************************************************
|
||||
|
@ -1311,12 +1381,6 @@ SmErrorT sm_failover_finalize( void )
|
|||
|
||||
SmErrorT error;
|
||||
|
||||
error = SmClusterHbsInfoMsg::finalize();
|
||||
if(SM_OKAY != error)
|
||||
{
|
||||
DPRINTFE("Failed to finalize cluster hbs info messaging");
|
||||
}
|
||||
|
||||
sm_timer_deregister( failover_audit_timer_id );
|
||||
if( NULL != _sm_db_handle )
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright (c) 2017 Wind River Systems, Inc.
|
||||
// Copyright (c) 2017-2020 Wind River Systems, Inc.
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "sm_failover_fail_pending_state.h"
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include "sm_configuration_table.h"
|
||||
#include "sm_cluster_hbs_info_msg.h"
|
||||
#include "sm_types.h"
|
||||
#include "sm_limits.h"
|
||||
|
@ -18,8 +19,26 @@
|
|||
#include "sm_node_api.h"
|
||||
#include "sm_worker_thread.h"
|
||||
|
||||
static const int FAIL_PENDING_TIMEOUT = 2000; // 2seconds
|
||||
static const int DELAY_QUERY_HBS_MS = FAIL_PENDING_TIMEOUT - 200; // give 200ms for hbs agent to respond
|
||||
static const int FAIL_PENDING_TIMEOUT_DEFAULT = 2000; // 2 seconds
|
||||
static const int FAIL_PENDING_TIMEOUT_MIN = 1200;
|
||||
static inline int get_failpending_timeout()
|
||||
{
|
||||
int fail_pending_timeout =0;
|
||||
char buf[SM_CONFIGURATION_VALUE_MAX_CHAR + 1];
|
||||
|
||||
if( SM_OKAY == sm_configuration_table_get("FAILPENDING_TIMEOUT_MS", buf, sizeof(buf) - 1) )
|
||||
{
|
||||
fail_pending_timeout = atoi(buf);
|
||||
}
|
||||
if(fail_pending_timeout < FAIL_PENDING_TIMEOUT_MIN)
|
||||
{
|
||||
fail_pending_timeout = FAIL_PENDING_TIMEOUT_DEFAULT;
|
||||
}
|
||||
|
||||
return fail_pending_timeout;
|
||||
}
|
||||
|
||||
static const int fail_pending_timeout = 0;
|
||||
|
||||
static SmTimerIdT action_timer_id = SM_TIMER_ID_INVALID;
|
||||
static const int RESET_TIMEOUT = 10 * 1000; // 10 seconds for a reset command to reboot a node
|
||||
|
@ -187,8 +206,8 @@ SmFailoverFailPendingState::~SmFailoverFailPendingState()
|
|||
|
||||
SmErrorT SmFailoverFailPendingState::event_handler(SmFailoverEventT event, const ISmFSMEventData* event_data)
|
||||
{
|
||||
//SmFSMEventDataTypeT event_data_type = event_data->get_event_data_type();
|
||||
bool duplex = false;
|
||||
bool blind_guess = false;
|
||||
switch (event)
|
||||
{
|
||||
case SM_FAILOVER_EVENT_IF_STATE_CHANGED:
|
||||
|
@ -230,9 +249,10 @@ SmErrorT SmFailoverFailPendingState::event_handler(SmFailoverEventT event, const
|
|||
if(healthy)
|
||||
{
|
||||
blind_guess_scenario_start();
|
||||
blind_guess = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
if( !blind_guess )
|
||||
{
|
||||
SmSystemFailoverStatus& failover_status = SmSystemFailoverStatus::get_status();
|
||||
SmErrorT error = sm_failover_ss_get_survivor(failover_status);
|
||||
|
@ -288,6 +308,10 @@ bool SmFailoverFailPendingState::_fail_pending_timeout(
|
|||
SmErrorT SmFailoverFailPendingState::enter_state()
|
||||
{
|
||||
SmFSMState::enter_state();
|
||||
DPRINTFI("Pre failure hbs cluster info:");
|
||||
const SmClusterHbsStateT& cluster_hbs_state = SmClusterHbsInfoMsg::get_current_state();
|
||||
log_cluster_hbs_state(cluster_hbs_state);
|
||||
|
||||
SmErrorT error = this->_register_timer();
|
||||
if(SM_OKAY != error)
|
||||
{
|
||||
|
@ -299,6 +323,7 @@ SmErrorT SmFailoverFailPendingState::enter_state()
|
|||
void _cluster_hbs_response_callback()
|
||||
{
|
||||
const SmClusterHbsStateT& cluster_hbs_state = SmClusterHbsInfoMsg::get_current_state();
|
||||
DPRINTFI("Fail-pending timeout cluster info:");
|
||||
log_cluster_hbs_state(cluster_hbs_state);
|
||||
SmSystemFailoverStatus::get_status().set_cluster_hbs_state(cluster_hbs_state);
|
||||
}
|
||||
|
@ -319,13 +344,14 @@ SmErrorT SmFailoverFailPendingState::_register_timer()
|
|||
this->_deregister_timer();
|
||||
}
|
||||
|
||||
error = sm_timer_register(timer_name, FAIL_PENDING_TIMEOUT,
|
||||
int fail_pending_timeout = get_failpending_timeout();
|
||||
error = sm_timer_register(timer_name, fail_pending_timeout,
|
||||
SmFailoverFailPendingState::_fail_pending_timeout,
|
||||
0, &this->_pending_timer_id);
|
||||
|
||||
const char* delay_query_hbs_timer_name = "DELAY QUERY HBS";
|
||||
|
||||
error = sm_timer_register(delay_query_hbs_timer_name, DELAY_QUERY_HBS_MS,
|
||||
error = sm_timer_register(delay_query_hbs_timer_name, fail_pending_timeout - 200,
|
||||
SmFailoverFailPendingState::_delay_query_hbs_timeout,
|
||||
0, &this->_delay_query_hbs_timer_id);
|
||||
|
||||
|
|
|
@ -1,26 +1,274 @@
|
|||
//
|
||||
// Copyright (c) 2018 Wind River Systems, Inc.
|
||||
// Copyright (c) 2018-2021 Wind River Systems, Inc.
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
#include "sm_failover_failed_state.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <limits.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "sm_failover_failed_state.h"
|
||||
#include "sm_types.h"
|
||||
#include "sm_debug.h"
|
||||
#include "sm_node_utils.h"
|
||||
#include "sm_node_api.h"
|
||||
#include "sm_failover.h"
|
||||
#include "sm_failover_fsm.h"
|
||||
#include "sm_failover_ss.h"
|
||||
#include "sm_failover_utils.h"
|
||||
#include "sm_cluster_hbs_info_msg.h"
|
||||
|
||||
extern bool is_cluster_host_interface_configured( void );
|
||||
|
||||
// Failover Failed Recovery Audit period = 5 seconds
|
||||
static const int FAILED_STATE_AUDIT_PERIOD = 5000;
|
||||
|
||||
// Recovery log throttle threshold - 1 log every minute
|
||||
static const int SM_FAILOVER_FAILED_LOG_THROTTLE_THLD = 12;
|
||||
|
||||
// processes to restart over a failover failed recovery
|
||||
#define MAX_RESTART_PROCESS_NAME_LEN 10
|
||||
#define PROCESS_SM ((const char *)("sm"))
|
||||
|
||||
static struct timespec start_time;
|
||||
|
||||
// Failover Failed state class constructor
|
||||
SmFailoverFailedState::SmFailoverFailedState(SmFailoverFSM& fsm) : SmFSMState(fsm)
|
||||
{
|
||||
this->_failed_state_audit_timer_id = SM_TIMER_ID_INVALID;
|
||||
}
|
||||
|
||||
// The 'Failover Failed' state destructor
|
||||
// - stops the recovery audit if needed
|
||||
SmFailoverFailedState::~SmFailoverFailedState()
|
||||
{
|
||||
this->_deregister_timer();
|
||||
}
|
||||
|
||||
// Failover Failed state entry class member function
|
||||
// - starts the Failover Failed state recovery audit timer
|
||||
SmErrorT SmFailoverFailedState::enter_state()
|
||||
{
|
||||
SmFSMState::enter_state();
|
||||
|
||||
DPRINTFE("********************************************************");
|
||||
DPRINTFE("Entering Failover Failed state ; recovery audit started ");
|
||||
DPRINTFE("********************************************************");
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC_RAW, &start_time);
|
||||
DPRINTFI("Wait for %d seconds to start failed recovery audit",
|
||||
sm_failover_get_reset_peer_wait_time());
|
||||
SmErrorT error = this->_register_timer();
|
||||
if(SM_OKAY != error)
|
||||
{
|
||||
DPRINTFE("Failed to register failed state timer. Error %s", sm_error_str(error));
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
// Failover Failed state audit timer handler
|
||||
bool SmFailoverFailedState::_failed_state_audit(
|
||||
SmTimerIdT timer_id, int64_t user_data)
|
||||
{
|
||||
// wait enough time for peer to be reset to avoid conflict decision, i.e being reset
|
||||
struct timespec now;
|
||||
clock_gettime(CLOCK_REALTIME, &now);
|
||||
if(now.tv_sec - start_time.tv_sec - 1 > sm_failover_get_reset_peer_wait_time())
|
||||
{
|
||||
SmFailoverFSM::get_fsm().send_event(SM_FAILOVER_EVENT_FAILED_RECOVERY_AUDIT, NULL);
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
// Issue a self restart through pmon-restart service
|
||||
static bool sm_failover_failed_process_restart( const char * process )
|
||||
{
|
||||
DPRINTFI( "Issuing controlled process restart ; pmon-restart %s", process);
|
||||
pid_t pid = fork();
|
||||
if( 0 > pid )
|
||||
{
|
||||
DPRINTFE( "Failed to fork 'pmond-restart %s' request, error=%s.",
|
||||
process, strerror( errno ) );
|
||||
return( true );
|
||||
}
|
||||
else if( 0 == pid )
|
||||
{
|
||||
// set the arguement array for execv
|
||||
char pmon_restart_cmd[] = "/usr/local/sbin/pmon-restart";
|
||||
|
||||
char pmon_restart_process[MAX_RESTART_PROCESS_NAME_LEN] ;
|
||||
snprintf(&pmon_restart_process[0], MAX_RESTART_PROCESS_NAME_LEN, "%s", process);
|
||||
|
||||
char* pmon_restart_argv[3] ;
|
||||
pmon_restart_argv[0] = pmon_restart_cmd;
|
||||
pmon_restart_argv[1] = pmon_restart_process;
|
||||
pmon_restart_argv[2] = NULL;
|
||||
|
||||
// Add the path to socat for pmon-restart
|
||||
char path[] = "PATH=/usr/bin:$PATH";
|
||||
char* pmon_restart_env[2] ;
|
||||
pmon_restart_env[0] = path;
|
||||
pmon_restart_env[1] = NULL;
|
||||
|
||||
setpgid( 0, 0 );
|
||||
|
||||
struct rlimit file_limits;
|
||||
if( 0 == getrlimit( RLIMIT_NOFILE, &file_limits ) )
|
||||
{
|
||||
unsigned int fd_i;
|
||||
for( fd_i=0; fd_i < file_limits.rlim_cur; ++fd_i )
|
||||
{
|
||||
close( fd_i );
|
||||
}
|
||||
open( "/dev/null", O_RDONLY ); // stdin
|
||||
open( "/dev/null", O_WRONLY ); // stdout
|
||||
open( "/dev/null", O_WRONLY ); // stderr
|
||||
}
|
||||
|
||||
execve( pmon_restart_argv[0], pmon_restart_argv, pmon_restart_env );
|
||||
|
||||
// Shouldn't get this far, else there was an error.
|
||||
exit(-1);
|
||||
}
|
||||
return( false );
|
||||
}
|
||||
|
||||
// Failover Failed recovery criteria checker
|
||||
static bool sm_failover_failed_recovery_criteria_met( void )
|
||||
{
|
||||
bool criteria_met = false ;
|
||||
|
||||
SmFailoverInterfaceStateT oam_state, mgmt_state, cluster_host_state;
|
||||
oam_state = sm_failover_get_interface_info(SM_INTERFACE_OAM);
|
||||
mgmt_state = sm_failover_get_interface_info(SM_INTERFACE_MGMT);
|
||||
|
||||
const SmClusterHbsStateT& cluster_hbs_state = SmClusterHbsInfoMsg::get_current_state();
|
||||
int peer_controller_index = SmClusterHbsInfoMsg::get_peer_controller_index();
|
||||
|
||||
// If peer has stalled, do not recover until peer recovers from stall
|
||||
if(!cluster_hbs_state.controllers[peer_controller_index].sm_heartbeat_fail)
|
||||
{
|
||||
if ( is_cluster_host_interface_configured() )
|
||||
{
|
||||
cluster_host_state = sm_failover_get_interface_info(SM_INTERFACE_CLUSTER_HOST);
|
||||
if ((( oam_state == SM_FAILOVER_INTERFACE_OK ) || ( oam_state == SM_FAILOVER_INTERFACE_MISSING_HEARTBEAT )) &&
|
||||
(( mgmt_state == SM_FAILOVER_INTERFACE_OK ) || ( mgmt_state == SM_FAILOVER_INTERFACE_MISSING_HEARTBEAT )) &&
|
||||
(( cluster_host_state == SM_FAILOVER_INTERFACE_OK ) || ( cluster_host_state == SM_FAILOVER_INTERFACE_MISSING_HEARTBEAT )))
|
||||
{
|
||||
criteria_met = true ;
|
||||
}
|
||||
}
|
||||
else if ((( oam_state == SM_FAILOVER_INTERFACE_OK ) || ( oam_state == SM_FAILOVER_INTERFACE_MISSING_HEARTBEAT )) &&
|
||||
(( mgmt_state == SM_FAILOVER_INTERFACE_OK ) || ( mgmt_state == SM_FAILOVER_INTERFACE_MISSING_HEARTBEAT )))
|
||||
{
|
||||
criteria_met = true ;
|
||||
}
|
||||
}
|
||||
|
||||
DPRINTFI("Oam:%s ; Mgmt:%s ; Cluster:%s ; recovery criteria met: %s",
|
||||
sm_failover_interface_state_str(oam_state),
|
||||
sm_failover_interface_state_str(mgmt_state),
|
||||
sm_failover_interface_state_str(cluster_host_state),
|
||||
criteria_met ? "Yes" : "No");
|
||||
|
||||
return (criteria_met);
|
||||
}
|
||||
|
||||
SmErrorT proceed_recovery()
|
||||
{
|
||||
SmErrorT error;
|
||||
char peer_name[SM_NODE_NAME_MAX_CHAR];
|
||||
char host_name[SM_NODE_NAME_MAX_CHAR];
|
||||
// delete peer node
|
||||
error = sm_node_api_get_peername(peer_name);
|
||||
if(SM_OKAY != error)
|
||||
{
|
||||
DPRINTFI("Cannot retrieve peer's hostname, error %s", sm_error_str(error));
|
||||
return error;
|
||||
}
|
||||
error = sm_node_api_delete_node(peer_name);
|
||||
if(SM_OKAY != error)
|
||||
{
|
||||
DPRINTFI("Failed to delete peer %s, error %s", peer_name, sm_error_str(error));
|
||||
return error;
|
||||
}else
|
||||
{
|
||||
DPRINTFI("Peer %s is deleted.", peer_name);
|
||||
}
|
||||
|
||||
// enable host
|
||||
error = sm_node_api_get_hostname(host_name);
|
||||
if(SM_OKAY != error)
|
||||
{
|
||||
DPRINTFI("Cannot retrieve hostname, error %s", sm_error_str(error));
|
||||
return error;
|
||||
}
|
||||
error = sm_node_api_recover_node(host_name);
|
||||
if(SM_OKAY != error)
|
||||
{
|
||||
DPRINTFI("Failed to recover %s, error %s", host_name, sm_error_str(error));
|
||||
return error;
|
||||
}else
|
||||
{
|
||||
DPRINTFI("Host %s is recovered.", host_name);
|
||||
}
|
||||
|
||||
sm_node_utils_reset_unhealthy_flag();
|
||||
DPRINTFI("Unhealthy flag is removed");
|
||||
return SM_OKAY;
|
||||
}
|
||||
|
||||
// The 'Failover Failed' state recovery audit handler
|
||||
SmErrorT SmFailoverFailedState::event_handler(SmFailoverEventT event, const ISmFSMEventData* event_data)
|
||||
{
|
||||
// Currently the only supported scenario to recover from failure is
|
||||
// reboot triggered by mtce.
|
||||
// So once entering failed state, wait for reboot to reenter the normal state.
|
||||
SmErrorT error;
|
||||
event_data=event_data;
|
||||
switch (event)
|
||||
{
|
||||
case SM_FAILOVER_EVENT_IF_STATE_CHANGED:
|
||||
// event will be fired, but couldn't bring fsm state back to normal
|
||||
case SM_FAILOVER_EVENT_FAILED_RECOVERY_AUDIT:
|
||||
{
|
||||
if ( sm_failover_failed_recovery_criteria_met() )
|
||||
{
|
||||
DPRINTFI("************************************");
|
||||
DPRINTFI("** Failover Failed state recovery **");
|
||||
DPRINTFI("************************************");
|
||||
error = proceed_recovery();
|
||||
if(SM_OKAY != error)
|
||||
{
|
||||
DPRINTFE("Cannot recover from failed state");
|
||||
}else
|
||||
{
|
||||
sm_failover_failed_process_restart(PROCESS_SM);
|
||||
for ( int i = 0 ; i < 10 ; i++ )
|
||||
{
|
||||
// waiting for shutdown
|
||||
sleep(1);
|
||||
}
|
||||
DPRINTFE("Restart did not occur ; reinstating unhealthy flag ; recovery will retry");
|
||||
sm_node_utils_set_unhealthy();
|
||||
}
|
||||
}
|
||||
else if ( ++_log_throttle > 1 )
|
||||
{
|
||||
if ( _log_throttle > SM_FAILOVER_FAILED_LOG_THROTTLE_THLD )
|
||||
_log_throttle = 0 ;
|
||||
}
|
||||
else
|
||||
{
|
||||
DPRINTFI("Failover Failed state recovery monitor");
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
default:
|
||||
DPRINTFE("Runtime error, unexpected event %s, at state %s",
|
||||
sm_failover_event_str(event),
|
||||
|
@ -28,3 +276,58 @@ SmErrorT SmFailoverFailedState::event_handler(SmFailoverEventT event, const ISmF
|
|||
}
|
||||
return SM_OKAY;
|
||||
}
|
||||
|
||||
// Start the 'Failover Failed' state recovery audit
|
||||
SmErrorT SmFailoverFailedState::_register_timer()
|
||||
{
|
||||
SmErrorT error;
|
||||
const char* timer_name = "FAILED STATE AUDIT TIMER";
|
||||
if(SM_TIMER_ID_INVALID != this->_failed_state_audit_timer_id)
|
||||
this->_deregister_timer();
|
||||
|
||||
error = sm_timer_register(timer_name, FAILED_STATE_AUDIT_PERIOD,
|
||||
SmFailoverFailedState::_failed_state_audit,
|
||||
0, &this->_failed_state_audit_timer_id);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
// Stop the 'Failover Failed' state recovery audit
|
||||
SmErrorT SmFailoverFailedState::_deregister_timer()
|
||||
{
|
||||
SmErrorT error = SM_OKAY;
|
||||
if(SM_TIMER_ID_INVALID != this->_failed_state_audit_timer_id)
|
||||
{
|
||||
error = sm_timer_deregister(this->_failed_state_audit_timer_id);
|
||||
if( SM_OKAY != error )
|
||||
{
|
||||
DPRINTFE( "Failed to cancel failed timer, error=%s.",
|
||||
sm_error_str( error ) );
|
||||
}else
|
||||
{
|
||||
this->_failed_state_audit_timer_id = SM_TIMER_ID_INVALID;
|
||||
}
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
SmErrorT SmFailoverFailedState::exit_state()
|
||||
{
|
||||
SmErrorT error = this->_deregister_timer();
|
||||
if(SM_OKAY != error)
|
||||
{
|
||||
DPRINTFE("Failed to deregister fail failed timer. Error %s", sm_error_str(error));
|
||||
}
|
||||
if(SM_TIMER_ID_INVALID != _failed_state_audit_timer_id)
|
||||
{
|
||||
error = sm_timer_deregister(_failed_state_audit_timer_id);
|
||||
_failed_state_audit_timer_id = SM_TIMER_ID_INVALID;
|
||||
if( SM_OKAY != error)
|
||||
{
|
||||
DPRINTFE("Failed to deregister action timer. Error %s", sm_error_str(error));
|
||||
}
|
||||
}
|
||||
SmFSMState::exit_state();
|
||||
return error;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright (c) 2018 Wind River Systems, Inc.
|
||||
// Copyright (c) 2020 Wind River Systems, Inc.
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
@ -12,12 +12,22 @@
|
|||
class SmFailoverFailedState : public SmFSMState
|
||||
{
|
||||
public:
|
||||
SmFailoverFailedState(SmFailoverFSM& fsm) : SmFSMState(fsm){}
|
||||
SmFailoverFailedState(SmFailoverFSM& fsm);
|
||||
virtual ~SmFailoverFailedState();
|
||||
SmErrorT enter_state();
|
||||
SmErrorT exit_state();
|
||||
|
||||
protected:
|
||||
SmErrorT event_handler(SmFailoverEventT event, const ISmFSMEventData* event_data);
|
||||
|
||||
private:
|
||||
SmTimerIdT _failed_state_audit_timer_id;
|
||||
static bool _failed_state_audit(SmTimerIdT timer_id, int64_t user_data);
|
||||
SmErrorT _register_timer();
|
||||
SmErrorT _deregister_timer();
|
||||
|
||||
int _log_throttle ;
|
||||
};
|
||||
|
||||
|
||||
#endif //__SM_FAILOVER_FAILED_STATE_H__
|
||||
#endif //__SM_FAILOVER_FAILED_STATE_H__
|
||||
|
|
|
@ -384,32 +384,25 @@ SmErrorT sm_failover_ss_get_survivor(const SmSystemStatusT& system_status, SmSys
|
|||
has_cluser_info = false;
|
||||
}
|
||||
|
||||
DPRINTFI("cluster info (%s), maximum available nodes %d", has_cluser_info ? "yes": "no", max_nodes_available);
|
||||
if(has_cluser_info && max_nodes_available > 1)
|
||||
{
|
||||
DPRINTFD("storage-0 is %s", expect_storage_0 ? "enabled":"not enabled");
|
||||
int this_controller_index, peer_controller_index;
|
||||
|
||||
char host_name[SM_NODE_NAME_MAX_CHAR];
|
||||
SmErrorT error = sm_node_utils_get_hostname(host_name);
|
||||
if( SM_OKAY != error )
|
||||
{
|
||||
DPRINTFE( "Failed to get hostname, error=%s.",
|
||||
sm_error_str( error ) );
|
||||
return SM_FAILED;
|
||||
}
|
||||
|
||||
if(0 == strncmp(SM_NODE_CONTROLLER_0_NAME, host_name, sizeof(SM_NODE_CONTROLLER_0_NAME)))
|
||||
{
|
||||
this_controller_index = 0;
|
||||
peer_controller_index = 1;
|
||||
}else
|
||||
{
|
||||
this_controller_index = 1;
|
||||
peer_controller_index = 0;
|
||||
}
|
||||
int this_controller_index = SmClusterHbsInfoMsg::get_this_controller_index();
|
||||
int peer_controller_index = SmClusterHbsInfoMsg::get_peer_controller_index();
|
||||
|
||||
bool survivor_selected = false;
|
||||
if(expect_storage_0)
|
||||
selection.set_peer_stall(false);
|
||||
if(current_cluster_hbs_state.controllers[peer_controller_index].sm_heartbeat_fail)
|
||||
{
|
||||
// peer sm not sending alive pulse, failed
|
||||
DPRINTFI("Peer controller has stalled.");
|
||||
selection.set_host_schedule_state(SM_NODE_STATE_ACTIVE);
|
||||
selection.set_peer_schedule_state(SM_NODE_STATE_FAILED);
|
||||
survivor_selected = true;
|
||||
selection.set_peer_stall(true);
|
||||
}
|
||||
else if(expect_storage_0)
|
||||
{
|
||||
if(current_cluster_hbs_state.controllers[this_controller_index].storage0_responding &&
|
||||
!current_cluster_hbs_state.controllers[peer_controller_index].storage0_responding)
|
||||
|
|
|
@ -69,6 +69,14 @@ class SmSystemFailoverStatus
|
|||
inline SmHeartbeatStateT get_heartbeat_state() const {
|
||||
return _heartbeat_state;
|
||||
}
|
||||
|
||||
inline bool peer_stall() const {
|
||||
return _peer_stall;
|
||||
}
|
||||
inline void set_peer_stall(bool stall) {
|
||||
_peer_stall = stall;
|
||||
}
|
||||
|
||||
void set_host_schedule_state(SmNodeScheduleStateT state);
|
||||
void set_host_pre_failure_schedule_state(SmNodeScheduleStateT state);
|
||||
void set_cluster_hbs_state(const SmClusterHbsStateT& state);
|
||||
|
@ -93,6 +101,7 @@ class SmSystemFailoverStatus
|
|||
SmNodeScheduleStateT _peer_schedule_state;
|
||||
SmClusterHbsStateT _cluster_hbs_state;
|
||||
SmHeartbeatStateT _heartbeat_state;
|
||||
bool _peer_stall;
|
||||
static const char filename[];
|
||||
static const char file_format[];
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "sm_service_domain_member_table.h"
|
||||
#include "sm_service_domain_assignment_table.h"
|
||||
#include "sm_service_domain_table.h"
|
||||
#include "sm_configuration_table.h"
|
||||
|
||||
#define SM_NODE_STAY_FAILED_FILE "/var/run/.sm_stay_fail"
|
||||
|
||||
|
@ -139,3 +140,27 @@ bool sm_failover_utils_is_stayfailed()
|
|||
return false;
|
||||
}
|
||||
// ****************************************************************************
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// Failover Utilities - get wait time for peer to be reset
|
||||
// ==============================
|
||||
int sm_failover_get_reset_peer_wait_time()
|
||||
{
|
||||
char buf[SM_CONFIGURATION_VALUE_MAX_CHAR + 1];
|
||||
const int RESET_PEER_WAIT_TIME_MIN_SEC = 1;
|
||||
const int RESET_PEER_WAIT_TIME_DEFAULT_SEC = 30;
|
||||
int seconds_to_wait = 0;
|
||||
if( SM_OKAY == sm_configuration_table_get("RESET_PEER_WAIT_TIMEOUT_SEC", buf, sizeof(buf) - 1) )
|
||||
{
|
||||
seconds_to_wait = atoi(buf);
|
||||
}
|
||||
if( seconds_to_wait < RESET_PEER_WAIT_TIME_MIN_SEC)
|
||||
{
|
||||
seconds_to_wait = RESET_PEER_WAIT_TIME_DEFAULT_SEC;
|
||||
}
|
||||
|
||||
DPRINTFI("Peer reset wait time %d sec", seconds_to_wait);
|
||||
return seconds_to_wait;
|
||||
}
|
||||
// ****************************************************************************
|
||||
|
|
|
@ -36,6 +36,10 @@ extern SmErrorT sm_failover_utils_reset_stayfailed_flag();
|
|||
extern bool sm_failover_utils_is_stayfailed();
|
||||
// ****************************************************************************
|
||||
|
||||
// ****************************************************************************
|
||||
// Failover Utilities - get wait time for peer to be reset
|
||||
// ==============================
|
||||
extern int sm_failover_get_reset_peer_wait_time();
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "sm_alarm.h"
|
||||
#include "sm_log.h"
|
||||
#include "sm_failover.h"
|
||||
#include "sm_cluster_hbs_info_msg.h"
|
||||
|
||||
#define SM_HEARTBEAT_THREAD_NAME "sm_heartbeat"
|
||||
#define SM_HEARTBEAT_THREAD_TICK_INTERVAL_IN_MS 100
|
||||
|
@ -106,6 +107,10 @@ static SmTimerIdT _alive_timer_id = SM_TIMER_ID_INVALID;
|
|||
static char _node_name[SM_NODE_NAME_MAX_CHAR];
|
||||
static SmHeartbeatMsgCallbacksT _callbacks;
|
||||
|
||||
static int alive_pulse_count = 0;
|
||||
static int alive_pulse_fail_count = 0;
|
||||
static SmTimeT alive_pulse_since = {0};
|
||||
|
||||
// ****************************************************************************
|
||||
// Heartbeat Thread - SmNetworkAddressT ==
|
||||
// =========================
|
||||
|
@ -921,6 +926,35 @@ static bool sm_heartbeat_alive_timer( SmTimerIdT timer_id, int64_t user_data )
|
|||
DPRINTFD( "Sent alive message for node (%s).", _node_name );
|
||||
}
|
||||
|
||||
if(!SmClusterHbsInfoMsg::send_alive_pulse())
|
||||
{
|
||||
alive_pulse_fail_count ++;
|
||||
DPRINTFE("Failed sending alive pulse to hbsAgent");
|
||||
}else
|
||||
{
|
||||
alive_pulse_count ++;
|
||||
|
||||
}
|
||||
|
||||
if(alive_pulse_since.tv_sec == 0)
|
||||
{
|
||||
clock_gettime(CLOCK_MONOTONIC_RAW, &alive_pulse_since);
|
||||
}else
|
||||
{
|
||||
SmTimeT now;
|
||||
clock_gettime(CLOCK_MONOTONIC_RAW, &now);
|
||||
int delta;
|
||||
delta = (int)(now.tv_sec - alive_pulse_since.tv_sec);
|
||||
if(delta > 60)
|
||||
{
|
||||
DPRINTFI("Record %d alive pulses (include %d failed) to hbsAgent since %d seconds ago",
|
||||
alive_pulse_count + alive_pulse_fail_count, alive_pulse_fail_count, delta);
|
||||
alive_pulse_count = 0;
|
||||
alive_pulse_fail_count = 0;
|
||||
alive_pulse_since = now;
|
||||
}
|
||||
}
|
||||
|
||||
DONE:
|
||||
if( 0 != pthread_mutex_unlock( &_mutex ) )
|
||||
{
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#define SM_NODE_AUDIT_TIMER_IN_MS 1000
|
||||
#define SM_INTERFACE_AUDIT_TIMER_IN_MS 1000
|
||||
|
||||
static SmDbHandleT* _sm_db_handle = NULL;
|
||||
static SmApiCallbacksT _api_callbacks = {0};
|
||||
static SmNotifyApiCallbacksT _notify_api_callbacks = {0};
|
||||
static SmTimerIdT _node_audit_timer_id = SM_TIMER_ID_INVALID;
|
||||
|
@ -322,14 +321,6 @@ SmErrorT sm_main_event_handler_initialize( void )
|
|||
memset( &_api_callbacks, 0, sizeof(_api_callbacks) );
|
||||
memset( &_notify_api_callbacks, 0, sizeof(_notify_api_callbacks) );
|
||||
|
||||
error = sm_db_connect( SM_DATABASE_NAME, &_sm_db_handle );
|
||||
if( SM_OKAY != error )
|
||||
{
|
||||
DPRINTFE( "Failed to connect to database (%s), error=%s.",
|
||||
SM_DATABASE_NAME, sm_error_str( error ) );
|
||||
return( error );
|
||||
}
|
||||
|
||||
error = sm_timer_register( "node audit",
|
||||
SM_NODE_AUDIT_TIMER_IN_MS,
|
||||
sm_main_event_handler_audit_node,
|
||||
|
@ -372,7 +363,7 @@ SmErrorT sm_main_event_handler_initialize( void )
|
|||
{
|
||||
DPRINTFE( "Failed to release service groups, error=%s.",
|
||||
sm_error_str( error ) );
|
||||
return( error );
|
||||
return error;
|
||||
}
|
||||
|
||||
error = sm_api_initialize();
|
||||
|
@ -498,18 +489,6 @@ SmErrorT sm_main_event_handler_finalize( void )
|
|||
_interface_audit_timer_id = SM_TIMER_ID_INVALID;
|
||||
}
|
||||
|
||||
if( NULL != _sm_db_handle )
|
||||
{
|
||||
error = sm_db_disconnect( _sm_db_handle );
|
||||
if( SM_OKAY != error )
|
||||
{
|
||||
DPRINTFE( "Failed to disconnect from database (%s), error=%s.",
|
||||
SM_DATABASE_NAME, sm_error_str( error ) );
|
||||
}
|
||||
|
||||
_sm_db_handle = NULL;
|
||||
}
|
||||
|
||||
return( SM_OKAY );
|
||||
}
|
||||
// ****************************************************************************
|
||||
|
|
|
@ -803,6 +803,12 @@ static int sm_send_ipv6_msg(SmServiceDomainInterfaceT* interface, SmMsgT* msg )
|
|||
ipv6_dst = &(interface->network_peer_address.u.ipv6);
|
||||
}
|
||||
dst_addr6.sin6_addr = ipv6_dst->sin6;
|
||||
if (memcmp(&in6addr_any, &dst_addr6.sin6_addr, sizeof(dst_addr6.sin6_addr)) == 0 )
|
||||
{
|
||||
// don't send to ::
|
||||
return _MSG_NOT_SENT_TO_TARGET;
|
||||
}
|
||||
|
||||
result = sm_msg_sendmsg_src_ipv6( interface->unicast_socket, msg, sizeof(SmMsgT),
|
||||
0, &dst_addr6, &interface->network_address.u.ipv6.sin6 );
|
||||
|
||||
|
|
|
@ -742,6 +742,44 @@ SmErrorT sm_node_api_fail_node( char node_name[] )
|
|||
}
|
||||
// ****************************************************************************
|
||||
|
||||
// ****************************************************************************
|
||||
// Node API - Recover Node
|
||||
// ======================
|
||||
SmErrorT sm_node_api_recover_node( char node_name[] )
|
||||
{
|
||||
SmDbNodeT node;
|
||||
SmErrorT error;
|
||||
error = sm_db_nodes_read( _sm_db_handle, node_name, &node );
|
||||
if( SM_OKAY != error )
|
||||
{
|
||||
DPRINTFE( "Failed to read node (%s) information, error=%s.",
|
||||
node_name, sm_error_str( error ) );
|
||||
return( error );
|
||||
}
|
||||
|
||||
if( node.oper_state != SM_NODE_OPERATIONAL_STATE_DISABLED ||
|
||||
node.avail_status != SM_NODE_AVAIL_STATUS_FAILED )
|
||||
{
|
||||
DPRINTFD("Not in failure mode %s", node_name);
|
||||
}
|
||||
|
||||
DPRINTFE("Node %s is to recover from failure mode.", node_name);
|
||||
|
||||
error = sm_node_api_update_node(
|
||||
node_name,
|
||||
node.admin_state,
|
||||
SM_NODE_OPERATIONAL_STATE_ENABLED,
|
||||
SM_NODE_AVAIL_STATUS_AVAILABLE);
|
||||
|
||||
if( SM_OKAY != error )
|
||||
{
|
||||
DPRINTFE( "Failed to set node (%s) failed, error=%s.",
|
||||
node_name, sm_error_str( error ) );
|
||||
}
|
||||
return( error );
|
||||
}
|
||||
// ****************************************************************************
|
||||
|
||||
// ****************************************************************************
|
||||
// Node API - Delete Node
|
||||
// ======================
|
||||
|
|
|
@ -54,6 +54,12 @@ extern SmErrorT sm_node_api_update_node( char node_name[],
|
|||
SmErrorT sm_node_api_fail_node( char node_name[] );
|
||||
// ****************************************************************************
|
||||
|
||||
// ****************************************************************************
|
||||
// Node API - Fail Node
|
||||
// ======================
|
||||
SmErrorT sm_node_api_recover_node( char node_name[] );
|
||||
// ****************************************************************************
|
||||
|
||||
// ****************************************************************************
|
||||
// Node API - Delete Node
|
||||
// ======================
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
#include "sm_task_affining_thread.h"
|
||||
#include "sm_worker_thread.h"
|
||||
#include "sm_configuration_table.h"
|
||||
#include "sm_cluster_hbs_info_msg.h"
|
||||
|
||||
#define SM_PROCESS_DB_CHECKPOINT_INTERVAL_IN_MS 30000
|
||||
#define SM_PROCESS_TICK_INTERVAL_IN_MS 200
|
||||
|
@ -233,6 +234,12 @@ static SmErrorT sm_process_initialize( void )
|
|||
return( SM_FAILED );
|
||||
}
|
||||
|
||||
error = SmClusterHbsInfoMsg::initialize();
|
||||
if(SM_OKAY != error)
|
||||
{
|
||||
DPRINTFE("Failed to initialize cluster hbs info messaging");
|
||||
}
|
||||
|
||||
if (_is_aio_simplex)
|
||||
{
|
||||
sm_heartbeat_thread_disable_heartbeat();
|
||||
|
@ -518,6 +525,12 @@ static SmErrorT sm_process_finalize( void )
|
|||
sm_error_str( error ) );
|
||||
}
|
||||
|
||||
error = SmClusterHbsInfoMsg::finalize();
|
||||
if(SM_OKAY != error)
|
||||
{
|
||||
DPRINTFE("Failed to finalize cluster hbs info messaging");
|
||||
}
|
||||
|
||||
error = sm_log_finalize();
|
||||
if( SM_OKAY != error )
|
||||
{
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "sm_db_service_action_results.h"
|
||||
|
||||
static SmListT* _service_action_results = NULL;
|
||||
static SmDbHandleT* _sm_db_handle = NULL;
|
||||
|
||||
// ****************************************************************************
|
||||
// Service Action Result Table - Read
|
||||
|
@ -149,14 +148,6 @@ SmErrorT sm_service_action_result_table_initialize( void )
|
|||
|
||||
_service_action_results = NULL;
|
||||
|
||||
error = sm_db_connect( SM_DATABASE_NAME, &_sm_db_handle );
|
||||
if( SM_OKAY != error )
|
||||
{
|
||||
DPRINTFE( "Failed to connect to database (%s), error=%s.",
|
||||
SM_DATABASE_NAME, sm_error_str( error ) );
|
||||
return( error );
|
||||
}
|
||||
|
||||
error = sm_service_action_result_table_load();
|
||||
if( SM_OKAY != error )
|
||||
{
|
||||
|
@ -174,22 +165,8 @@ SmErrorT sm_service_action_result_table_initialize( void )
|
|||
// ======================================
|
||||
SmErrorT sm_service_action_result_table_finalize( void )
|
||||
{
|
||||
SmErrorT error;
|
||||
|
||||
SM_LIST_CLEANUP_ALL( _service_action_results );
|
||||
|
||||
if( NULL != _sm_db_handle )
|
||||
{
|
||||
error = sm_db_disconnect( _sm_db_handle );
|
||||
if( SM_OKAY != error )
|
||||
{
|
||||
DPRINTFE( "Failed to disconnect from database (%s), error=%s.",
|
||||
SM_DATABASE_NAME, sm_error_str( error ) );
|
||||
}
|
||||
|
||||
_sm_db_handle = NULL;
|
||||
}
|
||||
|
||||
return( SM_OKAY );
|
||||
}
|
||||
// ****************************************************************************
|
||||
|
|
|
@ -204,7 +204,7 @@ SmErrorT sm_service_action_table_initialize( void )
|
|||
|
||||
_service_actions = NULL;
|
||||
|
||||
error = sm_db_connect( SM_DATABASE_NAME, &_sm_db_handle );
|
||||
error = sm_db_connect( SM_DATABASE_NAME, &_sm_db_handle, true );
|
||||
if( SM_OKAY != error )
|
||||
{
|
||||
DPRINTFE( "Failed to connect to database (%s), error=%s.",
|
||||
|
|
|
@ -220,7 +220,7 @@ SmErrorT sm_service_dependency_table_initialize( void )
|
|||
{
|
||||
SmErrorT error;
|
||||
|
||||
error = sm_db_connect( SM_DATABASE_NAME, &_sm_db_handle );
|
||||
error = sm_db_connect( SM_DATABASE_NAME, &_sm_db_handle, true );
|
||||
if( SM_OKAY != error )
|
||||
{
|
||||
DPRINTFE( "Failed to connect to database (%s), error=%s.",
|
||||
|
|
|
@ -149,7 +149,7 @@ SmErrorT sm_service_domain_api_initialize( void )
|
|||
{
|
||||
SmErrorT error;
|
||||
|
||||
error = sm_db_connect( SM_DATABASE_NAME, &_sm_db_handle );
|
||||
error = sm_db_connect( SM_DATABASE_NAME, &_sm_db_handle, true );
|
||||
if( SM_OKAY != error )
|
||||
{
|
||||
DPRINTFE( "Failed to connect to database (%s), error=%s.",
|
||||
|
|
|
@ -63,17 +63,20 @@ SmErrorT sm_service_domain_interface_unknown_state_event_handler(
|
|||
SmServiceDomainInterfaceT* interface, SmServiceDomainInterfaceEventT event,
|
||||
void* event_data[] )
|
||||
{
|
||||
bool enabled;
|
||||
bool enabled = false;
|
||||
SmErrorT error;
|
||||
char reason_text[SM_LOG_REASON_TEXT_MAX_CHAR] = {0};
|
||||
|
||||
error = sm_hw_get_if_state( interface->interface_name, &enabled );
|
||||
if( SM_OKAY != error )
|
||||
if (SM_SERVICE_DOMAIN_INTERFACE_EVENT_NOT_IN_USE != event)
|
||||
{
|
||||
DPRINTFE( "Failed to audit hardware state of interface (%s), "
|
||||
"error=%s", interface->interface_name,
|
||||
sm_error_str( error ) );
|
||||
return( error );
|
||||
error = sm_hw_get_if_state( interface->interface_name, &enabled );
|
||||
if( SM_OKAY != error )
|
||||
{
|
||||
DPRINTFE( "Failed to audit hardware state of interface (%s), "
|
||||
"error=%s", interface->interface_name,
|
||||
sm_error_str( error ) );
|
||||
return( error );
|
||||
}
|
||||
}
|
||||
|
||||
switch( event )
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "sm_db_service_domain_members.h"
|
||||
|
||||
static SmListT* _service_domain_members = NULL;
|
||||
static SmDbHandleT* _sm_db_handle = NULL;
|
||||
|
||||
// ****************************************************************************
|
||||
// Service Domain Member Table - Read
|
||||
|
@ -262,14 +261,6 @@ SmErrorT sm_service_domain_member_table_initialize( void )
|
|||
|
||||
_service_domain_members = NULL;
|
||||
|
||||
error = sm_db_connect( SM_DATABASE_NAME, &_sm_db_handle );
|
||||
if( SM_OKAY != error )
|
||||
{
|
||||
DPRINTFE( "Failed to connect to database (%s), error=%s.",
|
||||
SM_DATABASE_NAME, sm_error_str( error ) );
|
||||
return( error );
|
||||
}
|
||||
|
||||
error = sm_service_domain_member_table_load();
|
||||
if( SM_OKAY != error )
|
||||
{
|
||||
|
@ -287,22 +278,8 @@ SmErrorT sm_service_domain_member_table_initialize( void )
|
|||
// ======================================
|
||||
SmErrorT sm_service_domain_member_table_finalize( void )
|
||||
{
|
||||
SmErrorT error;
|
||||
|
||||
SM_LIST_CLEANUP_ALL( _service_domain_members );
|
||||
|
||||
if( NULL != _sm_db_handle )
|
||||
{
|
||||
error = sm_db_disconnect( _sm_db_handle );
|
||||
if( SM_OKAY != error )
|
||||
{
|
||||
DPRINTFE( "Failed to disconnect from database (%s), error=%s.",
|
||||
SM_DATABASE_NAME, sm_error_str( error ) );
|
||||
}
|
||||
|
||||
_sm_db_handle = NULL;
|
||||
}
|
||||
|
||||
return( SM_OKAY );
|
||||
}
|
||||
// ****************************************************************************
|
||||
|
|
|
@ -1930,7 +1930,7 @@ SmErrorT sm_service_domain_scheduler_initialize( SmDbHandleT* sm_db_handle )
|
|||
return( error );
|
||||
}
|
||||
|
||||
error = sm_service_domain_weight_initialize( _sm_db_handle );
|
||||
error = sm_service_domain_weight_initialize();
|
||||
if( SM_OKAY != error )
|
||||
{
|
||||
DPRINTFE( "Failed to intialize service domain weighting, "
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
#include "sm_db_nodes.h"
|
||||
#include "sm_service_domain_assignment_table.h"
|
||||
|
||||
static SmDbHandleT* _sm_db_handle = NULL;
|
||||
|
||||
// ****************************************************************************
|
||||
// Service Domain Weight - Cleanup
|
||||
// ===============================
|
||||
|
@ -205,10 +203,8 @@ SmErrorT sm_service_domain_weight_apply( char service_domain_name[] )
|
|||
// ****************************************************************************
|
||||
// Service Domain Weight - Initialize
|
||||
// ==================================
|
||||
SmErrorT sm_service_domain_weight_initialize( SmDbHandleT* sm_db_handle )
|
||||
SmErrorT sm_service_domain_weight_initialize()
|
||||
{
|
||||
_sm_db_handle = sm_db_handle;
|
||||
|
||||
return( SM_OKAY );
|
||||
}
|
||||
// ****************************************************************************
|
||||
|
@ -218,8 +214,6 @@ SmErrorT sm_service_domain_weight_initialize( SmDbHandleT* sm_db_handle )
|
|||
// ================================
|
||||
SmErrorT sm_service_domain_weight_finalize( void )
|
||||
{
|
||||
_sm_db_handle = NULL;
|
||||
|
||||
return( SM_OKAY );
|
||||
}
|
||||
// ****************************************************************************
|
||||
|
|
|
@ -22,7 +22,7 @@ extern SmErrorT sm_service_domain_weight_apply( char service_domain_name[] );
|
|||
// ****************************************************************************
|
||||
// Service Domain Weight - Initialize
|
||||
// ==================================
|
||||
extern SmErrorT sm_service_domain_weight_initialize( SmDbHandleT* sm_db_handle );
|
||||
extern SmErrorT sm_service_domain_weight_initialize();
|
||||
// ****************************************************************************
|
||||
|
||||
// ****************************************************************************
|
||||
|
|
|
@ -40,7 +40,6 @@ bool sm_service_clear_failure_state(SmServiceT* service)
|
|||
bool prev_failure_condition;
|
||||
prev_failure_condition =
|
||||
service->recover ||
|
||||
service->fail_count > 0 ||
|
||||
service->action_fail_count > 0 ||
|
||||
service->transition_fail_count > 0 ||
|
||||
service->status == SM_SERVICE_STATUS_FAILED ||
|
||||
|
@ -50,7 +49,6 @@ bool sm_service_clear_failure_state(SmServiceT* service)
|
|||
if( prev_failure_condition )
|
||||
{
|
||||
service->recover = false;
|
||||
service->fail_count = 0;
|
||||
service->action_fail_count = 0;
|
||||
service->transition_fail_count = 0;
|
||||
service->status = SM_SERVICE_STATUS_NONE;
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
SRC_DIR="$PKG_BASE/src"
|
||||
TIS_PATCH_VER=3
|
||||
TIS_PATCH_VER=PKG_GITREVCOUNT
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
hacking
|
||||
bashate >= 0.2
|
||||
PyYAML >= 3.1.0
|
||||
yamllint >= 0.5.2
|
||||
bandit;python_version>="3.0"
|
||||
|
|
69
tox.ini
69
tox.ini
|
@ -15,6 +15,27 @@ deps = -r{toxinidir}/test-requirements.txt
|
|||
whitelist_externals = reno
|
||||
|
||||
[testenv:linters]
|
||||
basepython = python3
|
||||
whitelist_externals = bash
|
||||
commands =
|
||||
bash -c "find {toxinidir} \
|
||||
-not \( -type d -name .?\* -prune \) \
|
||||
-type f \
|
||||
-not -name \*~ \
|
||||
-not -name \*.md \
|
||||
\( \
|
||||
-name \*.sh \
|
||||
-or -not -wholename \*/devstack/files/\* \
|
||||
-wholename \*/devstack/\* \
|
||||
\) \
|
||||
-print0 | xargs -r -n 1 -0 bashate -v -e E* -i E006"
|
||||
bash -c "find {toxinidir} \
|
||||
\( -name middleware/io-monitor/recipes-common/io-monitor/io-monitor/io_monitor/test-tools/yaml/* -prune \) \
|
||||
-o \( -name .tox -prune \) \
|
||||
-o -type f -name '*.yaml' \
|
||||
-print0 | xargs -0 yamllint"
|
||||
|
||||
[testenv:pylint]
|
||||
basepython = python2.7
|
||||
deps = {[testenv]deps}
|
||||
eventlet
|
||||
|
@ -32,24 +53,7 @@ deps = {[testenv]deps}
|
|||
sqlalchemy-migrate
|
||||
wsme
|
||||
pylint
|
||||
whitelist_externals = bash
|
||||
commands =
|
||||
bash -c "find {toxinidir} \
|
||||
-not \( -type d -name .?\* -prune \) \
|
||||
-type f \
|
||||
-not -name \*~ \
|
||||
-not -name \*.md \
|
||||
\( \
|
||||
-name \*.sh \
|
||||
-or -not -wholename \*/devstack/files/\* \
|
||||
-wholename \*/devstack/\* \
|
||||
\) \
|
||||
-print0 | xargs -0 bashate -v"
|
||||
bash -c "find {toxinidir} \
|
||||
\( -name middleware/io-monitor/recipes-common/io-monitor/io-monitor/io_monitor/test-tools/yaml/* -prune \) \
|
||||
-o \( -name .tox -prune \) \
|
||||
-o -type f -name '*.yaml' \
|
||||
-print0 | xargs -0 yamllint"
|
||||
pylint --rcfile=./pylint.rc --extension-pkg-whitelist=greenlet \
|
||||
./service-mgmt-api/sm-api/sm_api/ \
|
||||
./service-mgmt-tools/sm-tools/sm_tools/ \
|
||||
|
@ -68,15 +72,24 @@ commands =
|
|||
# H404: multi line docstring should start without a leading new line
|
||||
# H405: multi line docstring summary not separated with an empty line
|
||||
# H501: Do not use locals() for string formatting
|
||||
# W are warnings
|
||||
# W504 W504 line break after binary operator
|
||||
# W605 invalid escape sequence
|
||||
# - errors -
|
||||
# E741 ambiguous variable name
|
||||
# F811 redefinition of unused '<foo>' from line <x>
|
||||
# F821 undefined name 'e'
|
||||
# F841 local variable
|
||||
# F901 'raise NotImplemented' should be 'raise NotImplementedError'
|
||||
# - bugbear -
|
||||
# B008 Do not perform calls in argument defaults. The call is performed only once at function definition time.
|
||||
# B014 Redundant exception types
|
||||
ignore= E402,
|
||||
H102,H104,H105,H106,H306,H401,H403,H404,H405,H501,
|
||||
F811,F821,
|
||||
B008
|
||||
W504,W605,
|
||||
E741,
|
||||
F811,F821,F841,F901,
|
||||
B008,B014
|
||||
# Enable checks which are off by default
|
||||
# H106 Don’t put vim configuration in source files (off by default). SHOULD BE ENABLED.
|
||||
# H203 Use assertIs(Not)None to check for None (off by default).
|
||||
|
@ -89,9 +102,8 @@ basepython = python3
|
|||
usedevelop = False
|
||||
skip_install = True
|
||||
deps =
|
||||
hacking
|
||||
flake8-bugbear<=19.3.0
|
||||
flake8 < 3.6.0
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
flake8-bugbear
|
||||
commands =
|
||||
flake8
|
||||
|
||||
|
@ -101,6 +113,7 @@ commands = {posargs}
|
|||
|
||||
[testenv:docs]
|
||||
basepython = python3
|
||||
install_command = pip install -U {opts} {packages}
|
||||
deps = -r{toxinidir}/doc/requirements.txt
|
||||
commands =
|
||||
rm -rf doc/build
|
||||
|
@ -118,15 +131,27 @@ whitelist_externals = rm
|
|||
[testenv:newnote]
|
||||
basepython = python3
|
||||
# Re-use the releasenotes venv
|
||||
install_command = pip install -U {opts} {packages}
|
||||
envdir = {toxworkdir}/releasenotes
|
||||
deps = -r{toxinidir}/doc/requirements.txt
|
||||
commands = reno new {posargs}
|
||||
|
||||
[testenv:api-ref]
|
||||
basepython = python3
|
||||
install_command = pip install -U {opts} {packages}
|
||||
deps =
|
||||
-r{toxinidir}/doc/requirements.txt
|
||||
commands =
|
||||
rm -rf api-ref/build
|
||||
sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html
|
||||
whitelist_externals = rm
|
||||
|
||||
[bandit]
|
||||
# B411: blacklist Using xmlrpclib
|
||||
skips = B411
|
||||
|
||||
[testenv:bandit]
|
||||
basepython = python3
|
||||
description = Bandit code scan for *.py files under config folder
|
||||
deps = -r{toxinidir}/test-requirements.txt
|
||||
commands = bandit --ini tox.ini -r {toxinidir}/ -x '**/.tox/**',**/.eggs/** -lll
|
||||
|
|
Loading…
Reference in New Issue