|
|
1f8f5b |
From f7c6c3af0eed6ff2a305642a78f0421f502fd6a0 Mon Sep 17 00:00:00 2001
|
|
|
129887 |
From: Ivan Devat <idevat@redhat.com>
|
|
|
129887 |
Date: Wed, 7 Jun 2017 14:36:05 +0200
|
|
|
1f8f5b |
Subject: [PATCH 3/6] squash bz1459503 OSP workarounds not compatible wi
|
|
|
129887 |
|
|
|
129887 |
reuse existing pcmk authkey during setup
|
|
|
129887 |
|
|
|
129887 |
show only warn if `resource create` creates remote
|
|
|
129887 |
---
|
|
|
129887 |
pcs/cluster.py | 10 +++++++++-
|
|
|
129887 |
pcs/lib/commands/resource.py | 6 ++++--
|
|
|
129887 |
pcs/test/cib_resource/test_create.py | 13 ++++++-------
|
|
|
129887 |
pcs/test/test_resource.py | 24 ++++++++++++------------
|
|
|
129887 |
4 files changed, 31 insertions(+), 22 deletions(-)
|
|
|
129887 |
|
|
|
129887 |
diff --git a/pcs/cluster.py b/pcs/cluster.py
|
|
|
1f8f5b |
index 561a3d20..a32fdc7e 100644
|
|
|
129887 |
--- a/pcs/cluster.py
|
|
|
129887 |
+++ b/pcs/cluster.py
|
|
|
129887 |
@@ -525,13 +525,21 @@ def cluster_setup(argv):
|
|
|
129887 |
print("Destroying cluster on nodes: {0}...".format(
|
|
|
129887 |
", ".join(primary_addr_list)
|
|
|
129887 |
))
|
|
|
129887 |
+
|
|
|
129887 |
+ try:
|
|
|
129887 |
+ pcmk_authkey_content = (
|
|
|
129887 |
+ open(settings.pacemaker_authkey_file, "rb").read()
|
|
|
129887 |
+ )
|
|
|
129887 |
+ except EnvironmentError as e:
|
|
|
129887 |
+ pcmk_authkey_content = generate_key()
|
|
|
129887 |
+
|
|
|
129887 |
destroy_cluster(primary_addr_list)
|
|
|
129887 |
print()
|
|
|
129887 |
|
|
|
129887 |
try:
|
|
|
129887 |
file_definitions = {}
|
|
|
129887 |
file_definitions.update(
|
|
|
129887 |
- node_communication_format.pcmk_authkey_file(generate_key())
|
|
|
129887 |
+ node_communication_format.pcmk_authkey_file(pcmk_authkey_content)
|
|
|
129887 |
)
|
|
|
129887 |
if modifiers["encryption"] == "1":
|
|
|
129887 |
file_definitions.update(
|
|
|
129887 |
diff --git a/pcs/lib/commands/resource.py b/pcs/lib/commands/resource.py
|
|
|
1f8f5b |
index 1ad03a48..ad7a1a20 100644
|
|
|
129887 |
--- a/pcs/lib/commands/resource.py
|
|
|
129887 |
+++ b/pcs/lib/commands/resource.py
|
|
|
1f8f5b |
@@ -79,7 +79,8 @@ def _validate_remote_connection(
|
|
|
129887 |
report_list.append(
|
|
|
129887 |
reports.get_problem_creator(
|
|
|
129887 |
report_codes.FORCE_NOT_SUITABLE_COMMAND,
|
|
|
129887 |
- allow_not_suitable_command
|
|
|
129887 |
+ is_forced=True,
|
|
|
129887 |
+ # allow_not_suitable_command
|
|
|
129887 |
)(reports.use_command_node_add_remote)
|
|
|
129887 |
)
|
|
|
129887 |
|
|
|
1f8f5b |
@@ -109,7 +110,8 @@ def _validate_guest_change(
|
|
|
129887 |
report_list.append(
|
|
|
129887 |
reports.get_problem_creator(
|
|
|
129887 |
report_codes.FORCE_NOT_SUITABLE_COMMAND,
|
|
|
129887 |
- allow_not_suitable_command
|
|
|
129887 |
+ is_forced=True
|
|
|
129887 |
+ # allow_not_suitable_command
|
|
|
129887 |
)(create_report)
|
|
|
129887 |
)
|
|
|
129887 |
|
|
|
129887 |
diff --git a/pcs/test/cib_resource/test_create.py b/pcs/test/cib_resource/test_create.py
|
|
|
129887 |
index 57d95350..3cd49e74 100644
|
|
|
129887 |
--- a/pcs/test/cib_resource/test_create.py
|
|
|
129887 |
+++ b/pcs/test/cib_resource/test_create.py
|
|
|
129887 |
@@ -1627,11 +1627,10 @@ class FailOrWarnGroup(ResourceTestLocal):
|
|
|
129887 |
)
|
|
|
129887 |
|
|
|
129887 |
def test_fail_when_on_pacemaker_remote_attempt(self):
|
|
|
129887 |
- self.assert_pcs_fail(
|
|
|
129887 |
+ self.assert_pcs_success(
|
|
|
129887 |
"resource create R2 ocf:pacemaker:remote",
|
|
|
129887 |
- "Error: this command is not sufficient for creating a remote"
|
|
|
129887 |
- " connection, use 'pcs cluster node add-remote'"
|
|
|
129887 |
- ", use --force to override\n"
|
|
|
129887 |
+ "Warning: this command is not sufficient for creating a remote"
|
|
|
129887 |
+ " connection, use 'pcs cluster node add-remote'\n"
|
|
|
129887 |
)
|
|
|
129887 |
|
|
|
129887 |
def test_warn_when_on_pacemaker_remote_attempt(self):
|
|
|
129887 |
@@ -1731,10 +1730,10 @@ class FailOrWarnGroup(ResourceTestLocal):
|
|
|
129887 |
)
|
|
|
129887 |
|
|
|
129887 |
def test_fail_when_on_pacemaker_remote_guest_attempt(self):
|
|
|
129887 |
- self.assert_pcs_fail(
|
|
|
129887 |
+ self.assert_pcs_success(
|
|
|
129887 |
"resource create R2 ocf:heartbeat:Dummy meta remote-node=HOST",
|
|
|
129887 |
- "Error: this command is not sufficient for creating a guest node,"
|
|
|
129887 |
- " use 'pcs cluster node add-guest', use --force to override\n"
|
|
|
129887 |
+ "Warning: this command is not sufficient for creating a guest node,"
|
|
|
129887 |
+ " use 'pcs cluster node add-guest'\n"
|
|
|
129887 |
)
|
|
|
129887 |
|
|
|
129887 |
def test_warn_when_on_pacemaker_remote_guest_attempt(self):
|
|
|
129887 |
diff --git a/pcs/test/test_resource.py b/pcs/test/test_resource.py
|
|
|
1f8f5b |
index e49b59a1..fed8465e 100644
|
|
|
129887 |
--- a/pcs/test/test_resource.py
|
|
|
129887 |
+++ b/pcs/test/test_resource.py
|
|
|
1f8f5b |
@@ -5872,10 +5872,10 @@ class ResourceUpdateRemoteAndGuestChecks(unittest.TestCase, AssertPcsMixin):
|
|
|
129887 |
self.assert_pcs_success(
|
|
|
129887 |
"resource create R ocf:heartbeat:Dummy",
|
|
|
129887 |
)
|
|
|
129887 |
- self.assert_pcs_fail(
|
|
|
129887 |
+ self.assert_pcs_success(
|
|
|
129887 |
"resource update R meta remote-node=HOST",
|
|
|
129887 |
- "Error: this command is not sufficient for creating a guest node,"
|
|
|
129887 |
- " use 'pcs cluster node add-guest', use --force to override\n"
|
|
|
129887 |
+ "Warning: this command is not sufficient for creating a guest node,"
|
|
|
129887 |
+ " use 'pcs cluster node add-guest'\n"
|
|
|
129887 |
)
|
|
|
129887 |
def test_update_warn_on_pacemaker_guest_attempt(self):
|
|
|
129887 |
self.assert_pcs_success(
|
|
|
1f8f5b |
@@ -5894,10 +5894,10 @@ class ResourceUpdateRemoteAndGuestChecks(unittest.TestCase, AssertPcsMixin):
|
|
|
129887 |
"Warning: this command is not sufficient for creating a guest node,"
|
|
|
129887 |
" use 'pcs cluster node add-guest'\n"
|
|
|
129887 |
)
|
|
|
129887 |
- self.assert_pcs_fail(
|
|
|
129887 |
+ self.assert_pcs_success(
|
|
|
129887 |
"resource update R meta remote-node=",
|
|
|
129887 |
- "Error: this command is not sufficient for removing a guest node,"
|
|
|
129887 |
- " use 'pcs cluster node remove-guest', use --force to override\n"
|
|
|
129887 |
+ "Warning: this command is not sufficient for removing a guest node,"
|
|
|
129887 |
+ " use 'pcs cluster node remove-guest'\n"
|
|
|
129887 |
)
|
|
|
129887 |
|
|
|
129887 |
def test_update_warn_on_pacemaker_guest_attempt_remove(self):
|
|
|
1f8f5b |
@@ -5918,10 +5918,10 @@ class ResourceUpdateRemoteAndGuestChecks(unittest.TestCase, AssertPcsMixin):
|
|
|
129887 |
self.assert_pcs_success(
|
|
|
129887 |
"resource create R ocf:heartbeat:Dummy",
|
|
|
129887 |
)
|
|
|
129887 |
- self.assert_pcs_fail(
|
|
|
129887 |
+ self.assert_pcs_success(
|
|
|
129887 |
"resource meta R remote-node=HOST",
|
|
|
129887 |
- "Error: this command is not sufficient for creating a guest node,"
|
|
|
129887 |
- " use 'pcs cluster node add-guest', use --force to override\n"
|
|
|
129887 |
+ "Warning: this command is not sufficient for creating a guest node,"
|
|
|
129887 |
+ " use 'pcs cluster node add-guest'\n"
|
|
|
129887 |
)
|
|
|
129887 |
|
|
|
129887 |
def test_meta_warn_on_pacemaker_guest_attempt(self):
|
|
|
1f8f5b |
@@ -5942,10 +5942,10 @@ class ResourceUpdateRemoteAndGuestChecks(unittest.TestCase, AssertPcsMixin):
|
|
|
129887 |
"Warning: this command is not sufficient for creating a guest node,"
|
|
|
129887 |
" use 'pcs cluster node add-guest'\n"
|
|
|
129887 |
)
|
|
|
129887 |
- self.assert_pcs_fail(
|
|
|
129887 |
+ self.assert_pcs_success(
|
|
|
129887 |
"resource meta R remote-node=",
|
|
|
129887 |
- "Error: this command is not sufficient for removing a guest node,"
|
|
|
129887 |
- " use 'pcs cluster node remove-guest', use --force to override\n"
|
|
|
129887 |
+ "Warning: this command is not sufficient for removing a guest node,"
|
|
|
129887 |
+ " use 'pcs cluster node remove-guest'\n"
|
|
|
129887 |
)
|
|
|
129887 |
|
|
|
129887 |
def test_meta_warn_on_pacemaker_guest_attempt_remove(self):
|
|
|
129887 |
--
|
|
|
129887 |
2.21.0
|
|
|
129887 |
|