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

Function native_add_running

lib/pengine/native.c:31–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29#include "./variant.h"
30
31void
32native_add_running(resource_t * rsc, node_t * node, pe_working_set_t * data_set)
33{
34 GListPtr gIter = rsc->running_on;
35
36 CRM_CHECK(node != NULL, return);
37
38 for (; gIter != NULL; gIter = gIter->next) {
39 node_t *a_node = (node_t *) gIter->data;
40
41 CRM_CHECK(a_node != NULL, return);
42 if (safe_str_eq(a_node->details->id, node->details->id)) {
43 return;
44 }
45 }
46
47 pe_rsc_trace(rsc, "Adding %s to %s", rsc->id, node->details->uname);
48
49 rsc->running_on = g_list_append(rsc->running_on, node);
50 if (rsc->variant == pe_native) {
51 node->details->running_rsc = g_list_append(node->details->running_rsc, rsc);
52 }
53
54 if (is_not_set(rsc->flags, pe_rsc_managed)) {
55 pe_rsc_info(rsc, "resource %s isnt managed", rsc->id);
56 resource_location(rsc, node, INFINITY, "not_managed_default", data_set);
57 return;
58 }
59
60 if (rsc->variant == pe_native && g_list_length(rsc->running_on) > 1) {
61 switch (rsc->recovery_type) {
62 case recovery_stop_only:
63 {
64 GHashTableIter gIter;
65 node_t *local_node = NULL;
66
67 /* make sure it doesnt come up again */
68 g_hash_table_destroy(rsc->allowed_nodes);
69 rsc->allowed_nodes = node_hash_from_list(data_set->nodes);
70 g_hash_table_iter_init(&gIter, rsc->allowed_nodes);
71 while (g_hash_table_iter_next(&gIter, NULL, (void **)&local_node)) {
72 local_node->weight = -INFINITY;
73 }
74 }
75 break;
76 case recovery_stop_start:
77 break;
78 case recovery_block:
79 clear_bit(rsc->flags, pe_rsc_managed);
80 set_bit(rsc->flags, pe_rsc_block);
81 break;
82 }
83 crm_debug("%s is active on %d nodes including %s: %s",
84 rsc->id, g_list_length(rsc->running_on), node->details->uname,
85 recovery2text(rsc->recovery_type));
86
87 } else {
88 pe_rsc_trace(rsc, "Resource %s is active on: %s", rsc->id, node->details->uname);

Callers 2

process_rsc_stateFunction · 0.85
unpack_rsc_opFunction · 0.85

Calls 6

is_not_setFunction · 0.85
resource_locationFunction · 0.85
node_hash_from_listFunction · 0.85
g_hash_table_iter_initFunction · 0.85
g_hash_table_iter_nextFunction · 0.85
recovery2textFunction · 0.85

Tested by

no test coverage detected