141 lines
5.0 KiB
Diff
141 lines
5.0 KiB
Diff
|
From 2d15fb37525f88ec8d5acb689b698044c4bb69b1 Mon Sep 17 00:00:00 2001
|
||
|
From: Hideo Yamauchi <renayama19661014@ybb.ne.jp>
|
||
|
Date: Thu, 17 Jun 2021 22:39:12 +0900
|
||
|
Subject: [PATCH 1/2] Low: fenced: Low: fenced: Remove unnecessary release.
|
||
|
|
||
|
---
|
||
|
daemons/fenced/fenced_commands.c | 3 ---
|
||
|
1 file changed, 3 deletions(-)
|
||
|
|
||
|
diff --git a/daemons/fenced/fenced_commands.c b/daemons/fenced/fenced_commands.c
|
||
|
index fee55a7..35aec06 100644
|
||
|
--- a/daemons/fenced/fenced_commands.c
|
||
|
+++ b/daemons/fenced/fenced_commands.c
|
||
|
@@ -1104,9 +1104,6 @@ dynamic_list_search_cb(GPid pid, int rc, const char *output, gpointer user_data)
|
||
|
/* Fall back to status */
|
||
|
g_hash_table_replace(dev->params,
|
||
|
strdup(PCMK_STONITH_HOST_CHECK), strdup("status"));
|
||
|
-
|
||
|
- g_list_free_full(dev->targets, free);
|
||
|
- dev->targets = NULL;
|
||
|
} else if (!rc) {
|
||
|
crm_info("Refreshing port list for %s", dev->id);
|
||
|
g_list_free_full(dev->targets, free);
|
||
|
--
|
||
|
1.8.3.1
|
||
|
|
||
|
|
||
|
From a29f88f6020aac5f1ac32072942eb5713d7be50d Mon Sep 17 00:00:00 2001
|
||
|
From: Hideo Yamauchi <renayama19661014@ybb.ne.jp>
|
||
|
Date: Thu, 17 Jun 2021 22:40:40 +0900
|
||
|
Subject: [PATCH 2/2] High: fenced: Wrong device may be selected when
|
||
|
"dynamic-list" is specified.
|
||
|
|
||
|
---
|
||
|
daemons/fenced/fenced_commands.c | 67 +++++++++++++++++++++++-----------------
|
||
|
1 file changed, 38 insertions(+), 29 deletions(-)
|
||
|
|
||
|
diff --git a/daemons/fenced/fenced_commands.c b/daemons/fenced/fenced_commands.c
|
||
|
index 35aec06..da076fb 100644
|
||
|
--- a/daemons/fenced/fenced_commands.c
|
||
|
+++ b/daemons/fenced/fenced_commands.c
|
||
|
@@ -904,6 +904,31 @@ xml2device_params(const char *name, xmlNode *dev)
|
||
|
return params;
|
||
|
}
|
||
|
|
||
|
+static const char *
|
||
|
+target_list_type(stonith_device_t * dev)
|
||
|
+{
|
||
|
+ const char *check_type = NULL;
|
||
|
+
|
||
|
+ check_type = g_hash_table_lookup(dev->params, PCMK_STONITH_HOST_CHECK);
|
||
|
+
|
||
|
+ if (check_type == NULL) {
|
||
|
+
|
||
|
+ if (g_hash_table_lookup(dev->params, PCMK_STONITH_HOST_LIST)) {
|
||
|
+ check_type = "static-list";
|
||
|
+ } else if (g_hash_table_lookup(dev->params, PCMK_STONITH_HOST_MAP)) {
|
||
|
+ check_type = "static-list";
|
||
|
+ } else if (pcmk_is_set(dev->flags, st_device_supports_list)) {
|
||
|
+ check_type = "dynamic-list";
|
||
|
+ } else if (pcmk_is_set(dev->flags, st_device_supports_status)) {
|
||
|
+ check_type = "status";
|
||
|
+ } else {
|
||
|
+ check_type = "none";
|
||
|
+ }
|
||
|
+ }
|
||
|
+
|
||
|
+ return check_type;
|
||
|
+}
|
||
|
+
|
||
|
static stonith_device_t *
|
||
|
build_device_from_xml(xmlNode * msg)
|
||
|
{
|
||
|
@@ -931,6 +956,12 @@ build_device_from_xml(xmlNode * msg)
|
||
|
value = g_hash_table_lookup(device->params, PCMK_STONITH_HOST_MAP);
|
||
|
device->aliases = build_port_aliases(value, &(device->targets));
|
||
|
|
||
|
+ value = target_list_type(device);
|
||
|
+ if (!pcmk__str_eq(value, "static-list", pcmk__str_casei) && device->targets) {
|
||
|
+ /* Other than "static-list", dev-> targets is unnecessary. */
|
||
|
+ g_list_free_full(device->targets, free);
|
||
|
+ device->targets = NULL;
|
||
|
+ }
|
||
|
device->agent_metadata = get_agent_metadata(device->agent);
|
||
|
if (device->agent_metadata) {
|
||
|
read_action_metadata(device);
|
||
|
@@ -971,31 +1002,6 @@ build_device_from_xml(xmlNode * msg)
|
||
|
return device;
|
||
|
}
|
||
|
|
||
|
-static const char *
|
||
|
-target_list_type(stonith_device_t * dev)
|
||
|
-{
|
||
|
- const char *check_type = NULL;
|
||
|
-
|
||
|
- check_type = g_hash_table_lookup(dev->params, PCMK_STONITH_HOST_CHECK);
|
||
|
-
|
||
|
- if (check_type == NULL) {
|
||
|
-
|
||
|
- if (g_hash_table_lookup(dev->params, PCMK_STONITH_HOST_LIST)) {
|
||
|
- check_type = "static-list";
|
||
|
- } else if (g_hash_table_lookup(dev->params, PCMK_STONITH_HOST_MAP)) {
|
||
|
- check_type = "static-list";
|
||
|
- } else if (pcmk_is_set(dev->flags, st_device_supports_list)) {
|
||
|
- check_type = "dynamic-list";
|
||
|
- } else if (pcmk_is_set(dev->flags, st_device_supports_status)) {
|
||
|
- check_type = "status";
|
||
|
- } else {
|
||
|
- check_type = "none";
|
||
|
- }
|
||
|
- }
|
||
|
-
|
||
|
- return check_type;
|
||
|
-}
|
||
|
-
|
||
|
static void
|
||
|
schedule_internal_command(const char *origin,
|
||
|
stonith_device_t * device,
|
||
|
@@ -1099,11 +1105,14 @@ dynamic_list_search_cb(GPid pid, int rc, const char *output, gpointer user_data)
|
||
|
|
||
|
/* If we successfully got the targets earlier, don't disable. */
|
||
|
if (rc != 0 && !dev->targets) {
|
||
|
- crm_notice("Disabling port list queries for %s: %s "
|
||
|
- CRM_XS " rc=%d", dev->id, output, rc);
|
||
|
- /* Fall back to status */
|
||
|
- g_hash_table_replace(dev->params,
|
||
|
+ if (g_hash_table_lookup(dev->params, PCMK_STONITH_HOST_CHECK) == NULL) {
|
||
|
+ /*
|
||
|
+ If the operation fails if the user does not explicitly specify "dynamic-list", it will fall back to "status".
|
||
|
+ */
|
||
|
+ crm_notice("Disabling port list queries for %s (%d): %s", dev->id, rc, output);
|
||
|
+ g_hash_table_replace(dev->params,
|
||
|
strdup(PCMK_STONITH_HOST_CHECK), strdup("status"));
|
||
|
+ }
|
||
|
} else if (!rc) {
|
||
|
crm_info("Refreshing port list for %s", dev->id);
|
||
|
g_list_free_full(dev->targets, free);
|
||
|
--
|
||
|
1.8.3.1
|
||
|
|