src/imm/agent/imma_cb.h | 11 +- src/imm/agent/imma_db.cc | 37 +++++++- src/imm/agent/imma_init.cc | 2 + src/imm/agent/imma_oi_api.cc | 96 ++++++++++++++++++- src/imm/agent/imma_om_api.cc | 211 +++++++++++++++++++++++++++++++++++++++--- src/imm/agent/imma_proc.cc | 31 ++++++ src/imm/common/immsv_api.h | 3 +- src/imm/common/immsv_evt.c | 15 +++ src/imm/common/immsv_evt.h | 2 + 9 files changed, 383 insertions(+), 25 deletions(-)
diff --git a/src/imm/agent/imma_cb.h b/src/imm/agent/imma_cb.h --- a/src/imm/agent/imma_cb.h +++ b/src/imm/agent/imma_cb.h @@ -1,6 +1,7 @@ /* -*- OpenSAF -*- * * (C) Copyright 2008 The OpenSAF Foundation + * Copyright (C) 2017, Oracle and/or its affiliates. All rights reserved. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY @@ -60,6 +61,7 @@ typedef struct imma_client_node { will set this to true for the connection. A resurrect can remove it.*/ bool exposed; /* Exposed => stale is irreversible */ + bool clmExposed; /* True ==> then handle is unavailable, due to clm leaving the cluster*/ bool selObjUsable; /* Active resurrect possible for this client */ bool isPbe; /* True => This is the PBE-OI */ bool isImmA2b; /* Version A.02.11 */ @@ -70,6 +72,7 @@ typedef struct imma_client_node { bool isImmA2fCbk; /* Version A.02.15 callback*/ bool isImmA2x10; /* Version A.02.16 */ bool isImmA2x11; /* Version A.02.17 */ + bool isImmA2x12; /* Version A.02.18 */ bool isApplier; /* True => This is an Applier-OI */ bool isAug; /* True => handle internal to OI augmented CCB */ bool isBusy; /* True => handle is locked by a thread until a function execution is done */ @@ -170,9 +173,10 @@ typedef struct imma_cb { IMMA_CONTINUATION_RECORD *imma_continuations; /* Sync up with IMMND ( MDS ) see imma_sync_with_immnd() in imma_init.c */ - NCS_LOCK immnd_sync_lock; - bool immnd_sync_awaited; - NCS_SEL_OBJ immnd_sync_sel; + NCS_LOCK immnd_sync_lock; + bool immnd_sync_awaited; + NCS_SEL_OBJ immnd_sync_sel; + bool clmMemberNode; /* True if the node is CLM Member node */ } IMMA_CB; #define m_IMMSV_SET_SANAMET(name) \ @@ -248,6 +252,7 @@ void imma_process_stale_clients(IMMA_CB void imma_free_errorStrings(SaStringT* errorStrings); SaStringT* imma_getErrorStrings(IMMSV_SAERR_INFO* errRsp); +void imma_client_tree_mark_clmexposed(IMMA_CB *cb); /*30B Versioning Changes */ #define IMMA_MDS_PVT_SUBPART_VERSION 1 diff --git a/src/imm/agent/imma_db.cc b/src/imm/agent/imma_db.cc --- a/src/imm/agent/imma_db.cc +++ b/src/imm/agent/imma_db.cc @@ -1,6 +1,7 @@ /* -*- OpenSAF -*- * * (C) Copyright 2008 The OpenSAF Foundation + * Copyright (C) 2017, Oracle and/or its affiliates. All rights reserved. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY @@ -120,6 +121,37 @@ uint32_t imma_client_node_delete(IMMA_CB } /**************************************************************************** +Name : imma_client_tree_mark_clmexposed +Description : This routine marks the clmexposed in IMMA client tree. +Arguments : IMMA_CB *cb - IMMA Control Block. +Return Values : None +Notes : None +******************************************************************************/ +void imma_client_tree_mark_clmexposed(IMMA_CB *cb) +{ + IMMA_CLIENT_NODE *clnode; + SaImmHandleT *temp_ptr = 0; + SaImmHandleT temp_hdl = 0; + TRACE_ENTER(); + + /* scan the entire handle and mark clmexposed in each record */ + while ((clnode = (IMMA_CLIENT_NODE *) + ncs_patricia_tree_getnext(&cb->client_tree, (uint8_t *)temp_ptr))) { + /* mark the client info as clmexposed*/ + if (clnode->isImmA2x12 && !cb->clmMemberNode){ + clnode->clmExposed = true; + TRACE(" Marking clinet %llx as clmExposed", clnode->handle); + } + temp_hdl = clnode->handle; + temp_ptr = &temp_hdl; + } + + TRACE_LEAVE(); + return; +} + + +/**************************************************************************** Name : imma_client_tree_destroy Description : This routine destroys the IMMA client tree. Arguments : IMMA_CB *cb - IMMA Control Block. @@ -681,7 +713,10 @@ void imma_mark_clients_stale(IMMA_CB *cb if(mark_exposed) { clnode->exposed = true; LOG_WA("marking handle as exposed"); - } + }else if (clnode->isImmA2x12 && clnode->clmExposed){ + clnode->exposed = true; + LOG_WA("marking handle as exposed, CLM node left cluster membership"); + } clnode->stale = true; TRACE("Stale marked client cl:%u node:%x", diff --git a/src/imm/agent/imma_init.cc b/src/imm/agent/imma_init.cc --- a/src/imm/agent/imma_init.cc +++ b/src/imm/agent/imma_init.cc @@ -1,6 +1,7 @@ /* -*- OpenSAF -*- * * (C) Copyright 2008 The OpenSAF Foundation + * Copyright (C) 2017, Oracle and/or its affiliates. All rights reserved. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY @@ -136,6 +137,7 @@ static uint32_t imma_create(NCSMDS_SVC_I TRACE_4("Failed to get cb lock"); goto lock_init_fail; } + imma_cb.clmMemberNode = true; /* Initalize the IMMA Trees & Linked lists */ rc = imma_db_init(cb); diff --git a/src/imm/agent/imma_oi_api.cc b/src/imm/agent/imma_oi_api.cc --- a/src/imm/agent/imma_oi_api.cc +++ b/src/imm/agent/imma_oi_api.cc @@ -1,6 +1,7 @@ /* -*- OpenSAF -*- * * (C) Copyright 2008 The OpenSAF Foundation + * Copyright (C) 2017, Oracle and/or its affiliates. All rights reserved. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY @@ -174,6 +175,10 @@ SaAisErrorT initialize_common(SaImmOiHan cl_node->isImmA2x10 = true; if (requested_version.minorVersion >= 0x11) { cl_node->isImmA2x11 = true; + if (requested_version.minorVersion >= 0x12) { + cl_node->isImmA2x12 = true; + } + } } } @@ -249,6 +254,11 @@ SaAisErrorT initialize_common(SaImmOiHan TRACE_2("ERR_TRY_AGAIN: IMMND is DOWN"); goto mds_fail; } + if(cl_node->isImmA2x12 && !cb->clmMemberNode){ + TRACE_2("SA_AIS_ERR_UNAVAILABLE: imma CLM node left the cluster"); + rc = SA_AIS_ERR_UNAVAILABLE; + goto clm_left; + } /* send the request to the IMMND */ proc_rc = imma_mds_msg_sync_send(cb->imma_mds_hdl, &cb->immnd_mds_dest, &init_evt, &out_evt, @@ -269,6 +279,12 @@ SaAisErrorT initialize_common(SaImmOiHan if (out_evt) { rc = out_evt->info.imma.info.initRsp.error; + if (rc == SA_AIS_ERR_UNAVAILABLE && cl_node->isImmA2x12){ + cb->clmMemberNode = false; + TRACE(" Node left the CLM membership"); + goto rsp_not_ok; + } + if (rc != SA_AIS_OK) { goto rsp_not_ok; } @@ -347,7 +363,9 @@ SaAisErrorT initialize_common(SaImmOiHan free(out_evt1); } } - + TRACE_2("OI client version A.2.%u", requested_version.minorVersion); + + clm_left: rsp_not_ok: mds_fail: @@ -445,6 +463,11 @@ SaAisErrorT saImmOiSelectionObjectGet(Sa rc = SA_AIS_ERR_BAD_HANDLE; goto node_not_found; } + if(cl_node->isImmA2x12 && cl_node->clmExposed){ + TRACE_2("SA_AIS_ERR_UNAVAILABLE: imma CLM node left the cluster"); + rc = SA_AIS_ERR_UNAVAILABLE; + goto clm_left; + } if (cl_node->stale) { TRACE_1("Handle %llx is stale", immOiHandle); @@ -479,6 +502,7 @@ SaAisErrorT saImmOiSelectionObjectGet(Sa cl_node->selObjUsable = true; + clm_left: node_not_found: resurrect_failed: if (locked) @@ -535,6 +559,12 @@ SaAisErrorT saImmOiDispatch(SaImmOiHandl goto fail; } + if(cl_node->isImmA2x12 && cl_node->clmExposed){ + TRACE_2("SA_AIS_ERR_UNAVAILABLE: imma CLM node left the cluster"); + rc = SA_AIS_ERR_UNAVAILABLE; + goto clm_left; + } + if (cl_node->stale) { TRACE_1("Handle %llx is stale, trying to resurrect it.", immOiHandle); @@ -625,6 +655,7 @@ SaAisErrorT saImmOiDispatch(SaImmOiHandl pend_dis = cb->pend_dis; pend_fin = cb->pend_fin; + clm_left: fail: if (locked) m_NCS_UNLOCK(&cb->cb_lock, NCS_LOCK_WRITE); @@ -934,6 +965,11 @@ static SaAisErrorT admin_op_result_commo LOG_IN("ERR_BAD_HANDLE: client_node_get failed"); goto node_not_found; } + if(cl_node->isImmA2x12 && cl_node->clmExposed){ + TRACE_2("SA_AIS_ERR_UNAVAILABLE: imma CLM node left the cluster"); + rc = SA_AIS_ERR_UNAVAILABLE; + goto clm_left; + } if (cl_node->stale) { TRACE_1("Handle %llx is stale", immOiHandle); @@ -1128,9 +1164,9 @@ static SaAisErrorT admin_op_result_commo free(p); /*free-a */ } + clm_left: stale_handle: node_not_found: - if (locked) m_NCS_UNLOCK(&cb->cb_lock, NCS_LOCK_WRITE); @@ -1214,6 +1250,11 @@ SaAisErrorT saImmOiImplementerSet(SaImmO TRACE_2("ERR_BAD_HANDLE: client_node_get failed"); goto bad_handle; } + if(cl_node->isImmA2x12 && cl_node->clmExposed){ + TRACE_2("SA_AIS_ERR_UNAVAILABLE: imma CLM node left the cluster"); + rc = SA_AIS_ERR_UNAVAILABLE; + goto clm_left; + } if (cl_node->mImplementerId) { rc = SA_AIS_ERR_INVALID_PARAM; @@ -1437,6 +1478,7 @@ SaAisErrorT saImmOiImplementerSet(SaImmO cl_node->isPbe = 0x0; } + clm_left: bad_handle: if (locked) m_NCS_UNLOCK(&cb->cb_lock, NCS_LOCK_WRITE); @@ -1497,6 +1539,11 @@ SaAisErrorT saImmOiImplementerClear(SaIm rc = SA_AIS_ERR_BAD_HANDLE; goto bad_handle; } + if(cl_node->isImmA2x12 && cl_node->clmExposed){ + TRACE_2("SA_AIS_ERR_UNAVAILABLE: imma CLM node left the cluster"); + rc = SA_AIS_ERR_UNAVAILABLE; + goto clm_left; + } if (cl_node->mImplementerId == 0) { rc = SA_AIS_ERR_BAD_HANDLE; @@ -1587,6 +1634,7 @@ SaAisErrorT saImmOiImplementerClear(SaIm cl_node->isApplier = 0; } + clm_left: bad_handle: if (locked) m_NCS_UNLOCK(&cb->cb_lock, NCS_LOCK_WRITE); @@ -1660,6 +1708,11 @@ SaAisErrorT saImmOiClassImplementerSet(S rc = SA_AIS_ERR_BAD_HANDLE; goto bad_handle; } + if(cl_node->isImmA2x12 && cl_node->clmExposed){ + TRACE_2("SA_AIS_ERR_UNAVAILABLE: imma CLM node left the cluster"); + rc = SA_AIS_ERR_UNAVAILABLE; + goto clm_left; + } if (cl_node->stale) { TRACE_1("Handle %llx is stale", immOiHandle); @@ -1769,6 +1822,7 @@ SaAisErrorT saImmOiClassImplementerSet(S fevs_error: bad_handle: + clm_left: if (locked) m_NCS_UNLOCK(&cb->cb_lock, NCS_LOCK_WRITE); @@ -1840,6 +1894,11 @@ SaAisErrorT saImmOiClassImplementerRelea rc = SA_AIS_ERR_BAD_HANDLE; goto bad_handle; } + if(cl_node->isImmA2x12 && cl_node->clmExposed){ + TRACE_2("SA_AIS_ERR_UNAVAILABLE: imma CLM node left the cluster"); + rc = SA_AIS_ERR_UNAVAILABLE; + goto clm_left; + } if (cl_node->stale) { TRACE_1("Handle %llx is stale", immOiHandle); @@ -1937,7 +1996,7 @@ SaAisErrorT saImmOiClassImplementerRelea osafassert(out_evt->info.imma.type == IMMA_EVT_ND2A_IMM_ERROR); rc = out_evt->info.imma.info.errRsp.error; - + clm_left: fevs_error: bad_handle: if (locked) @@ -2484,6 +2543,11 @@ static SaAisErrorT rt_object_update_comm TRACE_2("ERR_VERSION: saImmOiRtObjectUpdate_o3 is supported from A.2.15"); goto bad_handle; } + if(cl_node->isImmA2x12 && cl_node->clmExposed){ + TRACE_2("SA_AIS_ERR_UNAVAILABLE: imma CLM node left the cluster"); + rc = SA_AIS_ERR_UNAVAILABLE; + goto clm_left; + } if (cl_node->stale) { TRACE_1("Handle %llx is stale", immOiHandle); @@ -2674,6 +2738,7 @@ static SaAisErrorT rt_object_update_comm } } + clm_left: skip_over_send: bad_sync: bad_handle1: @@ -2803,6 +2868,11 @@ static SaAisErrorT rt_object_create_comm TRACE_2("ERR_VERSION: saImmOiRtObjectCreate_o3 is supported from A.2.15"); goto bad_handle; } + if(cl_node->isImmA2x12 && cl_node->clmExposed){ + TRACE_2("SA_AIS_ERR_UNAVAILABLE: imma CLM node left the cluster"); + rc = SA_AIS_ERR_UNAVAILABLE; + goto clm_left; + } if (cl_node->stale) { TRACE_1("Handle %llx is stale", immOiHandle); @@ -3049,7 +3119,7 @@ static SaAisErrorT rt_object_create_comm p->next = NULL; free(p); /*free-3 */ } - + clm_left: bad_handle: if (locked) { m_NCS_UNLOCK(&cb->cb_lock, NCS_LOCK_WRITE); @@ -3147,6 +3217,11 @@ static SaAisErrorT rt_object_delete_comm TRACE_2("ERR_VERSION: saImmOiRtObjectDelete_o3 is supported from A.2.15"); goto bad_handle; } + if(cl_node->isImmA2x12 && cl_node->clmExposed){ + TRACE_2("SA_AIS_ERR_UNAVAILABLE: imma CLM node left the cluster"); + rc = SA_AIS_ERR_UNAVAILABLE; + goto clm_left; + } if (cl_node->stale) { TRACE_1("Handle %llx is stale", immOiHandle); @@ -3244,6 +3319,7 @@ static SaAisErrorT rt_object_delete_comm osafassert(out_evt->info.imma.type == IMMA_EVT_ND2A_IMM_ERROR); rc = out_evt->info.imma.info.errRsp.error; + clm_left: fevs_error: bad_handle: if (locked) @@ -3487,6 +3563,11 @@ SaAisErrorT saImmOiCcbSetErrorString( TRACE_2("ERR_BAD_HANDLE: client_node_get failed"); goto bad_handle; } + if(cl_node->isImmA2x12 && cl_node->clmExposed){ + TRACE_2("SA_AIS_ERR_UNAVAILABLE: imma CLM node left the cluster"); + rc = SA_AIS_ERR_UNAVAILABLE; + goto clm_left; + } if (cl_node->stale) { TRACE_1("Handle %llx is stale", immOiHandle); @@ -3529,6 +3610,7 @@ SaAisErrorT saImmOiCcbSetErrorString( goto bad_handle; } + clm_left: bad_handle: if (locked) m_NCS_UNLOCK(&cb->cb_lock, NCS_LOCK_WRITE); @@ -3696,6 +3778,11 @@ SaAisErrorT saImmOiAugmentCcbInitialize( rc = SA_AIS_ERR_BAD_HANDLE; goto done; } + if(cl_node->isImmA2x12 && cl_node->clmExposed){ + TRACE_2("SA_AIS_ERR_UNAVAILABLE: imma CLM node left the cluster"); + rc = SA_AIS_ERR_UNAVAILABLE; + goto clm_left; + } if (cl_node->stale) { TRACE_1("ERR_BAD_HANDLE: Handle %llx is stale", immOiHandle); @@ -3877,6 +3964,7 @@ SaAisErrorT saImmOiAugmentCcbInitialize( osafassert(immsv_om_augment_ccb_initialize); rc = immsv_om_augment_ccb_initialize(privateOmHandle, ccbId, adminOwnerId, ccbHandle, &privateAoHandle); +clm_left: done: if (locked) { diff --git a/src/imm/agent/imma_om_api.cc b/src/imm/agent/imma_om_api.cc --- a/src/imm/agent/imma_om_api.cc +++ b/src/imm/agent/imma_om_api.cc @@ -2,6 +2,7 @@ * * (C) Copyright 2008 The OpenSAF Foundation * Copyright Ericsson AB 2009, 2017 - All Rights Reserved. + * Copyright (C) 2017, Oracle and/or its affiliates. All rights reserved. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY @@ -136,6 +137,10 @@ SaAisErrorT saImmOmInitialize_o2(SaImmHa cl_node->isImmA2x10 = true; if (requested_version.minorVersion >= 0x11) { cl_node->isImmA2x11 = true; + if (requested_version.minorVersion >= 0x12) { + cl_node->isImmA2x12 = true; + TRACE("DBG: version A.2.18 is set"); + } } } } @@ -196,6 +201,10 @@ SaAisErrorT saImmOmInitialize(SaImmHandl cl_node->isImmA2x10 = true; if (requested_version.minorVersion >= 0x11) { cl_node->isImmA2x11 = true; + if (requested_version.minorVersion >= 0x12) { + cl_node->isImmA2x12 = true; + TRACE("DBG: version A.2.18 is set"); + } } } } @@ -241,6 +250,12 @@ static SaAisErrorT initialize_common(SaI goto end; } + if(cl_node->isImmA2x12 && !cb->clmMemberNode){ + TRACE_2("SA_AIS_ERR_UNAVAILABLE: imma CLM node left the cluster"); + rc = SA_AIS_ERR_UNAVAILABLE; + goto clm_left; + } + if((timeout_env_value = getenv("IMMA_SYNCR_TIMEOUT"))!=NULL) { cl_node->syncr_timeout = atoi(timeout_env_value); TRACE_2("IMMA library syncronous timeout set to:%lld", cl_node->syncr_timeout); @@ -310,6 +325,12 @@ static SaAisErrorT initialize_common(SaI if (out_evt) { rc = out_evt->info.imma.info.initRsp.error; + if (rc == SA_AIS_ERR_UNAVAILABLE && cl_node->isImmA2x12){ + cb->clmMemberNode = false; + TRACE(" Node left the CLM membership"); + goto rsp_not_ok; + } + if (rc != SA_AIS_OK) { goto rsp_not_ok; } @@ -403,6 +424,7 @@ static SaAisErrorT initialize_common(SaI out_evt1 =NULL; } } + TRACE("OM client version A.2.%u", version->minorVersion); rsp_not_ok: mds_fail: @@ -426,6 +448,7 @@ static SaAisErrorT initialize_common(SaI *immHandle = cl_node->handle; } + clm_left: end: if (rc != SA_AIS_OK) { if (NCSCC_RC_SUCCESS != imma_shutdown(NCSMDS_SVC_ID_IMMA_OM)) { @@ -514,7 +537,12 @@ SaAisErrorT saImmOmSelectionObjectGet(Sa goto no_callback; } } - + if(cl_node->isImmA2x12 && cl_node->clmExposed){ + TRACE_2("SA_AIS_ERR_UNAVAILABLE: imma CLM node left the cluster"); + rc = SA_AIS_ERR_UNAVAILABLE; + goto clm_left; + } + if (cl_node->stale) { TRACE_1("Handle %llx is stale", immHandle); bool resurrected = imma_om_resurrect(cb, cl_node, &locked); @@ -543,6 +571,7 @@ SaAisErrorT saImmOmSelectionObjectGet(Sa cl_node->selObjUsable = true; + clm_left: no_callback: stale_handle: node_not_found: @@ -600,6 +629,11 @@ SaAisErrorT saImmOmDispatch(SaImmHandleT rc = SA_AIS_ERR_BAD_HANDLE; goto fail; } + if(cl_node->isImmA2x12 && cl_node->clmExposed){ + TRACE_2("SA_AIS_ERR_UNAVAILABLE: imma CLM node left the cluster"); + rc = SA_AIS_ERR_UNAVAILABLE; + goto clm_left; + } if (cl_node->stale) { TRACE_1("Handle %llx is stale, trying to resurrect it.", immHandle); @@ -688,6 +722,7 @@ SaAisErrorT saImmOmDispatch(SaImmHandleT pend_dis = cb->pend_dis; pend_fin = cb->pend_fin; + clm_left: fail: if (locked) m_NCS_UNLOCK(&cb->cb_lock, NCS_LOCK_WRITE); @@ -974,6 +1009,11 @@ SaAisErrorT saImmOmAdminOwnerInitialize( TRACE_2("ERR_BAD_HANDLE: client_node_get failed"); goto bad_handle; } + if(cl_node->isImmA2x12 && cl_node->clmExposed){ + TRACE_2("SA_AIS_ERR_UNAVAILABLE: imma CLM node left the cluster"); + rc = SA_AIS_ERR_UNAVAILABLE; + goto clm_left; + } if (cl_node->stale) { TRACE_1("Handle %llx is stale", immHandle); @@ -1155,6 +1195,7 @@ SaAisErrorT saImmOmAdminOwnerInitialize( ao_node_alloc_fail: /* Do Nothing */ + clm_left: bad_handle: if (locked) m_NCS_UNLOCK(&cb->cb_lock, NCS_LOCK_WRITE); @@ -1378,6 +1419,12 @@ SaAisErrorT saImmOmCcbInitialize(SaImmAd goto done; } + if(cl_node->isImmA2x12 && cl_node->clmExposed){ + TRACE_2("SA_AIS_ERR_UNAVAILABLE: imma CLM node left the cluster"); + rc = SA_AIS_ERR_UNAVAILABLE; + goto clm_left; + } + if (cl_node->stale) { TRACE_1("IMM Handle %llx is stale", immHandle); bool resurrected = imma_om_resurrect(cb, cl_node, &locked); @@ -1536,6 +1583,7 @@ SaAisErrorT saImmOmCcbInitialize(SaImmAd ccb_node = NULL; } + clm_left: done: if (locked) m_NCS_UNLOCK(&cb->cb_lock, NCS_LOCK_WRITE); @@ -1687,6 +1735,11 @@ static SaAisErrorT ccb_object_create_com "A.02.15 and above"); goto done; } + if(cl_node->isImmA2x12 && cl_node->clmExposed){ + TRACE_2("SA_AIS_ERR_UNAVAILABLE: imma CLM node left the cluster"); + rc = SA_AIS_ERR_UNAVAILABLE; + goto clm_left; + } if (cl_node->stale) { TRACE_1("IMM Handle %llx is stale", immHandle); @@ -2106,7 +2159,7 @@ static SaAisErrorT ccb_object_create_com ccb_node->mAborted = true; } - + clm_left: done: imma_free_errorStrings(newErrorStrings); /* In case of failed resurrect only */ @@ -2279,6 +2332,11 @@ static SaAisErrorT ccb_object_modify_com "A.02.15 and above"); goto done; } + if(cl_node->isImmA2x12 && cl_node->clmExposed){ + TRACE_2("SA_AIS_ERR_UNAVAILABLE: imma CLM node left the cluster"); + rc = SA_AIS_ERR_UNAVAILABLE; + goto clm_left; + } if (cl_node->stale) { TRACE_1("IMM Handle %llx is stale", immHandle); @@ -2604,6 +2662,7 @@ static SaAisErrorT ccb_object_modify_com ccb_node->mAborted = true; } + clm_left: done: imma_free_errorStrings(newErrorStrings); /* In case of failed resurrect only */ @@ -2756,6 +2815,11 @@ static SaAisErrorT ccb_object_delete_com "A.02.15 and above"); goto done; } + if(cl_node->isImmA2x12 && cl_node->clmExposed){ + TRACE_2("SA_AIS_ERR_UNAVAILABLE: imma CLM node left the cluster"); + rc = SA_AIS_ERR_UNAVAILABLE; + goto clm_left; + } if (cl_node->stale) { TRACE_1("IMM Handle %llx is stale exposed?:%u", immHandle, cl_node->exposed); @@ -2988,6 +3052,7 @@ static SaAisErrorT ccb_object_delete_com ccb_node->mAborted = true; } + clm_left: done: imma_free_errorStrings(newErrorStrings); /* In case of failed resurrect only */ @@ -3115,6 +3180,11 @@ SaAisErrorT imma_applyCcb(SaImmCcbHandle ccb_node->mCcbId); goto done; } + if(cl_node->isImmA2x12 && cl_node->clmExposed){ + TRACE_2("SA_AIS_ERR_UNAVAILABLE: imma CLM node left the cluster"); + rc = SA_AIS_ERR_UNAVAILABLE; + goto clm_left; + } if (cl_node->stale || !(cb->is_immnd_up)) { TRACE_3("ERR_FAILED_OPERATION: IMMND DOWN and/or IMM Handle %llx " @@ -3425,7 +3495,7 @@ SaAisErrorT imma_applyCcb(SaImmCcbHandle ccb_node->mAborted = true; } - + clm_left: done: imma_free_errorStrings(newErrorStrings); /* In case of failed resurrect only */ @@ -3759,6 +3829,11 @@ static SaAisErrorT admin_op_invoke_commo "A.02.15 and above"); goto client_not_found; } + if(cl_node->isImmA2x12 && cl_node->clmExposed){ + TRACE_2("SA_AIS_ERR_UNAVAILABLE: imma CLM node left the cluster"); + rc = SA_AIS_ERR_UNAVAILABLE; + goto clm_left; + } if (cl_node->stale) { TRACE_1("IMM Handle %llx is stale", immHandle); @@ -3998,7 +4073,7 @@ static SaAisErrorT admin_op_invoke_commo } - + clm_left: ao_not_found: client_not_found: stale_handle: @@ -4070,6 +4145,11 @@ SaAisErrorT saImmOmAdminOperationMemoryF rc = SA_AIS_ERR_BAD_HANDLE; goto done; } + if(cl_node->isImmA2x12 && cl_node->clmExposed){ + TRACE_2("SA_AIS_ERR_UNAVAILABLE: imma CLM node left the cluster"); + rc = SA_AIS_ERR_UNAVAILABLE; + goto clm_left; + } if (cl_node->stale) { TRACE_1("IMM Handle %llx is stale - ignoring", immHandle); @@ -4100,6 +4180,7 @@ SaAisErrorT saImmOmAdminOperationMemoryF free(returnParams); } + clm_left: done: if (locked) { m_NCS_UNLOCK(&cb->cb_lock, NCS_LOCK_WRITE); @@ -4301,6 +4382,11 @@ static SaAisErrorT admin_op_invoke_async "A.02.15 and above"); goto client_not_found; } + if(cl_node->isImmA2x12 && cl_node->clmExposed){ + TRACE_2("SA_AIS_ERR_UNAVAILABLE: imma CLM node left the cluster"); + rc = SA_AIS_ERR_UNAVAILABLE; + goto clm_left; + } if (cl_node->stale) { TRACE_1("IMM Handle %llx is stale", immHandle); @@ -4486,6 +4572,7 @@ static SaAisErrorT admin_op_invoke_async /* Note the imma_proc_decrement_pending_reply is done in the OM upcall with the reply for the asyncronous operation. */ + clm_left: ao_not_found: client_not_found: stale_handle: @@ -4702,6 +4789,11 @@ SaAisErrorT saImmOmClassCreate_2(SaImmHa rc = SA_AIS_ERR_BAD_HANDLE; goto client_not_found; } + if(cl_node->isImmA2x12 && cl_node->clmExposed){ + TRACE_2("SA_AIS_ERR_UNAVAILABLE: imma CLM node left the cluster"); + rc = SA_AIS_ERR_UNAVAILABLE; + goto clm_left; + } if (cl_node->stale) { TRACE_1("IMM Handle %llx is stale", immHandle); @@ -4957,6 +5049,7 @@ SaAisErrorT saImmOmClassCreate_2(SaImmHa cl_node->exposed = true; } + clm_left: client_not_found: stale_handle: bad_sync: @@ -5011,6 +5104,11 @@ SaAisErrorT saImmOmClassDescriptionGet_2 rc = SA_AIS_ERR_BAD_HANDLE; goto client_not_found; } + if(cl_node->isImmA2x12 && cl_node->clmExposed){ + TRACE_2("SA_AIS_ERR_UNAVAILABLE: imma CLM node left the cluster"); + rc = SA_AIS_ERR_UNAVAILABLE; + goto clm_left; + } if (cl_node->stale) { TRACE_1("IMM Handle %llx is stale", immHandle); @@ -5285,6 +5383,7 @@ SaAisErrorT saImmOmClassDescriptionGet_2 cl_node->exposed = true; } + clm_left: client_not_found: stale_handle: bad_sync: @@ -5341,6 +5440,13 @@ SaAisErrorT saImmOmClassDescriptionMemor return SA_AIS_ERR_BAD_HANDLE; } + if(cl_node->isImmA2x12 && cl_node->clmExposed){ + TRACE_2("SA_AIS_ERR_UNAVAILABLE: imma CLM node left the cluster"); + m_NCS_UNLOCK(&cb->cb_lock, NCS_LOCK_WRITE); + TRACE_LEAVE(); + return SA_AIS_ERR_UNAVAILABLE; + } + if (cl_node->stale) { TRACE_1("IMM Handle %llx is stale - ignoring", immHandle); /*return SA_AIS_ERR_BAD_HANDLE;*/ @@ -5406,6 +5512,11 @@ SaAisErrorT saImmOmClassDelete(SaImmHand rc = SA_AIS_ERR_BAD_HANDLE; goto client_not_found; } + if(cl_node->isImmA2x12 && cl_node->clmExposed){ + TRACE_2("SA_AIS_ERR_UNAVAILABLE: imma CLM node left the cluster"); + rc = SA_AIS_ERR_UNAVAILABLE; + goto clm_left; + } if (cl_node->stale) { TRACE_1("IMM Handle %llx is stale", immHandle); @@ -5494,6 +5605,7 @@ SaAisErrorT saImmOmClassDelete(SaImmHand cl_node->exposed = true; } + clm_left: stale_handle: client_not_found: bad_sync: @@ -5544,7 +5656,12 @@ SaAisErrorT saImmOmAccessorInitialize(Sa rc = SA_AIS_ERR_BAD_HANDLE; goto release_lock; } - + if(cl_node->isImmA2x12 && cl_node->clmExposed){ + TRACE_2("SA_AIS_ERR_UNAVAILABLE: imma CLM node left the cluster"); + rc = SA_AIS_ERR_UNAVAILABLE; + goto clm_left; + } + if (cl_node->stale) { TRACE_1("IMM Handle %llx is stale", immHandle); bool resurrected = imma_om_resurrect(cb, cl_node, &locked); @@ -5606,6 +5723,7 @@ SaAisErrorT saImmOmAccessorInitialize(Sa *accessorHandle = search_node->search_hdl; cl_node->searchHandleSize++; + clm_left: release_lock: if (locked) { m_NCS_UNLOCK(&cb->cb_lock, NCS_LOCK_WRITE); @@ -5657,6 +5775,13 @@ SaAisErrorT saImmOmAccessorFinalize(SaIm search_node->mLastObjectName = NULL; immHandle = search_node->mImmHandle; + imma_client_node_get(&cb->client_tree, &immHandle, &cl_node); + if(cl_node->isImmA2x12 && cl_node->clmExposed){ + TRACE_2("SA_AIS_ERR_UNAVAILABLE: imma CLM node left the cluster"); + rc = SA_AIS_ERR_UNAVAILABLE; + goto clm_left; + } + proc_rc = imma_search_node_delete(cb, search_node); search_node = NULL; if (proc_rc != NCSCC_RC_SUCCESS) { @@ -5664,7 +5789,6 @@ SaAisErrorT saImmOmAccessorFinalize(SaIm rc = SA_AIS_ERR_LIBRARY; } else { /* Decrease number of search handles per IMM handle */ - imma_client_node_get(&cb->client_tree, &immHandle, &cl_node); if (cl_node && cl_node->isOm) { /* TODO: Is osafassert(cl_node && cl_node->isOm) better solution */ osafassert(cl_node->searchHandleSize); cl_node->searchHandleSize--; @@ -5674,6 +5798,7 @@ SaAisErrorT saImmOmAccessorFinalize(SaIm } } + clm_left: release_lock: if (locked) { m_NCS_UNLOCK(&cb->cb_lock, NCS_LOCK_WRITE); @@ -5827,7 +5952,12 @@ static SaAisErrorT accessor_get_common(S if(ccbId) { TRACE_2("This is a SAFE read, ccbId:%u", ccbId); } - + if(cl_node->isImmA2x12 && cl_node->clmExposed){ + TRACE_2("SA_AIS_ERR_UNAVAILABLE: imma CLM node left the cluster"); + rc = SA_AIS_ERR_UNAVAILABLE; + goto clm_left; + } + if (cl_node->stale) { TRACE_1("IMM Handle %llx is stale", immHandle); bool resurrected = imma_om_resurrect(cb, cl_node, &locked); @@ -6073,6 +6203,7 @@ mds_send_fail: } /*error cases only */ + clm_left: release_lock: if (locked) { m_NCS_UNLOCK(&cb->cb_lock, NCS_LOCK_WRITE); @@ -6293,7 +6424,12 @@ SaAisErrorT saImmOmCcbObjectRead(SaImmCc TRACE_4("ERR_LIBRARY: No valid SaImmHandleT associated with Ccb"); goto done; } - + if(cl_node->isImmA2x12 && cl_node->clmExposed){ + TRACE_2("SA_AIS_ERR_UNAVAILABLE: imma CLM node left the cluster"); + rc = SA_AIS_ERR_UNAVAILABLE; + goto clm_left; + } + if(!cl_node->isImmA2x11) { rc = SA_AIS_ERR_VERSION; TRACE_2("ERR_VERSION: saImmOmCcbObjectRead only supported for " @@ -6532,6 +6668,7 @@ SaAisErrorT saImmOmCcbObjectRead(SaImmCc rc = accessor_get_common(accessorHandle, objectName, attributeNames, attributes, true, ccbId); } + clm_left: done: //imma_free_errorStrings(newErrorStrings); /* In case of failed resurrect only */ @@ -7066,7 +7203,12 @@ static SaAisErrorT search_init_common(Sa "A.02.15 and above"); goto release_lock; } - + if(cl_node->isImmA2x12 && cl_node->clmExposed){ + TRACE_2("SA_AIS_ERR_UNAVAILABLE: imma CLM node left the cluster"); + rc = SA_AIS_ERR_UNAVAILABLE; + goto clm_left; + } + if (cl_node->stale) { TRACE_1("IMM Handle %llx is stale", immHandle); bool resurrected = imma_om_resurrect(cb, cl_node, &locked); @@ -7402,12 +7544,12 @@ static SaAisErrorT search_init_common(Sa /*Node never added to tree */ free(search_node); } - + clm_left: release_lock: if (locked) { m_NCS_UNLOCK(&cb->cb_lock, NCS_LOCK_WRITE); } -lock_fail: + lock_fail: if(out_evt) { free(out_evt); out_evt=NULL; @@ -7532,6 +7674,12 @@ static SaAisErrorT search_next_common(Sa goto release_lock; } + if(cl_node->isImmA2x12 && cl_node->clmExposed){ + TRACE_2("SA_AIS_ERR_UNAVAILABLE: imma CLM node left the cluster"); + error = SA_AIS_ERR_UNAVAILABLE; + goto clm_left; + } + if (cl_node->stale) { TRACE_3("ERR_BAD_HANDLE: IMM Handle %llx is stale", immHandle); cl_node->exposed = true; @@ -7770,6 +7918,7 @@ searchresult: free(searchBundle); } + clm_left: release_lock: if (locked) { m_NCS_UNLOCK(&cb->cb_lock, NCS_LOCK_WRITE); @@ -7848,7 +7997,12 @@ SaAisErrorT saImmOmSearchFinalize(SaImmS TRACE_4("ERR_LIBRARY: Invalid SaImmHandleT related to search handle"); goto release_lock; } - + if(cl_node->isImmA2x12 && cl_node->clmExposed){ + TRACE_2("SA_AIS_ERR_UNAVAILABLE: imma CLM node left the cluster"); + error = SA_AIS_ERR_UNAVAILABLE; + goto clm_left; + } + if (cl_node->stale) { TRACE_1("IMM Handle %llx is stale", immHandle); error = SA_AIS_OK; /*Dont punish the client for closing stale handle */ @@ -7943,6 +8097,7 @@ SaAisErrorT saImmOmSearchFinalize(SaImmS } } + clm_left: mds_failed: release_lock: if (locked) { @@ -8098,7 +8253,12 @@ static SaAisErrorT admin_owner_set_commo "A.02.15 and above"); goto done; } - + if(cl_node->isImmA2x12 && cl_node->clmExposed){ + TRACE_2("SA_AIS_ERR_UNAVAILABLE: imma CLM node left the cluster"); + rc = SA_AIS_ERR_UNAVAILABLE; + goto clm_left; + } + if (cl_node->stale) { TRACE_1("IMM Handle %llx is stale", immHandle); bool resurrected = imma_om_resurrect(cb, cl_node, &locked); @@ -8197,6 +8357,7 @@ static SaAisErrorT admin_owner_set_commo /* Ignore possibly stale handle, will be discovered in next op. */ + clm_left: done: if (locked) m_NCS_UNLOCK(&cb->cb_lock, NCS_LOCK_WRITE); @@ -8563,7 +8724,12 @@ static SaAisErrorT admin_owner_clear_com "A.02.15 and above"); goto done; } - + if(cl_node->isImmA2x12 && cl_node->clmExposed){ + TRACE_2("SA_AIS_ERR_UNAVAILABLE: imma CLM node left the cluster"); + rc = SA_AIS_ERR_UNAVAILABLE; + goto clm_left; + } + if (cl_node->stale) { TRACE_1("IMM Handle %llx is stale", immHandle); bool resurrected = imma_om_resurrect(cb, cl_node, &locked); @@ -8655,6 +8821,7 @@ static SaAisErrorT admin_owner_clear_com /* Ignore possibly stale handle */ + clm_left: done: if (locked) m_NCS_UNLOCK(&cb->cb_lock, NCS_LOCK_WRITE); @@ -8719,6 +8886,11 @@ SaAisErrorT saImmOmAdminOwnerFinalize(Sa TRACE_4("ERR_LIBRARY: Admin owner associated with closed client"); goto done; } + if(cl_node->isImmA2x12 && cl_node->clmExposed){ + TRACE_2("SA_AIS_ERR_UNAVAILABLE: imma CLM node left the cluster"); + rc = SA_AIS_ERR_UNAVAILABLE; + goto clm_left; + } if (cl_node->stale) { TRACE_1("IMM Handle %llx is stale", immHandle); @@ -8788,6 +8960,7 @@ SaAisErrorT saImmOmAdminOwnerFinalize(Sa } } + clm_left: done: if (locked) m_NCS_UNLOCK(&cb->cb_lock, NCS_LOCK_WRITE); @@ -8888,7 +9061,12 @@ static SaAisErrorT imma_finalizeCcb(SaIm TRACE_4("ERR_LIBRARY: No valid SaImmHandleT associated with Ccb"); goto done; } - + if(cl_node->isImmA2x12 && cl_node->clmExposed){ + TRACE_2("SA_AIS_ERR_UNAVAILABLE: imma CLM node left the cluster"); + rc = SA_AIS_ERR_UNAVAILABLE; + goto clm_left; + } + if (cl_node->stale) { TRACE_1("IMM Handle %llx is stale", immHandle); rc = SA_AIS_OK; /*Dont punish the client for closing stale handle */ @@ -9033,7 +9211,8 @@ static SaAisErrorT imma_finalizeCcb(SaIm */ } } - + + clm_left: done: if (locked) { m_NCS_UNLOCK(&cb->cb_lock, NCS_LOCK_WRITE); diff --git a/src/imm/agent/imma_proc.cc b/src/imm/agent/imma_proc.cc --- a/src/imm/agent/imma_proc.cc +++ b/src/imm/agent/imma_proc.cc @@ -1,6 +1,7 @@ /* -*- OpenSAF -*- * * (C) Copyright 2008 The OpenSAF Foundation + * Copyright (C) 2017, Oracle and/or its affiliates. All rights reserved. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY @@ -1350,6 +1351,31 @@ void imma_proc_free_pointers(IMMA_CB *cb } /**************************************************************************** + Name : imma_proc_clm_status_changed + Description : This function will process the clm state changes. + Arguments : cb - IMMA CB. + evt - IMMA_EVT. + Return Values : None +******************************************************************************/ +static void imma_proc_clm_status_changed(IMMA_CB *cb, IMMA_EVT *evt) +{ + if (m_NCS_LOCK(&cb->cb_lock, NCS_LOCK_WRITE) != NCSCC_RC_SUCCESS) { + TRACE_3("Lock failure"); + return; + } + + if(evt->type == IMMA_EVT_ND2A_IMM_CLM_NODE_LEFT){ + cb->clmMemberNode = false; + LOG_NO("CLM node left the cluster"); + imma_client_tree_mark_clmexposed(cb); + } else if ( evt->type == IMMA_EVT_ND2A_IMM_CLM_NODE_JOINED){ + cb->clmMemberNode = true; + TRACE("CLM node join the cluster"); + } + m_NCS_UNLOCK(&cb->cb_lock, NCS_LOCK_WRITE); +} + +/**************************************************************************** Name : imma_process_evt Description : This routine will process the callback event received from IMMND. @@ -1417,6 +1443,11 @@ void imma_process_evt(IMMA_CB *cb, IMMSV imma_process_stale_clients(cb); break; + case IMMA_EVT_ND2A_IMM_CLM_NODE_LEFT: + case IMMA_EVT_ND2A_IMM_CLM_NODE_JOINED: + imma_proc_clm_status_changed(cb, &evt->info.imma); + break; + default: TRACE_4("Unknown event type %u", evt->info.imma.type); break; diff --git a/src/imm/common/immsv_api.h b/src/imm/common/immsv_api.h --- a/src/imm/common/immsv_api.h +++ b/src/imm/common/immsv_api.h @@ -1,6 +1,7 @@ /* -*- OpenSAF -*- * * (C) Copyright 2008 The OpenSAF Foundation + * Copyright (C) 2017, Oracle and/or its affiliates. All rights reserved. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY @@ -148,7 +149,7 @@ typedef enum { #define OPENSAF_IMM_FLAG_PRT47_ALLOW 0x00000040 #define OPENSAF_IMM_FLAG_PRT50_ALLOW 0x00000080 #define OPENSAF_IMM_FLAG_PRT51_ALLOW 0x00000100 - +#define OPENSAF_IMM_FLAG_PRT52_ALLOW 0x00000200 #define OPENSAF_IMM_SERVICE_NAME "safImmService" diff --git a/src/imm/common/immsv_evt.c b/src/imm/common/immsv_evt.c --- a/src/imm/common/immsv_evt.c +++ b/src/imm/common/immsv_evt.c @@ -1,6 +1,7 @@ /* -*- OpenSAF -*- * * (C) Copyright 2008 The OpenSAF Foundation + * Copyright (C) 2017, Oracle and/or its affiliates. All rights reserved. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY @@ -2798,6 +2799,13 @@ static uint32_t immsv_evt_enc_toplevel(I case IMMA_EVT_ND2A_IMM_SYNC_RSP: break; */ + + case IMMA_EVT_ND2A_IMM_CLM_NODE_LEFT: + case IMMA_EVT_ND2A_IMM_CLM_NODE_JOINED: + /* Noinformation is shared because of these evevts + encoding/decoding is not required */ + break; + default: LOG_ER("Illegal IMMA message type:%u", immaevt->type); rc = NCSCC_RC_OUT_OF_MEM; @@ -4203,6 +4211,13 @@ static uint32_t immsv_evt_dec_toplevel(N case IMMA_EVT_ND2A_IMM_SYNC_RSP: break; */ + + case IMMA_EVT_ND2A_IMM_CLM_NODE_LEFT: + case IMMA_EVT_ND2A_IMM_CLM_NODE_JOINED: + /* Noinformation is shared because of these evevts + encoding/decoding is not required */ + break; + default: LOG_ER("Illegal IMMA message type:%u", immaevt->type); rc = NCSCC_RC_FAILURE; diff --git a/src/imm/common/immsv_evt.h b/src/imm/common/immsv_evt.h --- a/src/imm/common/immsv_evt.h +++ b/src/imm/common/immsv_evt.h @@ -93,6 +93,8 @@ typedef enum imma_evt_type { IMMA_EVT_ND2A_OI_OBJ_CREATE_LONG_UC = 31, /*OBJ CREATE UP-CALL with long DN. */ IMMA_EVT_ND2A_OI_OBJ_MODIFY_LONG_UC = 32, /*OBJ MODIFY UP-CALL with long DN. */ IMMA_EVT_ND2A_OI_OBJ_DELETE_LONG_UC = 33, /*OBJ DELETE UP-CALL with long DN. */ + IMMA_EVT_ND2A_IMM_CLM_NODE_LEFT = 34, /* when clm-lock/clm-node left the cluster */ + IMMA_EVT_ND2A_IMM_CLM_NODE_JOINED = 35, /* when clm-lock/clm-node join the cluster */ IMMA_EVT_MAX } IMMA_EVT_TYPE; ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel