File pacemaker-pengine-ms-resource-state.patch of Package pacemaker.3577
commit 4acd6327a949a3836fa7bb1851f758d4474cd05d
Author: Lars Ellenberg <lars.ellenberg@linbit.com>
Date: Wed Jun 1 14:16:49 2016 +0200
crm_mon: consistently print ms resource state
* consistently use 'Slave', not sometimes 'Slave', sometimes 'Started'
* only report target role, if it is the limitation (target-role:Slave)
Both target-role Master and target-role Started
do not limit us in any way.
Index: pacemaker/lib/pengine/native.c
===================================================================
--- pacemaker.orig/lib/pengine/native.c
+++ pacemaker/lib/pengine/native.c
@@ -439,6 +439,7 @@ native_print(resource_t * rsc, const cha
const char *class = crm_element_value(rsc->xml, XML_AGENT_ATTR_CLASS);
const char *kind = crm_element_value(rsc->xml, XML_ATTR_TYPE);
const char *target_role = NULL;
+ enum rsc_role_e role = rsc->role;
int offset = 0;
char buffer[LINE_MAX];
@@ -455,6 +456,10 @@ native_print(resource_t * rsc, const cha
target_role = g_hash_table_lookup(rsc->meta, XML_RSC_ATTR_TARGET_ROLE);
}
+ if(role == RSC_ROLE_STARTED && uber_parent(rsc)->variant == pe_master) {
+ role = RSC_ROLE_SLAVE;
+ }
+
if (pre_text == NULL && (options & pe_print_printf)) {
pre_text = " ";
}
@@ -505,18 +510,17 @@ native_print(resource_t * rsc, const cha
if(is_set(rsc->flags, pe_rsc_orphan)) {
offset += snprintf(buffer + offset, LINE_MAX - offset, " ORPHANED ");
}
- if(rsc->role > RSC_ROLE_SLAVE && is_set(rsc->flags, pe_rsc_failed)) {
- offset += snprintf(buffer + offset, LINE_MAX - offset, "FAILED %s", role2text(rsc->role));
+ if(role > RSC_ROLE_SLAVE && is_set(rsc->flags, pe_rsc_failed)) {
+ offset += snprintf(buffer + offset, LINE_MAX - offset, "FAILED %s", role2text(role));
} else if(is_set(rsc->flags, pe_rsc_failed)) {
offset += snprintf(buffer + offset, LINE_MAX - offset, "FAILED");
} else {
const char *rsc_state = NULL;
-
if (options & pe_print_pending) {
rsc_state = native_pending_state(rsc);
}
if (rsc_state == NULL) {
- rsc_state = role2text(rsc->role);
+ rsc_state = role2text(role);
}
if (target_role) {
enum rsc_role_e target_role_e = text2role(target_role);