When called with a non-existing component name, saAmfComponentErrorClear_4 should return SA_AIS_ERR_NOT_EXIST instead of SA_AIS_ERR_BAD_OPERATION as previously done. --- src/amf/amfnd/err.cc | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/amf/amfnd/err.cc b/src/amf/amfnd/err.cc index e4cb9f0..a0529b9 100644 --- a/src/amf/amfnd/err.cc +++ b/src/amf/amfnd/err.cc @@ -2,6 +2,7 @@ * * (C) Copyright 2008 The OpenSAF Foundation * Copyright (C) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (C) 2017, Ericsson AB. 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 @@ -13,6 +14,7 @@ * licensing terms. * * Author(s): Emerson Network Power + * Ericsson * */ @@ -164,11 +166,12 @@ uint32_t avnd_evt_ava_err_rep_evh(AVND_CB *cb, AVND_EVT *evt) { } } - /* get the comp */ + /* check if component exists on local AvND node */ comp = avnd_compdb_rec_get(cb->compdb, Amf::to_string(&err_rep->err_comp)); - /* determine the error code, if any */ if (!comp) amf_rc = SA_AIS_ERR_NOT_EXIST; + /* determine other error codes, if any */ + /* We need not entertain errors when comp is not in shape */ if (comp && (m_AVND_COMP_PRES_STATE_IS_UNINSTANTIATED(comp) || m_AVND_COMP_PRES_STATE_IS_INSTANTIATIONFAILED(comp) || @@ -265,13 +268,15 @@ uint32_t avnd_evt_ava_err_clear_evh(AVND_CB *cb, AVND_EVT *evt) { } } - /* get the comp */ + /* check if component exists on local AvND node */ comp = avnd_compdb_rec_get(cb->compdb, Amf::to_string(&err_clear->comp_name)); + if (!comp) amf_rc = SA_AIS_ERR_NOT_EXIST; + + /* determine other error codes, if any */ - /* determine the error code, if any */ - if (!comp || !m_AVND_COMP_IS_REG(comp) || + if ((comp) && (!m_AVND_COMP_IS_REG(comp) || (!m_AVND_COMP_TYPE_IS_PREINSTANTIABLE(comp) && - !m_AVND_COMP_TYPE_IS_PROXIED(comp))) + !m_AVND_COMP_TYPE_IS_PROXIED(comp)))) amf_rc = SA_AIS_ERR_BAD_OPERATION; if ((comp) && m_AVND_COMP_OPER_STATE_IS_ENABLED(comp)) -- 2.7.4 ------------------------------------------------------------------------------ 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