|
|
60de42 |
From aa584a7cf34a0e740f6d8249a7adabf358d66e41 Mon Sep 17 00:00:00 2001
|
|
|
60de42 |
From: Jehan-Guillaume de Rorthais <jgdr@dalibo.com>
|
|
|
60de42 |
Date: Fri, 10 Mar 2017 14:31:33 +0100
|
|
|
60de42 |
Subject: [PATCH 1/2] Low: tools: crm_resource should set
|
|
|
60de42 |
OCF_RESKEY_crm_feature_set
|
|
|
60de42 |
|
|
|
60de42 |
Some resource agent relies on this environment variable during their
|
|
|
60de42 |
validate-all action to check the CRM feature set compatibility.
|
|
|
60de42 |
|
|
|
60de42 |
Without this environment variable, most of the --force-ACTION are
|
|
|
60de42 |
failing.
|
|
|
60de42 |
|
|
|
60de42 |
At least the Linbit/drbd and PAF (pgsqlms) agents are using it.
|
|
|
60de42 |
---
|
|
|
60de42 |
tools/crm_resource_runtime.c | 4 ++++
|
|
|
60de42 |
1 file changed, 4 insertions(+)
|
|
|
60de42 |
|
|
|
60de42 |
diff --git a/tools/crm_resource_runtime.c b/tools/crm_resource_runtime.c
|
|
|
60de42 |
index ee7523f..e6a186a 100644
|
|
|
60de42 |
--- a/tools/crm_resource_runtime.c
|
|
|
60de42 |
+++ b/tools/crm_resource_runtime.c
|
|
|
60de42 |
@@ -1508,6 +1508,10 @@ cli_resource_execute(const char *rsc_id, const char *rsc_action, GHashTable *ove
|
|
|
60de42 |
}
|
|
|
60de42 |
|
|
|
60de42 |
params = generate_resource_params(rsc, data_set);
|
|
|
60de42 |
+
|
|
|
60de42 |
+ /* add crm_feature_set env needed by some resource agents */
|
|
|
60de42 |
+ g_hash_table_insert(params, strdup(XML_ATTR_CRM_VERSION), strdup(CRM_FEATURE_SET));
|
|
|
60de42 |
+
|
|
|
60de42 |
op = resources_action_create(rsc->id, rclass, rprov, rtype, action, 0, -1, params, 0);
|
|
|
60de42 |
|
|
|
60de42 |
if(do_trace) {
|
|
|
60de42 |
--
|
|
|
60de42 |
1.8.3.1
|
|
|
60de42 |
|
|
|
60de42 |
|
|
|
60de42 |
From 02a737976d34d41da65fa25a64e5708a1269cef7 Mon Sep 17 00:00:00 2001
|
|
|
60de42 |
From: Jehan-Guillaume de Rorthais <jgdr@dalibo.com>
|
|
|
60de42 |
Date: Fri, 10 Mar 2017 14:50:43 +0100
|
|
|
60de42 |
Subject: [PATCH 2/2] Feature: tools: Add "--validate" command to crm_resource
|
|
|
60de42 |
|
|
|
60de42 |
This command calls the validate-all action from the resource agent. It
|
|
|
60de42 |
allows admins to check their resource is setup correctly in a shadow
|
|
|
60de42 |
environment before pushing their setup to the cluster.
|
|
|
60de42 |
---
|
|
|
60de42 |
tools/crm_resource.c | 6 ++++--
|
|
|
60de42 |
tools/crm_resource_runtime.c | 5 ++++-
|
|
|
60de42 |
2 files changed, 8 insertions(+), 3 deletions(-)
|
|
|
60de42 |
|
|
|
60de42 |
diff --git a/tools/crm_resource.c b/tools/crm_resource.c
|
|
|
60de42 |
index 45dfd4a..e8cd80e 100644
|
|
|
60de42 |
--- a/tools/crm_resource.c
|
|
|
60de42 |
+++ b/tools/crm_resource.c
|
|
|
60de42 |
@@ -128,6 +128,7 @@ static struct crm_option long_options[] = {
|
|
|
60de42 |
{"constraints",0, 0, 'a', "\tDisplay the (co)location constraints that apply to a resource"},
|
|
|
60de42 |
|
|
|
60de42 |
{"-spacer-", 1, 0, '-', "\nCommands:"},
|
|
|
60de42 |
+ {"validate", 0, 0, 0, "\t\tCall the validate-all action of the local given resource"},
|
|
|
60de42 |
{"cleanup", 0, 0, 'C',
|
|
|
60de42 |
"\t\tDelete resource's history and re-check its current state. "
|
|
|
60de42 |
"Optional: --resource (if not specified, all resources), "
|
|
|
60de42 |
@@ -303,7 +304,8 @@ main(int argc, char **argv)
|
|
|
60de42 |
require_dataset = FALSE;
|
|
|
60de42 |
|
|
|
60de42 |
} else if (
|
|
|
60de42 |
- safe_str_eq("restart", longname)
|
|
|
60de42 |
+ safe_str_eq("validate", longname)
|
|
|
60de42 |
+ || safe_str_eq("restart", longname)
|
|
|
60de42 |
|| safe_str_eq("force-demote", longname)
|
|
|
60de42 |
|| safe_str_eq("force-stop", longname)
|
|
|
60de42 |
|| safe_str_eq("force-start", longname)
|
|
|
60de42 |
@@ -687,7 +689,7 @@ main(int argc, char **argv)
|
|
|
60de42 |
} else if (rsc_cmd == 0 && rsc_long_cmd && safe_str_eq(rsc_long_cmd, "wait")) {
|
|
|
60de42 |
rc = wait_till_stable(timeout_ms, cib_conn);
|
|
|
60de42 |
|
|
|
60de42 |
- } else if (rsc_cmd == 0 && rsc_long_cmd) { /* force-(stop|start|check) */
|
|
|
60de42 |
+ } else if (rsc_cmd == 0 && rsc_long_cmd) { /* validate or force-(stop|start|check) */
|
|
|
60de42 |
rc = cli_resource_execute(rsc_id, rsc_long_cmd, override_params, cib_conn, &data_set);
|
|
|
60de42 |
|
|
|
60de42 |
} else if (rsc_cmd == 'A' || rsc_cmd == 'a') {
|
|
|
60de42 |
diff --git a/tools/crm_resource_runtime.c b/tools/crm_resource_runtime.c
|
|
|
60de42 |
index e6a186a..ca38aea 100644
|
|
|
60de42 |
--- a/tools/crm_resource_runtime.c
|
|
|
60de42 |
+++ b/tools/crm_resource_runtime.c
|
|
|
60de42 |
@@ -1467,7 +1467,10 @@ cli_resource_execute(const char *rsc_id, const char *rsc_action, GHashTable *ove
|
|
|
60de42 |
return -ENXIO;
|
|
|
60de42 |
}
|
|
|
60de42 |
|
|
|
60de42 |
- if (safe_str_eq(rsc_action, "force-check")) {
|
|
|
60de42 |
+ if (safe_str_eq(rsc_action, "validate")) {
|
|
|
60de42 |
+ action = "validate-all";
|
|
|
60de42 |
+
|
|
|
60de42 |
+ } else if (safe_str_eq(rsc_action, "force-check")) {
|
|
|
60de42 |
action = "monitor";
|
|
|
60de42 |
|
|
|
60de42 |
} else if (safe_str_eq(rsc_action, "force-stop")) {
|
|
|
60de42 |
--
|
|
|
60de42 |
1.8.3.1
|
|
|
60de42 |
|