MCPcopy Create free account
hub / github.com/ClusterLabs/pacemaker / get_local_node_name

Function get_local_node_name

lib/cluster/cluster.c:347–390  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

345}
346
347char *
348get_local_node_name(void)
349{
350 char *name = NULL;
351 enum cluster_type_e stack = get_cluster_type();
352
353 switch(stack) {
354
355#if SUPPORT_CMAN
356 case pcmk_cluster_cman:
357 name = cman_node_name(0 /* AKA. CMAN_NODEID_US */);
358 break;
359#endif
360
361#if SUPPORT_COROSYNC
362# if !SUPPORT_PLUGIN
363 case pcmk_cluster_corosync:
364 name = corosync_node_name(0, 0);
365 break;
366# endif
367#endif
368 case pcmk_cluster_heartbeat:
369 case pcmk_cluster_classic_ais:
370 break;
371 default:
372 crm_err("Unknown cluster type: %s (%d)", name_for_cluster_type(stack), stack);
373 }
374
375 if(name == NULL) {
376 struct utsname res;
377 int rc = uname(&res);
378
379 if(rc == 0) {
380 crm_notice("Defaulting to uname(2).nodename for the local %s node name", name_for_cluster_type(stack));
381 name = strdup(res.nodename);
382 }
383 }
384
385 if(name == NULL) {
386 crm_err("Could not obtain the local %s node name", name_for_cluster_type(stack));
387 crm_exit(100);
388 }
389 return name;
390}
391
392char *
393get_node_name(uint32_t nodeid)

Callers 4

mainFunction · 0.85
mainFunction · 0.85
init_cs_connection_onceFunction · 0.85
mainFunction · 0.85

Calls 5

get_cluster_typeFunction · 0.85
cman_node_nameFunction · 0.85
corosync_node_nameFunction · 0.85
name_for_cluster_typeFunction · 0.85
crm_exitFunction · 0.85

Tested by

no test coverage detected