Bug 1014641 - ocf:heartbeat:VirtualDomain bash comparison error when calling 'stop'
ocf:heartbeat:VirtualDomain bash comparison error when calling 'stop'
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: resource-agents (Show other bugs)
7.0
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: David Vossel
Cluster QE
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-02 09:11 EDT by michal novacek
Modified: 2014-06-17 19:56 EDT (History)
3 users (show)

See Also:
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 07:44:45 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Fixes force stop error (407 bytes, patch)
2013-10-02 10:58 EDT, David Vossel
no flags Details | Diff

  None (edit)
Description michal novacek 2013-10-02 09:11:39 EDT
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 10:58:08 EDT
Created attachment 806530 [details]
Fixes force stop error
Comment 3 David Vossel 2013-10-02 11:03:54 EDT
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 08:25:38 EDT
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 07:44:45 EDT
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.

Note You need to log in before you can comment on or make changes to this bug.