Blob Blame History Raw
commit 4cc5bf3a67cae9b17c49cd73d840b5388500ad13
Author: Andrew Beekhof <andrew@beekhof.net>
Date:   Tue Sep 17 14:06:41 2013 +1000

    Fix: crm_resource: Provide a meaningful error if --master is used for primitives and groups

diff --git a/tools/crm_resource.c b/tools/crm_resource.c
index 69470d7..b63b9ae 100644
--- a/tools/crm_resource.c
+++ b/tools/crm_resource.c
@@ -1942,6 +1942,17 @@ main(int argc, char **argv)
         } else if (rsc->variant < pe_clone && g_list_length(rsc->running_on) > 1) {
             CMD_ERR("Resource '%s' not moved: active on multiple nodes\n", rsc_id);
             goto bail;
+
+        } else if (rsc->variant < pe_clone && scope_master) {
+            resource_t *p = uber_parent(rsc);
+            if(p->variant == pe_master) {
+                CMD_ERR("Resource '%s' not moved: The --master option is not a valid for %s resources."
+                        "  Did you mean '%s'?\n", rsc_id, get_resource_typename(rsc->variant), p->id);
+            } else {
+                CMD_ERR("Resource '%s' not moved: The --master option is not a valid for %s resources.\n",
+                        rsc_id, get_resource_typename(rsc->variant));
+            }
+            goto bail;
         }
 
         if(dest == NULL) {