Bug 1099881

Summary: move/ban of a stopped resource gives an error when node is not specified
Product: Red Hat Enterprise Linux 7 Reporter: Tomas Jelinek <tojeline>
Component: pcsAssignee: Tomas Jelinek <tojeline>
Status: CLOSED ERRATA QA Contact: Cluster QE <mspqa-list>
Severity: low Docs Contact:
Priority: low    
Version: 7.0CC: cfeist, cluster-maint, mjuricek, rsteiger, tojeline
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: pcs-0.9.126-1.el7 Doc Type: Bug Fix
Doc Text:
Cause: pcs does not detect that crm_resource is not able to ban stopped resource when node is not specified, because it is not possible to locate a node on which the resource is running. Consequence: crm_resource error message is presented to the user. The message is not very helpful because it is crm_resource specific. Fix: pcs detects that resource was not moved because crm_resource was not able to locate the resource node, and provides an explanatory error message. Result: User is informed about the cause of the error and how to avoid it.
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-05 09:19:34 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

Description Tomas Jelinek 2014-05-21 11:59:31 UTC
Description of problem:
Trying to move/ban a stopped resource without specifying the target node gives an error:
Error: error moving/banning/clearing resource
Resource 'dummy' not moved: active in 0 locations.
You can prevent 'dummy' from running on a specific location with: --ban --host <name>
Error performing operation: Invalid argument

Move/ban of a running resource works both with and without specifying the target node. Move/ban of a stopped resource with specifying the target node works too.


Version-Release number of selected component (if applicable):
pcs-0.9.115-32.el7


How reproducible:
always


Steps to Reproduce:
1. stop some resource e.g. 'pcs resource disable dummy'
2. try to move stopped resource without specifying the node: 'pcs resource move dummy'


Actual results:
Resource is not moved and an error message is presented to the user.
[root@localhost ~]# pcs resource move dummy
Error: error moving/banning/clearing resource
Resource 'dummy' not moved: active in 0 locations.
You can prevent 'dummy' from running on a specific location with: --ban --host <name>
Error performing operation: Invalid argument
[root@localhost pcs]# echo $?
1


Expected results:
Inform user that it is not possible to move/ban a stopped resource without specifying the target node.


Additional info:
pcs uses crm_resource for moving and baning the resources. crm_resource --move requires a target node specified otherwise it bans the resource on the node where the resource is currently running so the resource is moved to some other node. If the resource is stopped there is no node to put the ban on so crm_resource gives an error.

Comment 2 Tomas Jelinek 2014-05-22 09:27:03 UTC
Created attachment 898299 [details]
proposed fix

Comment 3 Tomas Jelinek 2014-05-22 09:42:56 UTC
Test:
1. create and stop a resource
[root@localhost ~]# pcs resource create dummy Dummy
[root@localhost ~]# pcs resource disable dummy

2. try to move the resource and check for error message
[root@localhost ~]# pcs resource move dummy
Error: You must specify a node when moving/banning a stopped resource

3. try to ban the resource and check for error message
[root@localhost ~]# pcs resource ban dummy
Error: You must specify a node when moving/banning a stopped resource

Comment 4 Tomas Jelinek 2014-09-11 09:08:54 UTC
Before Fix:
[root@rh70-node1 ~]# rpm -q pcs
pcs-0.9.115-32.el7.x86_64
[root@rh70-node1 ~]# pcs resource disable dummy
[root@rh70-node1 ~]# pcs resource move dummy
Error: error moving/banning/clearing resource
Resource 'dummy' not moved: active in 0 locations.
You can prevent 'dummy' from running on a specific location with: --ban --host <name>
Error performing operation: Invalid argument

[root@rh70-node1 ~]# echo $?
1


After Fix:
[root@rh70-node1 ~]# rpm -q pcs
pcs-0.9.126-1.el7.x86_64
[root@rh70-node1 ~]# pcs resource create dummy Dummy
[root@rh70-node1 ~]# pcs resource disable dummy
[root@rh70-node1 ~]# pcs resource move dummy
Error: You must specify a node when moving/banning a stopped resource
[root@rh70-node1 ~]# echo $?
1
[root@rh70-node1 ~]# pcs resource ban dummy
Error: You must specify a node when moving/banning a stopped resource
[root@rh70-node1 ~]# echo $?
1

Comment 8 errata-xmlrpc 2015-03-05 09:19:34 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://rhn.redhat.com/errata/RHBA-2015-0415.html