Bug 1287314

Summary: [NovaEvacuate] Simplify nova check
Product: Red Hat Enterprise Linux 7 Reporter: Andrew Beekhof <abeekhof>
Component: resource-agentsAssignee: Oyvind Albrigtsen <oalbrigt>
Status: CLOSED ERRATA QA Contact: Asaf Hirshberg <ahirshbe>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.2CC: abeekhof, agk, cluster-maint, fdinitto, mnovacek
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: resource-agents-3.9.5-67.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-04 00:00:14 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:

Description Andrew Beekhof 2015-12-01 23:16:01 UTC
Description of problem:

There is a simpler way to check if a node is known by nova before we try to evacuate it

Version-Release number of selected component (if applicable):

resource-agents-3.9.5-54.el7.x86_64

Additional info:

--- /usr/lib/ocf/resource.d/openstack/NovaEvacuate.orig	2015-11-30 21:53:57.868660753 -0500
+++ /usr/lib/ocf/resource.d/openstack/NovaEvacuate	2015-12-01 18:13:14.031530234 -0500
@@ -180,14 +180,8 @@
 	    found=0
 	    ocf_log notice "Initiating evacuation of $node"
 
-	    for known in $(fence_compute ${fence_options} -o list | tr -d ','); do
-		if [ ${known} = ${node} ]; then
-		    found=1
-		    break
-		fi
-	    done
-
-	    if [ $found = 0 ]; then
+	    fence_compute ${fence_options} -o status -n ${node}
+	    if [ $? != 0 ]; then
 		ocf_log info "Nova does not know about ${node}"
 		# Dont mark as no because perhaps nova is unavailable right now
 		continue

Comment 2 Oyvind Albrigtsen 2015-12-08 08:07:03 UTC
https://review.openstack.org/#/c/254516/

Comment 5 Andrew Beekhof 2016-03-10 22:08:33 UTC
Just that the instance HA feature still works

Comment 6 Asaf Hirshberg 2016-03-22 14:02:44 UTC
Verified: using director 8.0 puddle - 2016-03-11.1 & resource-agents-3.9.5-67.el7

pcs cluster stop --all
yum install -y brewkoji
brew search build resource-agents* | grep resource-agents-3.9.5-67
brew download-build --arch=x86_64 --arch=noarch resource-agents-3.9.5-67.el7
rpm -Uvh resource-agents-3.9.5-67.el7.x86_64.rpm
vi /usr/lib/ocf/resource.d/openstack/NovaEvacuate 
rpm -qa|grep resource
pcs cluster start --all

[stack@puma33 ~]$ nova list --fields name,status,host
+--------------------------------------+------+--------+-------------------------------------+
| ID                                   | Name | Status | Host                                |
+--------------------------------------+------+--------+-------------------------------------+
| 77aabf19-2bd1-4e85-99b2-4b2766240fb6 | vm01 | ACTIVE | overcloud-novacompute-2.localdomain |
| c1cc12e9-52fa-429a-b83f-389af0b1ac85 | vm03 | ACTIVE | overcloud-novacompute-2.localdomain |
| dc342a5e-ad11-4ed3-ac76-ac88867866fd | vm03 | ACTIVE | overcloud-novacompute-2.localdomain |
| 6cd0d350-c408-4ef1-962c-dfa73bea8d16 | vm04 | ACTIVE | overcloud-novacompute-1.localdomain |
| 3cf4fd8c-974c-4ef9-9146-41edafafad00 | vm05 | ACTIVE | overcloud-novacompute-1.localdomain |
| e1c45b96-9530-47d3-8131-a715b963953f | vm06 | ACTIVE | overcloud-novacompute-1.localdomain |
| ee4f02d7-b958-4bfc-b659-c581784d58c2 | vm07 | ACTIVE | overcloud-novacompute-2.localdomain |
| b8c2f374-4f02-42e3-b8e2-649f08040437 | vm08 | ACTIVE | overcloud-novacompute-2.localdomain |
+--------------------------------------+------+--------+-------------------------------------+

** fencing compute-1

[stack@puma33 ~]$ nova list --fields name,status,host
+--------------------------------------+------+--------+-------------------------------------+
| ID                                   | Name | Status | Host                                |
+--------------------------------------+------+--------+-------------------------------------+
| 77aabf19-2bd1-4e85-99b2-4b2766240fb6 | vm01 | ACTIVE | overcloud-novacompute-2.localdomain |
| c1cc12e9-52fa-429a-b83f-389af0b1ac85 | vm03 | ACTIVE | overcloud-novacompute-2.localdomain |
| dc342a5e-ad11-4ed3-ac76-ac88867866fd | vm03 | ACTIVE | overcloud-novacompute-2.localdomain |
| 6cd0d350-c408-4ef1-962c-dfa73bea8d16 | vm04 | ACTIVE | overcloud-novacompute-0.localdomain |
| 3cf4fd8c-974c-4ef9-9146-41edafafad00 | vm05 | ACTIVE | overcloud-novacompute-0.localdomain |
| e1c45b96-9530-47d3-8131-a715b963953f | vm06 | ACTIVE | overcloud-novacompute-0.localdomain |
| ee4f02d7-b958-4bfc-b659-c581784d58c2 | vm07 | ACTIVE | overcloud-novacompute-2.localdomain |
| b8c2f374-4f02-42e3-b8e2-649f08040437 | vm08 | ACTIVE | overcloud-novacompute-2.localdomain |
+--------------------------------------+------+--------+-------------------------------------+

Comment 8 errata-xmlrpc 2016-11-04 00:00:14 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-2016-2174.html