Sorry, stupid thing happens ;) 2008/4/25, Xinwei Hu <hxinwei@gmail.com>: > Hi all, > > The attached patch is a try to make clvmd work correctly on openais stack. > It does 2 things. > > 1. The cpg_deliver_callback make a compare between target_nodeid and our_nodeid. > It turns out openais set target_nodeid to 0 sometimes. for > broadcasting ? I change > the behavior so that lvm will process_remote also on target_nodeid == 0 > > 2. The joined_list passed to cpg_confchg_callback doesn't include the > already exist > nodes in the group, which leads to an incomplete node_hash. I simply > add all other > nodes in member_list to node_hash also. > > With this patch applied, clvmd works correctly with basic lvm commands now. > > Please kindly review this, and consider it for upstream. > > Thanks. >
--- clvmd-openais.c.orig 2008-04-25 17:55:56.000000000 +0800 +++ clvmd-openais.c.new 2008-04-25 18:03:10.000000000 +0800 @@ -245,12 +245,13 @@ memcpy(&target_nodeid, msg, OPENAIS_CSID_LEN); - DEBUGLOG("Got message from nodeid %d for %d. len %d\n", - nodeid, target_nodeid, msg_len-4); + DEBUGLOG("%u got message from nodeid %d for %d. len %d\n", + our_nodeid, nodeid, target_nodeid, msg_len-4); - if (target_nodeid == our_nodeid) - process_message(cluster_client, (char *)msg+OPENAIS_CSID_LEN, - msg_len-OPENAIS_CSID_LEN, (char*)&nodeid); + if (nodeid != our_nodeid) + if (target_nodeid == our_nodeid || target_node == 0) + process_message(cluster_client, (char *)msg+OPENAIS_CSID_LEN, + msg_len-OPENAIS_CSID_LEN, (char*)&nodeid); } static void cpg_confchg_callback(cpg_handle_t handle, @@ -292,7 +293,43 @@ ninfo->state = NODE_DOWN; } + for (i=0; i<member_list_entries; i++) { + if (member_list[i].nodeid == 0) continue; + ninfo = dm_hash_lookup_binary(node_hash, + (char *)&member_list[i].nodeid, + OPENAIS_CSID_LEN); + if (!ninfo) { + ninfo = malloc(sizeof(struct node_info)); + if (!ninfo) { + break; + } + else { + ninfo->nodeid = member_list[i].nodeid; + dm_hash_insert_binary(node_hash, + (char *)&ninfo->nodeid, + OPENAIS_CSID_LEN, ninfo); + } + } + ninfo->state = NODE_CLVMD; + } + num_nodes = joined_list_entries; + + //Verbose on node_hash, helpful to debug + struct dm_hash_node *hn; + DEBUGLOG("Iterate node_hash\n"); + dm_hash_iterate(hn, node_hash) + { + ninfo = dm_hash_get_data(node_hash, hn); + if (ninfo->state == NODE_CLVMD) { + DEBUGLOG("%u:%s\n", ninfo->nodeid, "CLVMD"); + } + else { + if (ninfo->state == NODE_DOWN) + DEBUGLOG("%u:%s\n", ninfo->nodeid, "DOWN"); + } + } + DEBUGLOG("Iterate node_hash done\n"); }
_______________________________________________ linux-lvm mailing list linux-lvm@redhat.com https://www.redhat.com/mailman/listinfo/linux-lvm read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/