| 85 | } |
| 86 | |
| 87 | static void |
| 88 | create_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 | |
| 116 | static xmlNode * |
| 117 | inject_node_state(cib_t * cib_conn, char *node) |
no test coverage detected