| 268 | } |
| 269 | |
| 270 | static void |
| 271 | native_print_xml(resource_t * rsc, const char *pre_text, long options, void *print_data) |
| 272 | { |
| 273 | const char *class = crm_element_value(rsc->xml, XML_AGENT_ATTR_CLASS); |
| 274 | const char *prov = crm_element_value(rsc->xml, XML_AGENT_ATTR_PROVIDER); |
| 275 | |
| 276 | /* resource information. */ |
| 277 | status_print("%s<resource ", pre_text); |
| 278 | status_print("id=\"%s\" ", rsc->id); |
| 279 | status_print("resource_agent=\"%s%s%s:%s\" ", |
| 280 | class, |
| 281 | prov ? "::" : "", prov ? prov : "", crm_element_value(rsc->xml, XML_ATTR_TYPE)); |
| 282 | status_print("role=\"%s\" ", role2text(rsc->role)); |
| 283 | status_print("active=\"%s\" ", rsc->fns->active(rsc, TRUE) ? "true" : "false"); |
| 284 | status_print("orphaned=\"%s\" ", is_set(rsc->flags, pe_rsc_orphan) ? "true" : "false"); |
| 285 | status_print("managed=\"%s\" ", is_set(rsc->flags, pe_rsc_managed) ? "true" : "false"); |
| 286 | status_print("failed=\"%s\" ", is_set(rsc->flags, pe_rsc_failed) ? "true" : "false"); |
| 287 | status_print("failure_ignored=\"%s\" ", |
| 288 | is_set(rsc->flags, pe_rsc_failure_ignored) ? "true" : "false"); |
| 289 | status_print("nodes_running_on=\"%d\" ", g_list_length(rsc->running_on)); |
| 290 | |
| 291 | if (options & pe_print_dev) { |
| 292 | status_print("provisional=\"%s\" ", |
| 293 | is_set(rsc->flags, pe_rsc_provisional) ? "true" : "false"); |
| 294 | status_print("runnable=\"%s\" ", is_set(rsc->flags, pe_rsc_runnable) ? "true" : "false"); |
| 295 | status_print("priority=\"%f\" ", (double)rsc->priority); |
| 296 | status_print("variant=\"%s\" ", crm_element_name(rsc->xml)); |
| 297 | } |
| 298 | |
| 299 | /* print out the nodes this resource is running on */ |
| 300 | if (options & pe_print_rsconly) { |
| 301 | status_print("/>\n"); |
| 302 | /* do nothing */ |
| 303 | } else if (g_list_length(rsc->running_on) > 0) { |
| 304 | GListPtr gIter = rsc->running_on; |
| 305 | |
| 306 | status_print(">\n"); |
| 307 | for (; gIter != NULL; gIter = gIter->next) { |
| 308 | node_t *node = (node_t *) gIter->data; |
| 309 | |
| 310 | status_print("%s <node name=\"%s\" id=\"%s\" cached=\"%s\"/>\n", pre_text, node->details->uname, |
| 311 | node->details->id, node->details->online ? "false" : "true"); |
| 312 | } |
| 313 | status_print("%s</resource>\n", pre_text); |
| 314 | } else { |
| 315 | status_print("/>\n"); |
| 316 | } |
| 317 | } |
| 318 | |
| 319 | void |
| 320 | native_print(resource_t * rsc, const char *pre_text, long options, void *print_data) |
no test coverage detected