Bug 1389941

Summary: 'pcs booth remove' doesn't remove resources properly if the booth group is disabled
Product: Red Hat Enterprise Linux 7 Reporter: Radek Steiger <rsteiger>
Component: pcsAssignee: Tomas Jelinek <tojeline>
Status: CLOSED ERRATA QA Contact: cluster-qe <cluster-qe>
Severity: unspecified Docs Contact:
Priority: medium    
Version: 7.3CC: cfeist, cluster-maint, idevat, omular, tojeline
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: pcs-0.9.157-1.el7 Doc Type: Bug Fix
Doc Text:
Cause: User runs the 'pcs booth remove' command when the booth resource group is disabled. Consequence: The booth resource group is not removed completely. Fix: Properly find the booth resource group in CIB even if it is disabled. Result: The booth resource group is completely removed.
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 18:24:40 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
proposed fix
none
proposed fix 2 none

Description Radek Steiger 2016-10-29 18:24:37 UTC
> Description of problem:

Removing booth resource and its IPaddr2 sibling with 'pcs remove commands' fails when the group is disabled, leaving the IP resource in place and removing the booth-site instance only. This however doesn't happen when the group as such is enabled, but any of the resources is either disabled or stopped.

[root@virt-019 ~]# pcs status
...
 Resource Group: booth-booth-group
     booth-booth-ip	(ocf::heartbeat:IPaddr2):	Started virt-029.cluster-qe.lab.eng.brq.redhat.com
     booth-booth-service	(ocf::pacemaker:booth-site):	Started virt-029.cluster-qe.lab.eng.brq.redhat.com
...
[root@virt-019 ~]# pcs resource disable booth-booth-group
[root@virt-019 ~]# pcs status
...
 Resource Group: booth-booth-group
     booth-booth-ip	(ocf::heartbeat:IPaddr2):	Stopped (disabled)
     booth-booth-service	(ocf::pacemaker:booth-site):	Stopped (disabled)
...
[root@virt-019 ~]# pcs booth remove
Deleting Resource - booth-booth-service
[root@virt-019 ~]# pcs status
...
 Resource Group: booth-booth-group
     booth-booth-ip	(ocf::heartbeat:IPaddr2):	Stopped (disabled)
...


> Version-Release number of selected component (if applicable):

pcs-0.9.152-10.el7.x86_64


> How reproducible:

Always


> Steps to Reproduce:

1. pcs resource disable booth-booth-group
2. pcs booth remove


> Actual results:

[root@virt-019 ~]# pcs status | grep booth
 Resource Group: booth-booth-group
     booth-booth-ip	(ocf::heartbeat:IPaddr2):	Stopped (disabled)
[root@virt-019 ~]#


> Expected results:

[root@virt-019 ~]# pcs status | grep booth
[root@virt-019 ~]#

Comment 2 Tomas Jelinek 2016-11-10 11:37:28 UTC
Created attachment 1219333 [details]
proposed fix

Test is included in the patch.

Comment 4 Ivan Devat 2017-02-20 07:41:58 UTC
After Fix:

[vm-rhel72-1 ~] $ rpm -q pcs
pcs-0.9.156-1.el7.x86_64
[vm-rhel72-1 ~] $ pcs resource
NO resources configured
[vm-rhel72-1 ~] $ booth create ip 192.168.122.120
client operation "create" is unknown
[vm-rhel72-1 ~] $ pcs booth create ip 192.168.122.120
[vm-rhel72-1 ~] $ pcs resource disable booth-booth-group
[vm-rhel72-1 ~] $ pcs resource show
 Resource Group: booth-booth-group
     booth-booth-ip     (ocf::heartbeat:IPaddr2):       Stopped (disabled)
     booth-booth-service        (ocf::pacemaker:booth-site):    Stopped (disabled)
[vm-rhel72-1 ~] $ pcs booth remove
Deleting Resource - booth-booth-ip
Deleting Resource (and group) - booth-booth-service
[vm-rhel72-1 ~] $ pcs resource show
NO resources configured

Comment 6 Tomas Jelinek 2017-03-13 09:13:25 UTC
Created attachment 1262357 [details]
proposed fix 2

Fixed crash when the group's meta_attributes are placed before the group's resources in the CIB. See the test included in the patch for details.

Comment 7 Ivan Devat 2017-04-10 15:55:39 UTC
After Fix:

[vm-rhel72-1 ~] $ rpm -q pcs
pcs-0.9.157-1.el7.x86_64

[vm-rhel72-1 ~] $ pcs resource
NO resources configured
[vm-rhel72-1 ~] $ pcs booth create ip 192.168.122.120
[vm-rhel72-1 ~] $ pcs resource disable booth-booth-group
[vm-rhel72-1 ~] $ pcs cluster cib|grep 'id="booth-booth-group"' -A4
      <group id="booth-booth-group">
        <meta_attributes id="booth-booth-group-meta_attributes">
          <nvpair id="booth-booth-group-meta_attributes-target-role" name="target-role" value="Stopped"/>
        </meta_attributes>
        <primitive class="ocf" id="booth-booth-ip" provider="heartbeat" type="IPaddr2">
[vm-rhel72-1 ~] $ pcs booth remove
Deleting Resource - booth-booth-ip
Deleting Resource (and group) - booth-booth-service
[vm-rhel72-1 ~] $ pcs resource
NO resources configured

> Note that meta_attributes element is placed before primitive elements.

Comment 11 errata-xmlrpc 2017-08-01 18:24:40 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:1958