CLM gets ip address and address family from MDS in node up event.
When node will join CLM cluster, CLM will update saClmNodeCurrAddress and
saClmNodeCurrAddressFamily in IMM.

Also changed permission of CLM tool commands.
---
 src/clm/clmd/clms_imm.c | 26 +++++++++++++++++++++++---
 src/clm/clmd/clms_mds.c | 35 +++++++++++++++++++++++++----------
 src/clm/tools/clm-adm   |  0
 src/clm/tools/clm-find  |  0
 src/clm/tools/clm-state |  0
 5 files changed, 48 insertions(+), 13 deletions(-)
 mode change 100644 => 100755 src/clm/tools/clm-adm
 mode change 100644 => 100755 src/clm/tools/clm-find
 mode change 100644 => 100755 src/clm/tools/clm-state

diff --git a/src/clm/clmd/clms_imm.c b/src/clm/clmd/clms_imm.c
index a363b50..296a536 100644
--- a/src/clm/clmd/clms_imm.c
+++ b/src/clm/clmd/clms_imm.c
@@ -695,16 +695,24 @@ void clms_admin_state_update_rattr(CLMS_CLUSTER_NODE *nd)
  */
 void clms_node_update_rattr(CLMS_CLUSTER_NODE *nd)
 {
-       SaImmAttrModificationT_2 attr_Mod[4];
+       SaImmAttrModificationT_2 attr_Mod[6];
        SaAisErrorT rc;
+       SaImmAttrValueT address[1];
        SaImmAttrValueT attrUpdateValue[] = {&nd->member};
        SaImmAttrValueT attrUpdateValue1[] = {&nd->node_id};
        SaImmAttrValueT attrUpdateValue2[] = {&nd->boot_time};
        SaImmAttrValueT attrUpdateValue3[] = {&nd->init_view};
+       SaImmAttrValueT attrUpdateValue4[] = {&nd->node_addr.family};
+       address[0] = &nd->node_addr.value;
+       SaImmAttrValueT attrUpdateValue5[] = {address};
 
-       const SaImmAttrModificationT_2 *attrMods[] = {
-           &attr_Mod[0], &attr_Mod[1], &attr_Mod[2], &attr_Mod[3], NULL};
+       uint32_t i = 0, size = (nd->node_addr.length == 0) ? 5 : 7;
+       const SaImmAttrModificationT_2 *attrMods[size];
 
+       for (i = 0; i < size-1; i++) {
+               attrMods[i] = &attr_Mod[i];
+       }
+       attrMods[i] = NULL;
        CLMS_CLUSTER_NODE *node = NULL;
 
        TRACE_ENTER();
@@ -743,6 +751,18 @@ void clms_node_update_rattr(CLMS_CLUSTER_NODE *nd)
        attr_Mod[3].modAttr.attrValueType = SA_IMM_ATTR_SAUINT64T;
        attr_Mod[3].modAttr.attrValues = attrUpdateValue3;
 
+       attr_Mod[4].modType = SA_IMM_ATTR_VALUES_REPLACE;
+       attr_Mod[4].modAttr.attrName = "saClmNodeCurrAddressFamily";
+       attr_Mod[4].modAttr.attrValuesNumber = 1;
+       attr_Mod[4].modAttr.attrValueType = SA_IMM_ATTR_SAUINT32T;
+       attr_Mod[4].modAttr.attrValues = attrUpdateValue4;
+
+       attr_Mod[5].modType = SA_IMM_ATTR_VALUES_REPLACE;
+       attr_Mod[5].modAttr.attrName = "saClmNodeCurrAddress";
+       attr_Mod[5].modAttr.attrValuesNumber = 1;
+       attr_Mod[5].modAttr.attrValueType = SA_IMM_ATTR_SASTRINGT;
+       attr_Mod[5].modAttr.attrValues = attrUpdateValue5;
+
        rc = saImmOiRtObjectUpdate_2(clms_cb->immOiHandle, &nd->node_name,
                                     attrMods);
 
diff --git a/src/clm/clmd/clms_mds.c b/src/clm/clmd/clms_mds.c
index cffcfaf..69982a7 100644
--- a/src/clm/clmd/clms_mds.c
+++ b/src/clm/clmd/clms_mds.c
@@ -1013,6 +1013,8 @@ static uint32_t clms_mds_node_event(struct 
ncsmds_callback_info *mds_info)
                 * AF_INET4 before sending it to the CLM clients.
                 */
                TRACE("Adding ipinformation to the ip list: %u", node_id);
+               TRACE("addr_family:%u", mds_info->info.node_evt.addr_family);
+               TRACE("ip_addr:%s", mds_info->info.node_evt.ip_addr);
                node_id = mds_info->info.node_evt.node_id;
                if ((ip = (IPLIST *)ncs_patricia_tree_get(
                         &clms_cb->iplist, (uint8_t *)&node_id)) == NULL) {
@@ -1035,7 +1037,8 @@ static uint32_t clms_mds_node_event(struct 
ncsmds_callback_info *mds_info)
                                        ip->addr.family = SA_CLM_AF_INET6;
                                else
                                        LOG_ER(
-                                           "Unsupported address family from 
MDS: %u",
+                                           "Unsupported address"
+                                             "family from MDS: %u",
                                            mds_info->info.node_evt
                                                .addr_family);
 
@@ -1060,15 +1063,27 @@ static uint32_t clms_mds_node_event(struct 
ncsmds_callback_info *mds_info)
                                    1; /* For backward compatibility */
                                ip->addr.length = 0;
                        } else {
-                               ip->addr.family =
-                                   mds_info->info.node_evt.addr_family;
-                               ip->addr.length =
-                                   mds_info->info.node_evt.length;
-                               if (ip->addr.length) {
-                                       memcpy(ip->addr.value,
-                                              mds_info->info.node_evt.ip_addr,
-                                              mds_info->info.node_evt.length);
-                               }
+                               if (mds_info->info.node_evt.addr_family ==
+                                    AF_INET)
+                                        ip->addr.family = SA_CLM_AF_INET;
+                                else if (mds_info->info.node_evt.addr_family ==
+                                         AF_INET6)
+                                        ip->addr.family = SA_CLM_AF_INET6;
+                                else
+                                        LOG_ER(
+                                            "Unsupported address family"
+                                            " from MDS: %u",
+                                            mds_info->info.node_evt
+                                                .addr_family);
+
+                                ip->addr.length =
+                                    mds_info->info.node_evt.length;
+                                if (ip->addr.length) {
+                                        memcpy(ip->addr.value,
+                                               mds_info->info.node_evt.ip_addr,
+                                               mds_info->info.node_evt.length);
+                                }
+
                        }
                }
        }
diff --git a/src/clm/tools/clm-adm b/src/clm/tools/clm-adm
old mode 100644
new mode 100755
diff --git a/src/clm/tools/clm-find b/src/clm/tools/clm-find
old mode 100644
new mode 100755
diff --git a/src/clm/tools/clm-state b/src/clm/tools/clm-state
old mode 100644
new mode 100755
-- 
1.9.1


------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to