Bug 1725849

Summary: 'pcs resource bundle reset' fails if existing port-map and storage-map ids are reused
Product: Red Hat Enterprise Linux 7 Reporter: Tomas Jelinek <tojeline>
Component: pcsAssignee: Ivan Devat <idevat>
Status: CLOSED ERRATA QA Contact: cluster-qe <cluster-qe>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 7.7CC: aherr, cfeist, cluster-maint, idevat, michele, mjuricek, mlisik, omular, tojeline
Target Milestone: rcKeywords: ZStream
Target Release: 7.8   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: pcs-0.9.168-1.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1734687 (view as bug list) Environment:
Last Closed: 2020-03-31 19:09:41 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:
Bug Depends On:    
Bug Blocks: 1734687    
Attachments:
Description Flags
proposed fix none

Description Tomas Jelinek 2019-07-01 14:46:17 UTC
Description of problem:
The 'pcs resource bundle reset' command fails when port-map or storage-map IDs of the specified existing bundle are reused in it.


Version-Release number of selected component (if applicable):
pcs-0.9.167-3.el7


How reproducible:
always, easily


Steps to Reproduce:
1. [root@virt-422 ~]# pcs resource bundle create BundleTest \
>   container docker \
>     image="pcstest:bundle-1" \
>     run-command=/usr/sbin/pacemaker_remoted \
>   network \
>     control-port=5000 \
>   port-map \
>     id=port-map-1 \
>     range=5000-5005 \
>   port-map \
>     id=port-map-2 \
>     port=50000 \
>     internal-port=5000 \
>   storage-map \
>     id=storage-map-1 \
>     source-dir=/tmp/bundles/1 \
>     target-dir=/tmp/1 \
>     options=ro \
>   storage-map \
>     id=storage-map-2 \
>     source-dir=/tmp/bundles/2 \
>     target-dir=/tmp/2 \
>     options=ro \
>   storage-map \
>     id=storage-map-3 \
>     source-dir=/tmp/bundles/3 \
>     target-dir=/tmp/3 \
>     options=ro \
>   meta \
>     bundle-meta-1=bundle-value-1 \
>     bundle-meta-2=bundle-value-2 \
>     --wait
resource 'BundleTest' is running on node 'virt-422'

2. # pcs resource bundle reset BundleTest \
>   container docker \
>     image="pcstest:bundle-1" \
>     run-command=/usr/sbin/pacemaker_remoted \
>   network \
>     control-port=5000 \
>   port-map \
>     id=port-map-1 \
>     range=5000-5005 \
>   storage-map \
>     id=storage-map-1 \
>     source-dir=/tmp/bundles/1 \
>     target-dir=/tmp/1 \
>     options=ro \
>   storage-map \
>     id=storage-map-2 \
>     source-dir=/tmp/bundles/2 \
>     target-dir=/tmp/2 \
>     options=ro \
>   meta \
>     bundle-meta-1=bundle-value-1 \
>     bundle-meta-2=bundle-value-2 \
>     --wait
Error: 'BundleTest' already exists
Error: 'port-map-1' already exists
Error: 'storage-map-1' already exists
Error: 'storage-map-2' already exists
[root@virt-422 ~]#
[root@virt-422 ~]# echo $?
1


Actual results:
The reset command fails saying IDs already exist.


Expected results:
The command succeeds and reconfigures the bundle.

Comment 2 Ivan Devat 2019-07-22 07:24:42 UTC
Created attachment 1592527 [details]
proposed fix

For tests see bz1657166#c12

Comment 6 Ivan Devat 2019-08-05 11:24:37 UTC
After Fix:

[kid76 ~] $ rpm -q pcs
pcs-0.9.168-1.el7.x86_64

[kid76 ~] $ pcs resource bundle create B1 container docker image=pcs:new port-map id=PM1 range=4000-4400 storage-map id=SM1 source-dir=/tmp/a target-dir=/tmp/b
[kid76 ~] $ pcs resource bundle reset B1 container image=pcs:new port-map id=PM1 range=4000-4400 storage-map id=SM1 source-dir=/tmp/a target-dir=/tmp/b
[kid76 ~] $ echo $?
0

Comment 10 errata-xmlrpc 2020-03-31 19:09:41 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-2020:0996