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

Function retrieveCib

cib/io.c:250–283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

248 */
249
250static xmlNode *
251retrieveCib(const char *filename, const char *sigfile, gboolean archive_invalid)
252{
253 struct stat buf;
254 xmlNode *root = NULL;
255
256 crm_info("Reading cluster configuration from: %s (digest: %s)", filename, sigfile);
257
258 if (stat(filename, &buf) != 0) {
259 crm_warn("Cluster configuration not found: %s", filename);
260 return NULL;
261 }
262
263 root = filename2xml(filename);
264 if (root == NULL) {
265 crm_err("%s exists but does NOT contain valid XML. ", filename);
266 crm_warn("Continuing but %s will NOT used.", filename);
267
268 } else if (validate_cib_digest(root, sigfile) == FALSE) {
269 crm_err("Checksum of %s failed! Configuration contents ignored!", filename);
270 crm_err("Usually this is caused by manual changes, "
271 "please refer to http://clusterlabs.org/wiki/FAQ#cib_changes_detected");
272 crm_warn("Continuing but %s will NOT used.", filename);
273 free_xml(root);
274 root = NULL;
275
276 if (archive_invalid) {
277 /* Archive the original files so the contents are not lost */
278 cib_rename(filename, NULL);
279 cib_rename(sigfile, NULL);
280 }
281 }
282 return root;
283}
284
285xmlNode *
286readCibXmlFile(const char *dir, const char *file, gboolean discard_status)

Callers 2

readCibXmlFileFunction · 0.85
write_cib_contentsFunction · 0.85

Calls 5

filename2xmlFunction · 0.85
validate_cib_digestFunction · 0.85
free_xmlFunction · 0.85
cib_renameFunction · 0.85
statClass · 0.70

Tested by

no test coverage detected