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

Function create_node_entry

tools/crm_simulate.c:87–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85}
86
87static void
88create_node_entry(cib_t * cib_conn, char *node)
89{
90 int rc = pcmk_ok;
91 int max = strlen(new_node_template) + strlen(node) + 1;
92 char *xpath = NULL;
93
94 xpath = calloc(1, max);
95
96 snprintf(xpath, max, new_node_template, node);
97 rc = cib_conn->cmds->query(cib_conn, xpath, NULL, cib_xpath | cib_sync_call | cib_scope_local);
98
99 if (rc == -ENXIO) {
100 xmlNode *cib_object = create_xml_node(NULL, XML_CIB_TAG_NODE);
101
102 /* Using node uname as uuid ala corosync/openais */
103 crm_xml_add(cib_object, XML_ATTR_ID, node);
104 crm_xml_add(cib_object, XML_ATTR_UNAME, node);
105 cib_conn->cmds->create(cib_conn, XML_CIB_TAG_NODES, cib_object,
106 cib_sync_call | cib_scope_local);
107 /* Not bothering with subsequent query to see if it exists,
108 we'll bomb out later in the call to query_node_uuid()... */
109
110 free_xml(cib_object);
111 }
112
113 free(xpath);
114}
115
116static xmlNode *
117inject_node_state(cib_t * cib_conn, char *node)

Callers 1

inject_node_stateFunction · 0.85

Calls 3

create_xml_nodeFunction · 0.85
crm_xml_addFunction · 0.85
free_xmlFunction · 0.85

Tested by

no test coverage detected