diff --git a/.pcs.metadata b/.pcs.metadata index e39b7ea..68b2d71 100644 --- a/.pcs.metadata +++ b/.pcs.metadata @@ -1,3 +1,4 @@ +80dc7788a3468fb7dd362a4b8bedd9efb373de89 SOURCES/HAM-logo.png 5c9dd0d5552d242ee6bb338a9097e85f0a0a45d5 SOURCES/backports-3.6.8.gem 60b6f1d8391cd374c6a2ef3977cb1397ed89055a SOURCES/eventmachine-1.2.0.1.gem baa3446eb63557a24c4522dc5a61cfad082fa395 SOURCES/mock-1.0.1.tar.gz @@ -12,5 +13,3 @@ a90e5a60d99445404a3c29a66d953a5e9918976d SOURCES/rpam-ruby19-1.2.1.gem 1c7f1ad8af670f4990373ebddb4d9fecd8f3c7d1 SOURCES/sinatra-1.4.7.gem 83742328f21b684d6ce6c4747710c6e975b608e7 SOURCES/sinatra-contrib-1.4.7.gem 49bee6e8614c1e991c1156150b0a2eaa28868f8d SOURCES/tilt-2.0.3.gem -9c06bb646aba6330d4d85fe08415cdd2276fe918 SOURCES/HAM-logo.png -062c9973625dced9a54a2f83a7baf7696ac37d60 SOURCES/favicon.ico diff --git a/SOURCES/bz1404233-01-cluster-cib-push-allows-to-obtain-and-push-a-diff.patch b/SOURCES/bz1404233-01-cluster-cib-push-allows-to-obtain-and-push-a-diff.patch new file mode 100644 index 0000000..724c0bb --- /dev/null +++ b/SOURCES/bz1404233-01-cluster-cib-push-allows-to-obtain-and-push-a-diff.patch @@ -0,0 +1,147 @@ +From 24f48d185b03b3bcff28d78a3be657f2a1295e4b Mon Sep 17 00:00:00 2001 +From: Tomas Jelinek +Date: Fri, 6 Jan 2017 15:26:11 +0100 +Subject: [PATCH] 'cluster cib-push' allows to obtain and push a diff + +--- + pcs/cluster.py | 43 +++++++++++++++++++++++++++++++++++++------ + pcs/pcs.8 | 10 ++++++++-- + pcs/usage.py | 14 +++++++++++--- + 3 files changed, 56 insertions(+), 11 deletions(-) + +diff --git a/pcs/cluster.py b/pcs/cluster.py +index 4572643..69e2852 100644 +--- a/pcs/cluster.py ++++ b/pcs/cluster.py +@@ -1192,6 +1192,8 @@ def cluster_push(argv): + filename = None + scope = None + timeout = None ++ diff_against = None ++ + if "--wait" in utils.pcs_options: + timeout = utils.validate_wait_get_timeout() + for arg in argv: +@@ -1204,6 +1206,8 @@ def cluster_push(argv): + utils.err("invalid CIB scope '%s'" % arg_value) + else: + scope = arg_value ++ if arg_name == "diff-against": ++ diff_against = arg_value + else: + usage.cluster(["cib-push"]) + sys.exit(1) +@@ -1212,6 +1216,8 @@ def cluster_push(argv): + if not filename: + usage.cluster(["cib-push"]) + sys.exit(1) ++ if diff_against and scope: ++ utils.err("Cannot use both scope and diff-against") + + try: + new_cib_dom = xml.dom.minidom.parse(filename) +@@ -1223,13 +1229,38 @@ def cluster_push(argv): + except (EnvironmentError, xml.parsers.expat.ExpatError) as e: + utils.err("unable to parse new cib: %s" % e) + +- command = ["cibadmin", "--replace", "--xml-file", filename] +- if scope: +- command.append("--scope=%s" % scope) +- output, retval = utils.run(command) +- if retval != 0: +- utils.err("unable to push cib\n" + output) ++ if diff_against: ++ try: ++ xml.dom.minidom.parse(diff_against) ++ except (EnvironmentError, xml.parsers.expat.ExpatError) as e: ++ utils.err("unable to parse original cib: %s" % e) ++ runner = utils.cmd_runner() ++ command = [ ++ "crm_diff", "--original", diff_against, "--new", filename, ++ "--no-version" ++ ] ++ patch, error, dummy_retval = runner.run(command) ++ # dummy_retval == -1 means one of two things: ++ # a) an error has occured ++ # b) --original and --new differ ++ if error.strip(): ++ utils.err("unable to diff the CIBs:\n" + error) ++ ++ command = ["cibadmin", "--patch", "--xml-pipe"] ++ output, error, retval = runner.run(command, patch) ++ if retval != 0: ++ utils.err("unable to push cib\n" + error + output) ++ ++ else: ++ command = ["cibadmin", "--replace", "--xml-file", filename] ++ if scope: ++ command.append("--scope=%s" % scope) ++ output, retval = utils.run(command) ++ if retval != 0: ++ utils.err("unable to push cib\n" + output) ++ + print("CIB updated") ++ + if "--wait" not in utils.pcs_options: + return + cmd = ["crm_resource", "--wait"] +diff --git a/pcs/pcs.8 b/pcs/pcs.8 +index dffaddd..bf4b859 100644 +--- a/pcs/pcs.8 ++++ b/pcs/pcs.8 +@@ -262,8 +262,14 @@ Sync corosync configuration to all nodes found from current corosync.conf file ( + cib [filename] [scope= | \fB\-\-config\fR] + Get the raw xml from the CIB (Cluster Information Base). If a filename is provided, we save the CIB to that file, otherwise the CIB is printed. Specify scope to get a specific section of the CIB. Valid values of the scope are: configuration, nodes, resources, constraints, crm_config, rsc_defaults, op_defaults, status. \fB\-\-config\fR is the same as scope=configuration. Do not specify a scope if you want to edit the saved CIB using pcs (pcs -f ). + .TP +-cib-push [scope= | \fB\-\-config\fR] [\fB\-\-wait\fR[=]] +-Push the raw xml from to the CIB (Cluster Information Base). You can obtain the CIB by running the 'pcs cluster cib' command, which is recommended first step when you want to perform desired modifications (pcs \fB\-f\fR ) for the one-off push. Specify scope to push a specific section of the CIB. Valid values of the scope are: configuration, nodes, resources, constraints, crm_config, rsc_defaults, op_defaults. \fB\-\-config\fR is the same as scope=configuration. Use of \fB\-\-config\fR is recommended. Do not specify a scope if you need to push the whole CIB or be warned in the case of outdated CIB. If --wait is specified wait up to 'n' seconds for changes to be applied. WARNING: the selected scope of the CIB will be overwritten by the current content of the specified file. ++cib-push [diff\-against= scope= | \fB\-\-config\fR] [\fB\-\-wait\fR[=]] ++Push the raw xml from to the CIB (Cluster Information Base). You can obtain the CIB by running the 'pcs cluster cib' command, which is recommended first step when you want to perform desired modifications (pcs \fB\-f\fR ) for the one\-off push. If diff\-against is specified, pcs diffs contents of filename against contents of filename_original and pushes the result to the CIB. Specify scope to push a specific section of the CIB. Valid values of the scope are: configuration, nodes, resources, constraints, crm_config, rsc_defaults, op_defaults. \fB\-\-config\fR is the same as scope=configuration. Use of \fB\-\-config\fR is recommended. Do not specify a scope if you need to push the whole CIB or be warned in the case of outdated CIB. If --wait is specified wait up to 'n' seconds for changes to be applied. WARNING: the selected scope of the CIB will be overwritten by the current content of the specified file. ++ ++Example: ++ pcs cluster cib > original.xml ++ cp original.xml new.xml ++ pcs -f new.xml constraint location apache prefers node2 ++ pcs cluster cib-push new.xml diff-against=original.xml + .TP + cib\-upgrade + Upgrade the CIB to conform to the latest version of the document schema. +diff --git a/pcs/usage.py b/pcs/usage.py +index 0ebebe0..b33da35 100644 +--- a/pcs/usage.py ++++ b/pcs/usage.py +@@ -656,20 +656,28 @@ Commands: + scope=configuration. Do not specify a scope if you want to edit + the saved CIB using pcs (pcs -f ). + +- cib-push [scope= | --config] [--wait[=]] ++ cib-push [--wait[=]] ++ [diff-against= | scope= | --config] + Push the raw xml from to the CIB (Cluster Information Base). + You can obtain the CIB by running the 'pcs cluster cib' command, which + is recommended first step when you want to perform desired + modifications (pcs -f ) for the one-off push. ++ If diff-against is specified, pcs diffs contents of filename against ++ contents of filename_original and pushes the result to the CIB. + Specify scope to push a specific section of the CIB. Valid values + of the scope are: configuration, nodes, resources, constraints, + crm_config, rsc_defaults, op_defaults. --config is the same as + scope=configuration. Use of --config is recommended. Do not specify + a scope if you need to push the whole CIB or be warned in the case +- of outdated CIB. If --wait is specified wait up to 'n' seconds for +- changes to be applied. ++ of outdated CIB. ++ If --wait is specified wait up to 'n' seconds for changes to be applied. + WARNING: the selected scope of the CIB will be overwritten by the + current content of the specified file. ++ Example: ++ pcs cluster cib > original.xml ++ cp original.xml new.xml ++ pcs -f new.xml constraint location apache prefers node2 ++ pcs cluster cib-push new.xml diff-against=original.xml + + cib-upgrade + Upgrade the CIB to conform to the latest version of the document schema. +-- +1.8.3.1 + diff --git a/SOURCES/bz1408476-01-accept-RA-with-instantiated-systemd-service-in-name.patch b/SOURCES/bz1408476-01-accept-RA-with-instantiated-systemd-service-in-name.patch new file mode 100644 index 0000000..c3020b3 --- /dev/null +++ b/SOURCES/bz1408476-01-accept-RA-with-instantiated-systemd-service-in-name.patch @@ -0,0 +1,30 @@ +From efd4958f35d7760bd4d80c4d82e257708c25416d Mon Sep 17 00:00:00 2001 +From: Ivan Devat +Date: Fri, 6 Jan 2017 09:06:35 +0100 +Subject: [PATCH] accept RA with instantiated systemd serv. in name + +Accept resource agent with instantiated systemd service in name. +--- + pcs/utils.py | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/pcs/utils.py b/pcs/utils.py +index d5b6dcf..6daecf3 100644 +--- a/pcs/utils.py ++++ b/pcs/utils.py +@@ -1524,6 +1524,12 @@ def is_valid_resource(resource, caseInsensitiveCheck=False): + return is_file_abs_path(agent) + elif resource.startswith("systemd:"): + _, agent_name = resource.split(":", 1) ++ # For Instantiated services we need to make sure that the ++ # @.service file exists ++ # For example: we need recognize systemd:getty@tty3 as existing service. ++ if '@' in agent_name: ++ agent_name, instance_name = agent_name.split("@", 1) ++ agent_name += '@' + agent1 = os.path.join( + "/etc/systemd/system/", agent_name + ".service" + ) +-- +1.8.3.1 + diff --git a/SPECS/pcs.spec b/SPECS/pcs.spec index fc6e173..3238bab 100644 --- a/SPECS/pcs.spec +++ b/SPECS/pcs.spec @@ -1,6 +1,6 @@ Name: pcs Version: 0.9.152 -Release: 10%{?dist} +Release: 10%{?dist}.1 License: GPLv2 URL: https://github.com/ClusterLabs/pcs Group: System Environment/Base @@ -25,7 +25,6 @@ Source12: https://rubygems.org/downloads/sinatra-contrib-1.4.7.gem Source13: https://rubygems.org/downloads/sinatra-1.4.7.gem Source14: https://rubygems.org/downloads/tilt-2.0.3.gem Source15: https://github.com/testing-cabal/mock/archive/1.0.1.tar.gz#/mock-1.0.1.tar.gz -Source99: favicon.ico Patch0: bz1315371-01-add-support-for-pacemaker-alerts.patch Patch1: bz1158805-01-add-support-for-qdevice-qnetd-provided-.patch @@ -85,6 +84,8 @@ Patch53: bz1305049-02-pcs-does-not-support-ticket-constraints.patch Patch54: rhel7.patch Patch55: change-cman-to-rhel6-in-messages.patch Patch56: show-only-warning-when-crm_mon-xml-is-invalid.patch +Patch57: bz1408476-01-accept-RA-with-instantiated-systemd-service-in-name.patch +Patch58: bz1404233-01-cluster-cib-push-allows-to-obtain-and-push-a-diff.patch BuildRequires: python2-devel python-setuptools BuildRequires: gcc gcc-c++ @@ -201,9 +202,12 @@ UpdateTimestamps -p1 %{PATCH51} UpdateTimestamps -p1 %{PATCH52} UpdateTimestamps -p1 %{PATCH53} UpdateTimestamps -p1 %{PATCH54} +UpdateTimestamps -p1 %{PATCH55} +UpdateTimestamps -p1 %{PATCH56} +UpdateTimestamps -p1 %{PATCH57} +UpdateTimestamps -p1 %{PATCH58} cp -f %SOURCE1 pcsd/public/images -cp -f %SOURCE99 pcsd/public mkdir -p pcsd/.bundle cp -f %SOURCE2 pcsd/.bundle/config @@ -348,8 +352,10 @@ run_all_tests %doc COPYING README %changelog -* Tue Nov 15 2016 Johnny Hughes - 0.9.152-10 -- Roll in CentOS Branding (centos bug #9426) +* Mon Jan 16 2017 Ivan Devat - 0.9.152-10.el7_3.1 +- Fixed resolving resource agent name containing systemd service instance +- Added posibility to push only diff of cib in 'cluster cib push' +- Resolves: rhbz#1408476 rhbz#1404233 * Tue Sep 20 2016 Ivan Devat - 0.9.152-10 - Fixed error when stopping qdevice if is not running