mirror of
https://git.proxmox.com/git/mirror_corosync
synced 2025-11-02 17:11:29 +00:00
knet: Fix node status display
Currently if there is a gap in the links (eg link0 is missing) corosync-cfgtool -s will still display the links as 0,1,2,3... even if they are 1,2,5,6... Also display the KNET transport type with the link in corosync-cfgtool -s & -n Signed-off-by: Christine Caulfield <ccaulfie@redhat.com> Reviewed-by: Jan Friesse <jfriesse@redhat.com>
This commit is contained in:
parent
c9996fdd0f
commit
1d217b9a34
@ -540,6 +540,7 @@ int totemknet_nodestatus_get (
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/* node_status[] has been zeroed for us in totempg.c */
|
||||
for (i=0; i < num_links; i++) {
|
||||
if (!instance->totem_config->interfaces[link_list[i]].configured) {
|
||||
continue;
|
||||
@ -550,12 +551,12 @@ int totemknet_nodestatus_get (
|
||||
&link_status,
|
||||
sizeof(link_status));
|
||||
if (res == 0) {
|
||||
node_status->link_status[i].enabled = link_status.enabled;
|
||||
node_status->link_status[i].connected = link_status.connected;
|
||||
node_status->link_status[i].dynconnected = link_status.dynconnected;
|
||||
node_status->link_status[i].mtu = link_status.mtu;
|
||||
memcpy(node_status->link_status[i].src_ipaddr, link_status.src_ipaddr, KNET_MAX_HOST_LEN);
|
||||
memcpy(node_status->link_status[i].dst_ipaddr, link_status.dst_ipaddr, KNET_MAX_HOST_LEN);
|
||||
node_status->link_status[link_list[i]].enabled = link_status.enabled;
|
||||
node_status->link_status[link_list[i]].connected = link_status.connected;
|
||||
node_status->link_status[link_list[i]].dynconnected = link_status.dynconnected;
|
||||
node_status->link_status[link_list[i]].mtu = link_status.mtu;
|
||||
memcpy(node_status->link_status[link_list[i]].src_ipaddr, link_status.src_ipaddr, KNET_MAX_HOST_LEN);
|
||||
memcpy(node_status->link_status[link_list[i]].dst_ipaddr, link_status.dst_ipaddr, KNET_MAX_HOST_LEN);
|
||||
} else {
|
||||
knet_log_printf (LOGSYS_LEVEL_WARNING, "knet_link_get_link_status(%d, %d) failed: %d", nodeid, link_list[i], res);
|
||||
}
|
||||
|
||||
@ -108,6 +108,7 @@ nodestatusget_do (enum user_action action, int brief)
|
||||
char *str;
|
||||
char *transport_str = NULL;
|
||||
uint32_t nodeid_list[KNET_MAX_HOST];
|
||||
const char *link_transport[KNET_MAX_LINK];
|
||||
int s = 0;
|
||||
int rc = EXIT_SUCCESS;
|
||||
int transport_number = TOTEM_TRANSPORT_KNET;
|
||||
@ -185,6 +186,37 @@ nodestatusget_do (enum user_action action, int brief)
|
||||
/* It's nice to have these in nodeid order */
|
||||
qsort(nodeid_list, s, sizeof(uint32_t), node_compare);
|
||||
|
||||
/* Get the transport of each link - but set reasonable defaults */
|
||||
if (transport_number == TOTEM_TRANSPORT_KNET) {
|
||||
for (i = 0; i<KNET_MAX_LINK; i++) {
|
||||
link_transport[i] = "udp";
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i<KNET_MAX_LINK; i++) {
|
||||
link_transport[i] = ""; /* No point in displaying "udp" again */
|
||||
}
|
||||
}
|
||||
result = cmap_iter_init(cmap_handle, "totem.interface.", &iter);
|
||||
if (result == CS_OK) { /* it's fine for this to fail, we just use the defaults */
|
||||
while ((cmap_iter_next(cmap_handle, iter, iter_key, &value_len, &type)) == CS_OK) {
|
||||
unsigned int link_number;
|
||||
char *knet_transport;
|
||||
char knet_transport_str[CMAP_KEYNAME_MAXLEN];
|
||||
|
||||
/* transport is (sensibly) indexed by link number */
|
||||
if (sscanf(iter_key, "totem.interface.%u.knet_transport", &link_number) != 1) {
|
||||
continue;
|
||||
}
|
||||
snprintf(knet_transport_str, sizeof(knet_transport_str),
|
||||
"totem.interface.%u.knet_transport", link_number);
|
||||
if (cmap_get_string(cmap_handle, knet_transport_str, &knet_transport) == CS_OK) {
|
||||
link_transport[link_number] = knet_transport;
|
||||
}
|
||||
}
|
||||
|
||||
cmap_iter_finalize(cmap_handle, iter);
|
||||
}
|
||||
|
||||
cmap_finalize(cmap_handle);
|
||||
|
||||
printf ("Local node ID " CS_PRI_NODE_ID ", transport %s\n", local_nodeid, transport_str);
|
||||
@ -215,7 +247,7 @@ nodestatusget_do (enum user_action action, int brief)
|
||||
printf("\n");
|
||||
for (j=0; j<CFG_MAX_LINKS; j++) {
|
||||
if (node_status.link_status[j].enabled) {
|
||||
printf(" LINK: %d", j);
|
||||
printf(" LINK: %d %s", j, link_transport[j]);
|
||||
printf(" (%s%s%s)",
|
||||
node_status.link_status[j].src_ipaddr,
|
||||
transport_number==TOTEM_TRANSPORT_KNET?"->":"",
|
||||
@ -251,7 +283,7 @@ nodestatusget_do (enum user_action action, int brief)
|
||||
|
||||
for (i=0; i<CFG_MAX_LINKS; i++) {
|
||||
if (node_info[other_nodeid_index].link_status[i].enabled) {
|
||||
printf("LINK ID %d\n", i);
|
||||
printf("LINK ID %d %s\n", i, link_transport[i]);
|
||||
printf("\taddr\t= %s\n", node_info[other_nodeid_index].link_status[i].src_ipaddr);
|
||||
if (brief) {
|
||||
printf("\tstatus\t= ");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user