From fedadee0788fc4841bd4b2df03cabd35c57d0f2d Mon Sep 17 00:00:00 2001 From: Chris Feist Date: Tue, 6 Oct 2015 15:54:25 -0500 Subject: [PATCH] Fixed issue with 'resource manage' not removing meta attribute from clones or masters --- pcs/resource.py | 8 +++- pcs/test/test_resource.py | 108 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 114 insertions(+), 2 deletions(-) diff --git a/pcs/resource.py b/pcs/resource.py index 4c4b8ee..e50e20b 100644 --- a/pcs/resource.py +++ b/pcs/resource.py @@ -2349,11 +2349,15 @@ def resource_manage(argv, set_managed): if retval != 0: utils.err("error attempting to unmanage resource: %s" % output) else: - xpath = "(//primitive|//group)[@id='"+resource+"']/meta_attributes/nvpair[@name='is-managed']" + # Remove the meta attribute from the id specified + xpath = "(//primitive|//group|//clone|//master)[@id='"+resource+"']/meta_attributes/nvpair[@name='is-managed']" + utils.run(["cibadmin", "-D", "--xpath", xpath]) + # Remove the meta attribute from the parent of the id specified, if the parent is a clone or master + xpath = "(//master|//clone)[primitive[contains(@id, '"+resource+"')]]/meta_attributes/nvpair[@name='is-managed']" utils.run(["cibadmin", "-D", "--xpath", xpath]) if isGroup: for res in res_to_manage: - xpath = "(//primitive|//group)[@id='"+res+"']/meta_attributes/nvpair[@name='is-managed']" + xpath = "(//primitive|//group|//clone|//master)[@id='"+res+"']/meta_attributes/nvpair[@name='is-managed']" utils.run(["cibadmin", "-D", "--xpath", xpath]) def is_managed(resource_id):