RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1014641 - ocf:heartbeat:VirtualDomain bash comparison error when calling 'stop'
Summary: ocf:heartbeat:VirtualDomain bash comparison error when calling 'stop'
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: resource-agents
Version: 7.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: David Vossel
QA Contact: Cluster QE
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-10-02 13:11 UTC by michal novacek
Modified: 2014-06-17 23:56 UTC (History)
3 users (show)

Fixed In Version: resource-agents-3.9.5-16.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-06-13 11:44:45 UTC
Target Upstream Version:
Embargoed:


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

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.


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