Blame SOURCES/bz902407-pcmk-crm_resource_handle_ban_for_master_slave_resources_as_advertised.patch

ed0026
commit b15fd2bd176211fb9ae6b158e48f1ee07c21ecee
ed0026
Author: Andrew Beekhof <andrew@beekhof.net>
ed0026
Date:   Fri Aug 23 13:29:00 2013 +1000
ed0026
ed0026
    Bug rhbz#902407 - crm_resource: Handle --ban for master/slave resources as advertised
ed0026
ed0026
diff --git a/tools/crm_resource.c b/tools/crm_resource.c
ed0026
index e4d2215..ea23698 100644
ed0026
--- a/tools/crm_resource.c
ed0026
+++ b/tools/crm_resource.c
ed0026
@@ -905,16 +905,19 @@ ban_resource(const char *rsc_id, const char *host, GListPtr allnodes, cib_t * ci
ed0026
         CMD_ERR("WARNING: Creating rsc_location constraint '%s'"
ed0026
                 " with a score of -INFINITY for resource %s"
ed0026
                 " on %s.\n", ID(location), rsc_id, host);
ed0026
-        CMD_ERR("\tThis will prevent %s from running"
ed0026
+        CMD_ERR("\tThis will prevent %s from %s"
ed0026
                 " on %s until the constraint is removed using"
ed0026
                 " the 'crm_resource --clear' command or manually"
ed0026
-                " with cibadmin\n", rsc_id, host);
ed0026
+                " with cibadmin\n", rsc_id, scope_master?"being promoted":"running", host);
ed0026
         CMD_ERR("\tThis will be the case even if %s is"
ed0026
                 " the last node in the cluster\n", host);
ed0026
         CMD_ERR("\tThis message can be disabled with --quiet\n");
ed0026
     }
ed0026
 
ed0026
     crm_xml_add(location, XML_COLOC_ATTR_SOURCE, rsc_id);
ed0026
+    if(scope_master) {
ed0026
+        crm_xml_add(location, XML_RULE_ATTR_ROLE, RSC_ROLE_MASTER_S);
ed0026
+    }
ed0026
 
ed0026
     if (later_s == NULL) {
ed0026
         /* Short form */
ed0026
@@ -2003,7 +2006,7 @@ main(int argc, char **argv)
ed0026
             node_t *current = rsc->running_on->data;
ed0026
             rc = ban_resource(rsc_id, current->details->uname, NULL, cib_conn);
ed0026
 
ed0026
-        } else if(scope_master && rsc->variant == pe_master) {
ed0026
+        } else if(rsc->variant == pe_master) {
ed0026
             int count = 0;
ed0026
             GListPtr iter = NULL;
ed0026
             node_t *current = NULL;