osaf/services/saf/smfsv/smfd/SmfUpgradeStep.cc | 94 +++++++++++++++-------- osaf/services/saf/smfsv/smfd/SmfUpgradeStep.hh | 9 ++- osaf/services/saf/smfsv/smfd/smfd_campaign_oi.cc | 10 +-- 3 files changed, 71 insertions(+), 42 deletions(-)
When rebootAffectedNodes is enabled and sw bundles list it's own plmExecEnv nodes for specific sw bundles, the specified nodes are rebooted. diff --git a/osaf/services/saf/smfsv/smfd/SmfUpgradeStep.cc b/osaf/services/saf/smfsv/smfd/SmfUpgradeStep.cc --- a/osaf/services/saf/smfsv/smfd/SmfUpgradeStep.cc +++ b/osaf/services/saf/smfsv/smfd/SmfUpgradeStep.cc @@ -525,6 +525,15 @@ SmfUpgradeStep::removeSwNodeListDuplicat } //------------------------------------------------------------------------------ +// clearSwNodeList() +//------------------------------------------------------------------------------ +void +SmfUpgradeStep::clearSwNodeList() +{ + m_swNodeList.clear(); +} + +//------------------------------------------------------------------------------ // getSwNodeList() //------------------------------------------------------------------------------ const std::list<std::string> & @@ -1235,7 +1244,10 @@ bool SmfUpgradeStep::calculateSingleStep if (i_plmExecEnvList.empty()) { TRACE("No <plmExecEnv> was specified, use m_swNodeList"); - o_nodelist = m_swNodeList; + std::list<std::string>::iterator it; + for (it = m_swNodeList.begin(); it != m_swNodeList.end(); it++) { + o_nodelist.push_back(*it); + } } else { TRACE("<plmExecEnv> was specified, get the AMF nodes from the provided plmExecEnvList"); std::list<SmfPlmExecEnv>::const_iterator ee; @@ -1440,6 +1452,34 @@ SmfUpgradeStep::calculateStepType() // *If SMF execute on the controller included, swap controllers // *Otherwise , node reboot step is selected. + //Find out which nodes are affected for each bundle, plmExecEnv overrides calc nodes + std::list < SmfBundleRef >::const_iterator bundleit; + std::list<std::string> swNodeList; //The total list of nodes + + //Find out which nodes was addressed for removal + for (bundleit = m_swRemoveList.begin(); bundleit != m_swRemoveList.end(); ++bundleit) { + if (!calculateSingleStepNodes(bundleit->getPlmExecEnvList(), swNodeList)) { + LOG_NO("Fail to calculate nodes for bundle [%s]", bundleit->getBundleDn().c_str()); + } + } + //Find out which nodes was addressed for installation + for (bundleit = m_swAddList.begin(); bundleit != m_swAddList.end(); ++bundleit) { + if (!calculateSingleStepNodes(bundleit->getPlmExecEnvList(), swNodeList)) { + LOG_NO("Fail to calculate nodes for bundle [%s]", bundleit->getBundleDn().c_str()); + } + } + + //Clear the nodelist. Calculated nodes will be copied in calculateSingleStepNodes() + //method for bundles without plmExecEnv list. + clearSwNodeList(); + + //The swNodeList contain no duplicates from method calculateSingleStepNodes() + //Rewrite the nodelist + std::list<std::string>::iterator strIter; + for ( strIter = swNodeList.begin(); strIter != swNodeList.end(); ++strIter) { + addSwNode(*strIter); + } + bool allControllersAffected = false; //Assume all controllers is not within the single step list of nodes int noOfAffectedControllers = 0; std::string matchingController; @@ -1452,6 +1492,7 @@ SmfUpgradeStep::calculateStepType() goto selectStepType; } + if (smfd_cb->smfClusterControllers[0] != NULL) { //Controller is configured //Count the number of controllers configured @@ -1847,32 +1888,22 @@ SmfUpgradeStep::callActivationCmd() not bound to a particular node, so the "i_node" will be empty. */ - std::list<SmfPlmExecEnv> plmExecEnvList; //The resulting PLM env list + //Find out which nodes are affected for each bundle, plmExecEnv overrides calc nodes + std::list < SmfBundleRef >::const_iterator bundleit; + std::list<std::string> swNodeList; //The total list of nodes - //Find out which nodes was addressed for installation and removal - for (bundleit = m_swRemoveList.begin(); bundleit != m_swRemoveList.end(); ++bundleit) { - std::list<SmfPlmExecEnv> tmp = bundleit->getPlmExecEnvList(); - std::list<SmfPlmExecEnv>::iterator it; - for (it = tmp.begin(); it != tmp.end(); ++it) { - plmExecEnvList.push_back(*it); - } - } - - for (bundleit = m_swAddList.begin(); bundleit != m_swAddList.end(); ++bundleit) { - std::list<SmfPlmExecEnv> tmp = bundleit->getPlmExecEnvList(); - std::list<SmfPlmExecEnv>::iterator it; - for (it = tmp.begin(); it != tmp.end(); ++it) { - plmExecEnvList.push_back(*it); - } - } - - //Translate the PLM exec env to AMF nodes - //Duplicates are removed in the calculateSingleStepNodes method - std::list<std::string> swNodeList; - if (!calculateSingleStepNodes(plmExecEnvList, swNodeList)) { - result = false; - goto done; - } + //Find out which nodes was addressed for removal + for (bundleit = m_swRemoveList.begin(); bundleit != m_swRemoveList.end(); ++bundleit) { + if (!calculateSingleStepNodes(bundleit->getPlmExecEnvList(), swNodeList)) { + LOG_NO("Fail to calculate nodes for bundle [%s]", bundleit->getBundleDn().c_str()); + } + } + //Find out which nodes was addressed for installation + for (bundleit = m_swAddList.begin(); bundleit != m_swAddList.end(); ++bundleit) { + if (!calculateSingleStepNodes(bundleit->getPlmExecEnvList(), swNodeList)) { + LOG_NO("Fail to calculate nodes for bundle [%s]", bundleit->getBundleDn().c_str()); + } + } std::list<std::string>::const_iterator n; for (n = swNodeList.begin(); n != swNodeList.end(); n++) { @@ -2230,6 +2261,10 @@ SmfUpgradeStep::nodeReboot() int localTimeout = 500; // 500 * 10 ms = 5 seconds SmfndNodeDest nodeDest; std::list<std::string> nodeList; + std::list<std::string>::iterator listIt; + std::list<SmfNodeUpInfo> rebootedNodeList; + std::list<SmfNodeUpInfo> cmdNodeList; + std::list<SmfNodeUpInfo>::iterator nodeIt; //Copy the step node/nodelist into a local node list if (getSwNode().length() == 0) { //Single step procedure @@ -2244,11 +2279,6 @@ SmfUpgradeStep::nodeReboot() return result; } - std::list<std::string>::iterator listIt; - std::list<SmfNodeUpInfo> rebootedNodeList; - std::list<SmfNodeUpInfo> cmdNodeList; - std::list<SmfNodeUpInfo>::iterator nodeIt; - //Order smf node director to reboot the node cmd = smfd_cb->smfNodeRebootCmd; @@ -2266,7 +2296,7 @@ SmfUpgradeStep::nodeReboot() command execution anyway so it doesn't nodeReboot()matter that the timeout is really long */ cmdrc = smfnd_exec_remote_cmd(cmd.c_str(), &nodeDest, cliTimeout, localTimeout); if (cmdrc != 0) { - LOG_NO("Reboot command [%s] on node [%s] failed rc=[%x], continue", cmd.c_str(), (*listIt).c_str(), cmdrc); + LOG_NO("Reboot command [%s] on node [%s] return rc=[%x], continue", cmd.c_str(), (*listIt).c_str(), cmdrc); } /* Save the nodename and node UP counter for later use */ diff --git a/osaf/services/saf/smfsv/smfd/SmfUpgradeStep.hh b/osaf/services/saf/smfsv/smfd/SmfUpgradeStep.hh --- a/osaf/services/saf/smfsv/smfd/SmfUpgradeStep.hh +++ b/osaf/services/saf/smfsv/smfd/SmfUpgradeStep.hh @@ -338,7 +338,14 @@ class SmfUpgradeStep { /// @return A list of DNs to AMF nodes /// const std::list<std::string> & getSwNodeList(); - + +/// +/// Purpose: Clear the list of nodes where sw should be added/removed (single step) +/// @param None +/// @return None +/// + void clearSwNodeList(); + /// /// Purpose: Set type of step /// @param type diff --git a/osaf/services/saf/smfsv/smfd/smfd_campaign_oi.cc b/osaf/services/saf/smfsv/smfd/smfd_campaign_oi.cc --- a/osaf/services/saf/smfsv/smfd/smfd_campaign_oi.cc +++ b/osaf/services/saf/smfsv/smfd/smfd_campaign_oi.cc @@ -1111,7 +1111,6 @@ uint32_t read_config_and_set_control_blo //If this routine is called early, it has showed the saClmNodeID attribute is empty //If empty wait a second and retry bool saClmNodeIDEmpty = true; - int retryCntr = 0; while (true == saClmNodeIDEmpty) { if (immutil.getChildrenAndAttrBySearchHandle("", immSearchHandle, SA_IMM_SUBTREE, (SaImmAttrNameT*)attributeNames, "SaClmNode") == false) { LOG_NO("getChildrenAndAttrBySearchHandle fail"); @@ -1125,16 +1124,9 @@ uint32_t read_config_and_set_control_blo const SaUint32T *nodeId = immutil_getUint32Attr((const SaImmAttrValuesT_2 **)attributes, "saClmNodeID", 0); if (nodeId == NULL) { (void) immutil_saImmOmSearchFinalize(immSearchHandle); - if (retryCntr >= 10) { //Retry 10 times - LOG_NO("Attribute saClmNodeID still empty, giving up"); - TRACE_LEAVE(); - return NCSCC_RC_FAILURE; - } - saClmNodeIDEmpty = true; //Continue in: while (true == saClmNodeIDEmpty) LOG_NO("Attribute saClmNodeID empty, wait and retry"); - struct timespec sleepTime = { 1, 0 }; //One second + struct timespec sleepTime = { 2, 0 }; //Two seconds osaf_nanosleep(&sleepTime); - retryCntr++; break; } saClmNodeIDEmpty = false; //Do not continue in: while (true == saClmNodeIDEmpty) } ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel