|
|
f778fe |
From e13624ef5b2171516979827dcbe7ff03eb8247e5 Mon Sep 17 00:00:00 2001
|
|
|
f778fe |
From: Tomas Jelinek <tojeline@redhat.com>
|
|
|
f778fe |
Date: Wed, 31 May 2017 07:39:23 +0200
|
|
|
f778fe |
Subject: [PATCH] squash 1176018 remote guest nodes crashes fixed
|
|
|
f778fe |
|
|
|
f778fe |
c7a24e6 fix adding a node to a stopped cluster
|
|
|
f778fe |
|
|
|
f778fe |
88ad6e6 fix 'pcs cluster restore' command for pcmk authkey
|
|
|
f778fe |
|
|
|
f778fe |
e4b768c fix crash of 'pcs cluster destroy --all'
|
|
|
f778fe |
|
|
|
f778fe |
6b15785 fix crash of 'pcs cluster setup --force'
|
|
|
f778fe |
---
|
|
|
f778fe |
pcs/cluster.py | 33 +++++++++++++++++++++++++--------
|
|
|
f778fe |
pcs/config.py | 4 ++--
|
|
|
f778fe |
2 files changed, 27 insertions(+), 10 deletions(-)
|
|
|
f778fe |
|
|
|
f778fe |
diff --git a/pcs/cluster.py b/pcs/cluster.py
|
|
|
f778fe |
index d64194d..b47db4a 100644
|
|
|
f778fe |
--- a/pcs/cluster.py
|
|
|
f778fe |
+++ b/pcs/cluster.py
|
|
|
f778fe |
@@ -425,9 +425,9 @@ def cluster_setup(argv):
|
|
|
f778fe |
else:
|
|
|
f778fe |
# verify and ensure no cluster is set up on the nodes
|
|
|
f778fe |
# checks that nodes are authenticated as well
|
|
|
f778fe |
+ lib_env = utils.get_lib_env()
|
|
|
f778fe |
if "--force" not in utils.pcs_options:
|
|
|
f778fe |
all_nodes_available = True
|
|
|
f778fe |
- lib_env = utils.get_lib_env()
|
|
|
f778fe |
for node in primary_addr_list:
|
|
|
f778fe |
available, message = utils.canAddNodeToCluster(
|
|
|
f778fe |
lib_env.node_communicator(),
|
|
|
f778fe |
@@ -1757,9 +1757,12 @@ def node_add(lib_env, node0, node1, modifiers):
|
|
|
f778fe |
NodeAddressesList([node_addr]),
|
|
|
f778fe |
)
|
|
|
f778fe |
|
|
|
f778fe |
+ # do not send pcmk authkey to guest and remote nodes, they either have
|
|
|
f778fe |
+ # it or are not working anyway
|
|
|
f778fe |
+ # if the cluster is stopped, we cannot get the cib anyway
|
|
|
f778fe |
_share_authkey(
|
|
|
f778fe |
lib_env,
|
|
|
f778fe |
- get_nodes(lib_env.get_corosync_conf(), lib_env.get_cib()),
|
|
|
f778fe |
+ get_nodes(lib_env.get_corosync_conf()),
|
|
|
f778fe |
node_addr,
|
|
|
f778fe |
allow_incomplete_distribution=modifiers["skip_offline_nodes"]
|
|
|
f778fe |
)
|
|
|
f778fe |
@@ -2112,15 +2115,29 @@ def cluster_reload(argv):
|
|
|
f778fe |
# Code taken from cluster-clean script in pacemaker
|
|
|
f778fe |
def cluster_destroy(argv):
|
|
|
f778fe |
if "--all" in utils.pcs_options:
|
|
|
f778fe |
+ # destroy remote and guest nodes
|
|
|
f778fe |
+ cib = None
|
|
|
f778fe |
lib_env = utils.get_lib_env()
|
|
|
f778fe |
- all_remote_nodes = get_nodes(tree=lib_env.get_cib())
|
|
|
f778fe |
- if len(all_remote_nodes) > 0:
|
|
|
f778fe |
- _destroy_pcmk_remote_env(
|
|
|
f778fe |
- lib_env,
|
|
|
f778fe |
- all_remote_nodes,
|
|
|
f778fe |
- allow_fails=True
|
|
|
f778fe |
+ try:
|
|
|
f778fe |
+ cib = lib_env.get_cib()
|
|
|
f778fe |
+ except LibraryError as e:
|
|
|
f778fe |
+ warn(
|
|
|
f778fe |
+ "Unable to load CIB to get guest and remote nodes from it, "
|
|
|
f778fe |
+ "those nodes will not be deconfigured."
|
|
|
f778fe |
)
|
|
|
f778fe |
+ if cib is not None:
|
|
|
f778fe |
+ try:
|
|
|
f778fe |
+ all_remote_nodes = get_nodes(tree=cib)
|
|
|
f778fe |
+ if len(all_remote_nodes) > 0:
|
|
|
f778fe |
+ _destroy_pcmk_remote_env(
|
|
|
f778fe |
+ lib_env,
|
|
|
f778fe |
+ all_remote_nodes,
|
|
|
f778fe |
+ allow_fails=True
|
|
|
f778fe |
+ )
|
|
|
f778fe |
+ except LibraryError as e:
|
|
|
f778fe |
+ utils.process_library_reports(e.args)
|
|
|
f778fe |
|
|
|
f778fe |
+ # destroy full-stack nodes
|
|
|
f778fe |
destroy_cluster(utils.getNodesFromCorosyncConf())
|
|
|
f778fe |
else:
|
|
|
f778fe |
print("Shutting down pacemaker/corosync services...")
|
|
|
f778fe |
diff --git a/pcs/config.py b/pcs/config.py
|
|
|
f778fe |
index 94191e1..5526eb5 100644
|
|
|
f778fe |
--- a/pcs/config.py
|
|
|
f778fe |
+++ b/pcs/config.py
|
|
|
f778fe |
@@ -446,12 +446,12 @@ def config_backup_path_list(with_uid_gid=False, force_rhel6=None):
|
|
|
f778fe |
"uname": settings.pacemaker_uname,
|
|
|
f778fe |
"gname": settings.pacemaker_gname,
|
|
|
f778fe |
}
|
|
|
f778fe |
- pcmk_authkey_attrs = dict(cib_attrs)
|
|
|
f778fe |
- pcmk_authkey_attrs["mode"] = 0o440
|
|
|
f778fe |
if with_uid_gid:
|
|
|
f778fe |
cib_attrs["uid"] = _get_uid(cib_attrs["uname"])
|
|
|
f778fe |
cib_attrs["gid"] = _get_gid(cib_attrs["gname"])
|
|
|
f778fe |
|
|
|
f778fe |
+ pcmk_authkey_attrs = dict(cib_attrs)
|
|
|
f778fe |
+ pcmk_authkey_attrs["mode"] = 0o440
|
|
|
f778fe |
file_list = {
|
|
|
f778fe |
"cib.xml": {
|
|
|
f778fe |
"path": os.path.join(settings.cib_dir, "cib.xml"),
|
|
|
f778fe |
--
|
|
|
f778fe |
1.8.3.1
|
|
|
f778fe |
|