trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trinakrug <...@git.apache.org>
Subject [GitHub] trafodion pull request #1392: [TRAFODION-2881] HA fixes
Date Fri, 12 Jan 2018 17:13:47 GMT
Github user trinakrug commented on a diff in the pull request:

    https://github.com/apache/trafodion/pull/1392#discussion_r161276162
  
    --- Diff: core/sqf/monitor/linux/cmsh.cxx ---
    @@ -128,31 +168,97 @@ int CCmsh::GetClusterState( PhysicalNodeNameMap_t &physicalNodeMap
)
                 if (it != physicalNodeMap.end())
                 {
                    // TEST_POINT and Exclude List : to force state down on node name 
    -               const char *downNodeName = getenv( TP001_NODE_DOWN );
    -               const char *downNodeList = getenv( TRAF_EXCLUDE_LIST );
    -	       string downNodeString = " ";
    -	       if (downNodeList)
    -	       {
    -		 downNodeString += downNodeList;
    -	         downNodeString += " ";
    -	       }
    -	       string downNodeToFind = " ";
    -	       downNodeToFind += nodeName.c_str();
    -	       downNodeToFind += " ";
    -               if (((downNodeList != NULL) && 
    -		      strstr(downNodeString.c_str(),downNodeToFind.c_str())) ||
    -                   ( (downNodeName != NULL) && 
    -                     !strcmp( downNodeName, nodeName.c_str()) ))
    -              {
    -                   nodeState = StateDown;
    -              }
    -	   
    +                const char *downNodeName = getenv( TP001_NODE_DOWN );
    +                const char *downNodeList = getenv( TRAF_EXCLUDE_LIST );
    +                string downNodeString = " ";
    +                if (downNodeList)
    +                {
    +                    downNodeString += downNodeList;
    +                    downNodeString += " ";
    +                }
    +                string downNodeToFind = " ";
    +                downNodeToFind += nodeName.c_str();
    +                downNodeToFind += " ";
    +                if (((downNodeList != NULL) && 
    +                      strstr(downNodeString.c_str(),downNodeToFind.c_str())) ||
    +                    ((downNodeName != NULL) && 
    +                     !strcmp(downNodeName, nodeName.c_str())))
    +                {
    +                    nodeState = StateDown;
    +                }
    +          
                     // Set physical node state
                     physicalNode = it->second;
                     physicalNode->SetState( nodeState );
                 }
             }
    -    }	
    +    }  
    +
    +    TRACE_EXIT;
    +    return( rc );
    +}
    +
    +///////////////////////////////////////////////////////////////////////////////
    +//
    +// Function/Method: CCmsh::GetNodeState
    +//
    +// Description: Updates the state of the nodeName in the physicalNode passed in
    +//              as a parameter. Caller should ensure that the node names are already
    +//              present in the physicalNodeMap. 
    +//
    +// Return:
    +//        0 - success
    +//       -1 - failure
    +//
    +///////////////////////////////////////////////////////////////////////////////
    +int CCmsh::GetNodeState( char *name ,CPhysicalNode  *physicalNode )
    +{
    +    const char method_name[] = "CCmsh::GetNodeState";
    +    TRACE_ENTRY;
    +
    +    int rc;
    +
    +    rc = PopulateNodeState( name );
    +
    +    if ( rc != -1 )
    +    {
    +        // Parse each line extracting name and state
    +        string nodeName;
    +        NodeState_t nodeState;
    +        PhysicalNodeNameMap_t::iterator it;
    +        
    +        StringList_t::iterator    alit;
    +        for ( alit = nodeStateList_.begin(); alit != nodeStateList_.end() ; alit++ )
    +        {
    +            ParseNodeStatus( *alit, nodeName, nodeState );
    +
    +            // TEST_POINT and Exclude List : to force state down on node name 
    +            const char *downNodeName = getenv( TP001_NODE_DOWN );
    +            const char *downNodeList = getenv( TRAF_EXCLUDE_LIST );
    --- End diff --
    
    Is TRAF_EXCLUDE_LIST obsolete?


---

Mime
View raw message