| 114 | } |
| 115 | |
| 116 | static xmlNode * |
| 117 | inject_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 | |
| 160 | static xmlNode * |
| 161 | modify_node(cib_t * cib_conn, char *node, gboolean up) |
no test coverage detected