Bug 1014641

Summary: ocf:heartbeat:VirtualDomain bash comparison error when calling 'stop'
Product: Red Hat Enterprise Linux 7 Reporter: michal novacek <mnovacek>
Component: resource-agentsAssignee: David Vossel <dvossel>
Status: CLOSED CURRENTRELEASE QA Contact: Cluster QE <mspqa-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.0CC: agk, cluster-maint, fdinitto
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: resource-agents-3.9.5-16.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-13 11:44:45 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
Fixes force stop error none

Description michal novacek 2013-10-02 13:11:39 UTC
Description of problem:
There is a check when calling 'stop' on whether the domain is running and it
ends with bash error "!=: unary operator expected" 

Version-Release number of selected component (if applicable):
resource-agents-3.9.5-15.el7.x86_64
pacemaker-1.1.10-15.el7.x86_64

How reproducible: always

Steps to Reproduce:
1/  export OCF_FUNCTIONS_DIR=/usr/lib/ocf/lib/heartbeat 
1a/ export OCF_RESKEY_config=/var/lib/pacemaker/cts/lxc/lxc1.xml 
1b/ export OCF_RESKEY_force_stop='yes'
2/ /usr/lib/ocf/resource.d/heartbeat/VirtualDomain start
3/ /usr/lib/ocf/resource.d/heartbeat/VirtualDomain stop

Actual results: error in bash comparison

Expected results: bash comparison done right


Additional info:
It probably has no effect on real function but does not look right.

Full list of commandline commands and their output:
# virsh -c lxc:/// list
 Id    Name                           State
----------------------------------------------------

# export  OCF_FUNCTIONS_DIR=/usr/lib/ocf/lib/heartbeat OCF_RESKEY_config=/var/lib/pacemaker/cts/lxc/lxc1.xml OCF_RESKEY_force_stop='yes'

# /usr/lib/ocf/resource.d/heartbeat/VirtualDomain start
DEBUG: Virtual domain lxc1 is currently error: failed to get domain 'lxc1'
error: Domain not found: No domain with matching name 'lxc1'.
Domain lxc1 created from /var/lib/pacemaker/cts/lxc/lxc1.xml
DEBUG: Virtual domain lxc1 is currently running.
WARNING: crm_resource failed to set utilization attribute cpu: Resource 'default' not found: No such device or address
Error performing operation: No such device or address
WARNING: crm_resource failed to set utilization attribute hv_memory: Resource 'default' not found: No such device or address
Error performing operation: No such device or address

# /usr/lib/ocf/resource.d/heartbeat/VirtualDomain status
DEBUG: Virtual domain lxc1 is currently running.

# virsh -c lxc:/// list
 Id    Name                           State
----------------------------------------------------
 30858 lxc1                           running

# /usr/lib/ocf/resource.d/heartbeat/VirtualDomain stop
DEBUG: Virtual domain lxc1 is currently running.
INFO: Issuing forced shutdown (destroy) request for domain lxc1.
Domain lxc1 destroyed
/usr/lib/ocf/resource.d/heartbeat/VirtualDomain: line 310: [: !=: unary operator expected

Comment 2 David Vossel 2013-10-02 14:58:08 UTC
Created attachment 806530 [details]
Fixes force stop error

Comment 3 David Vossel 2013-10-02 15:03:54 UTC
The bash comparison is fine.  The status local variable was not initialized.  I've uploaded a patch to fix this.

-- Vossel

Comment 5 michal novacek 2014-03-28 12:25:38 UTC
I have verified that the problem no longer exists in resource-agents-3.9.5-26.el7.x86_64

export OCF_RESKEY^Config=/var/lib/libvirt/lxc/duck-03-node01.xml OCF_RESKEY_hypervisor=lxc:///
[root@duck-03 ~]# vl
 Id    Name                           State
----------------------------------------------------

[root@duck-03 ~]# /usr/lib/ocf/resource.d/heartbeat/VirtualDomain start
DEBUG: Virtual domain duck-03-node01 is not running:  failed to get domain 'duck-03-node01'  domain not found: no domain with matching name 'duck-03-node01'
Domain duck-03-node01 created from /var/lib/libvirt/lxc/duck-03-node01.xml
DEBUG: Virtual domain duck-03-node01 is currently running.
WARNING: crm_resource failed to set utilization attribute cpu: Resource 'default' not found: No such device or address
Error performing operation: No such device or address
WARNING: crm_resource failed to set utilization attribute hv_memory: Resource 'default' not found: No such device or address
Error performing operation: No such device or address
[root@duck-03 ~]# /usr/lib/ocf/resource.d/heartbeat/VirtualDomain status
DEBUG: Virtual domain duck-03-node01 is currently running.
# /usr/lib/ocf/resource.d/heartbeat/VirtualDomain stop
DEBUG: Virtual domain duck-03-node01 is currently running.
INFO: Issuing graceful shutdown request for domain duck-03-node01.
Domain duck-03-node01 is being shutdown
DEBUG: Virtual domain duck-03-node01 is currently running.
...
DEBUG: Virtual domain duck-03-node01 is currently running.
INFO: Issuing forced shutdown (destroy) request for domain duck-03-node01.
domain duck-03-node01 destroyed
DEBUG: Virtual domain duck-03-node01 is not running:  failed to get domain 'duck-03-node01'  domain not found: no domain with matching name 'duck-03-node01'

Comment 6 Ludek Smid 2014-06-13 11:44:45 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.