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

Function print_xml_status

tools/crm_mon.c:1268–1416  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1266}
1267
1268static int
1269print_xml_status(pe_working_set_t * data_set)
1270{
1271 FILE *stream = stdout;
1272 GListPtr gIter = NULL;
1273 node_t *dc = NULL;
1274 xmlNode *stack = NULL;
1275 xmlNode *quorum_node = NULL;
1276 const char *quorum_votes = "unknown";
1277
1278 dc = data_set->dc_node;
1279
1280
1281 fprintf(stream, "<?xml version=\"1.0\"?>\n");
1282 fprintf(stream, "<crm_mon version=\"%s\">\n", VERSION);
1283
1284 /*** SUMMARY ***/
1285 fprintf(stream, " <summary>\n");
1286
1287 if (print_last_updated) {
1288 time_t now = time(NULL);
1289 char *now_str = ctime(&now);
1290
1291 now_str[24] = EOS; /* replace the newline */
1292 fprintf(stream, " <last_update time=\"%s\" />\n", now_str);
1293 }
1294
1295 if (print_last_change) {
1296 const char *last_written = crm_element_value(data_set->input, XML_CIB_ATTR_WRITTEN);
1297 const char *user = crm_element_value(data_set->input, XML_ATTR_UPDATE_USER);
1298 const char *client = crm_element_value(data_set->input, XML_ATTR_UPDATE_CLIENT);
1299 const char *origin = crm_element_value(data_set->input, XML_ATTR_UPDATE_ORIG);
1300
1301 fprintf(stream, " <last_change time=\"%s\" user=\"%s\" client=\"%s\" origin=\"%s\" />\n",
1302 last_written ? last_written : "",
1303 user ? user : "",
1304 client ? client : "",
1305 origin ? origin : "");
1306 }
1307
1308 stack = get_xpath_object("//nvpair[@name='cluster-infrastructure']",
1309 data_set->input,
1310 LOG_DEBUG);
1311 if (stack) {
1312 fprintf(stream, " <stack type=\"%s\" />\n", crm_element_value(stack, XML_NVPAIR_ATTR_VALUE));
1313 }
1314
1315 if (!dc) {
1316 fprintf(stream, " <current_dc present=\"false\" />\n");
1317 } else {
1318 const char *quorum = crm_element_value(data_set->input, XML_ATTR_HAVE_QUORUM);
1319 const char *uname = dc->details->uname;
1320 const char *id = dc->details->id;
1321 xmlNode *dc_version = get_xpath_object("//nvpair[@name='dc-version']",
1322 data_set->input,
1323 LOG_DEBUG);
1324 fprintf(stream, " <current_dc present=\"true\" version=\"%s\" name=\"%s\" id=\"%s\" with_quorum=\"%s\" />\n",
1325 dc_version ? crm_element_value(dc_version, XML_NVPAIR_ATTR_VALUE) : "",

Callers 1

mon_refresh_displayFunction · 0.85

Calls 5

crm_element_valueFunction · 0.85
get_xpath_objectFunction · 0.85
crm_is_trueFunction · 0.85
count_resourcesFunction · 0.85
is_setFunction · 0.85

Tested by

no test coverage detected