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

Function inject_node_state

tools/crm_simulate.c:116–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114}
115
116static xmlNode *
117inject_node_state(cib_t * cib_conn, char *node)
118{
119 int rc = pcmk_ok;
120 int max = strlen(rsc_template) + strlen(node) + 1;
121 char *xpath = NULL;
122 xmlNode *cib_object = NULL;
123
124 xpath = calloc(1, max);
125
126 create_node_entry(cib_conn, node);
127
128 snprintf(xpath, max, node_template, node);
129 rc = cib_conn->cmds->query(cib_conn, xpath, &cib_object,
130 cib_xpath | cib_sync_call | cib_scope_local);
131
132 if(cib_object && ID(cib_object) == NULL) {
133 crm_err("Detected multiple node_state entries for xpath=%s, bailing", xpath);
134 crm_log_xml_warn(cib_object, "Duplicates");
135 crm_exit(1);
136 }
137
138 if (rc == -ENXIO) {
139 char *uuid = NULL;
140
141 query_node_uuid(cib_conn, node, &uuid);
142
143 cib_object = create_xml_node(NULL, XML_CIB_TAG_STATE);
144 crm_xml_add(cib_object, XML_ATTR_UUID, uuid);
145 crm_xml_add(cib_object, XML_ATTR_UNAME, node);
146 cib_conn->cmds->create(cib_conn, XML_CIB_TAG_STATUS, cib_object,
147 cib_sync_call | cib_scope_local);
148 free_xml(cib_object);
149 free(uuid);
150
151 rc = cib_conn->cmds->query(cib_conn, xpath, &cib_object,
152 cib_xpath | cib_sync_call | cib_scope_local);
153 }
154
155 free(xpath);
156 CRM_ASSERT(rc == pcmk_ok);
157 return cib_object;
158}
159
160static xmlNode *
161modify_node(cib_t * cib_conn, char *node, gboolean up)

Callers 3

modify_nodeFunction · 0.85
exec_rsc_actionFunction · 0.85
modify_configurationFunction · 0.85

Calls 6

create_node_entryFunction · 0.85
crm_exitFunction · 0.85
query_node_uuidFunction · 0.85
create_xml_nodeFunction · 0.85
crm_xml_addFunction · 0.85
free_xmlFunction · 0.85

Tested by

no test coverage detected