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 1286566 - Nova APIs used by fence_compute have changed
Summary: Nova APIs used by fence_compute have changed
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: fence-agents
Version: 7.2
Hardware: Unspecified
OS: Unspecified
urgent
urgent
Target Milestone: rc
: ---
Assignee: Marek Grac
QA Contact: cluster-qe@redhat.com
URL:
Whiteboard:
Depends On:
Blocks: 1185030
TreeView+ depends on / blocked
 
Reported: 2015-11-30 09:20 UTC by Andrew Beekhof
Modified: 2016-11-21 16:28 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-12-02 03:08:56 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Andrew Beekhof 2015-11-30 09:20:53 UTC
Description of problem:

The agent we shipped for OSP7 doesn't appear to work in OSP8.
Specifically, the plug list is now UUIDs which we need to map to and from host names.

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

fence-agents-all-4.0.11-27.el7.x86_64

How reproducible:

100% 

Steps to Reproduce:
fence_compute -o list (plus normal arguments)

Actual results:

a list of uuid's

Expected results:

a list of compute nodes


Additional info:

Provisional patch

[root@overcloud-controller-0 heat-admin]# diff -u /sbin/fence_compute /sbin/fence_compute.new
--- /sbin/fence_compute.new	2015-11-29 19:24:50.419784336 -0500
+++ /sbin/fence_compute	2015-11-29 22:42:02.836595219 -0500
@@ -65,12 +65,19 @@
 		}
 
 def _host_evacuate(host, on_shared_storage):
-	hypervisors = nova.hypervisors.search(host, servers=True)
-	response = []
-	for hyper in hypervisors:
-		if hasattr(hyper, 'servers'):
-			for server in hyper.servers:
-				response.append(_server_evacuate(server, on_shared_storage))
+        response = []
+        servers = nova.servers.list(search_opts={'name': host})
+        for server in servers:
+                logging.debug("Got %s" % server)
+                logging.debug("Got hypervisor name %s" % server._info['OS-EXT-SRV-ATTR:hypervisor_hostname'])
+                hypervisors = nova.hypervisors.search(server._info['OS-EXT-SRV-ATTR:hypervisor_hostname'], servers=True)
+                for hyper in hypervisors:
+                        logging.debug("Got %s" % hyper)
+                        if hasattr(hyper, 'servers'):
+                                logging.debug("Looking up servers")
+                                for instance in hyper.servers:
+                                        logging.debug("evacuating %s" % instance)
+                                        response.append(_server_evacuate(instance, on_shared_storage))
 
 def set_attrd_status(host, status, options):
 	logging.debug("Setting fencing status for %s to %s" % (host, status))
@@ -112,20 +119,32 @@
 	return
 
 def get_plugs_list(_, options):
-	result = {}
+        result = {}
+        unames = []
 
-	if nova:
-		hypervisors = nova.hypervisors.list()
-		for hypervisor in hypervisors:
-			longhost = hypervisor.hypervisor_hostname
-			if options["--action"] == "list" and options["--domain"] != "":
-				shorthost = longhost.replace("." + options["--domain"],
-                                                 "")
-				result[shorthost] = ("", None)
-			else:
-				result[longhost] = ("", None)
-	return result
+        nodes=Popen(['cibadmin', '-Q', '-o', 'nodes'], stdout=PIPE)
+        nodes.wait()
 
+        if nodes.stdout:
+                lines = nodes.stdout.readlines()
+                nodes.stdout.close()
+
+        for line in lines:
+                getNext=False
+                fields = line.split('"')
+                for field in fields:
+                        if getNext == True:
+                                unames.append(field)
+                                break
+                        elif field.strip() == "uname=":
+                                getNext=True
+
+        for uname in unames:
+                role=Popen(['crm_attribute', '-N', uname, '-n', 'osprole', '-d', 'unknown', '-q'], stdout=PIPE).communicate()[0].strip()
+                if role == "compute":
+                        result[uname] = ("", None)
+
+        return result
 
 def define_new_opts():
 	all_opt["endpoint-type"] = {

Comment 1 Eoghan Glynn 2015-11-30 11:31:06 UTC
abeekhof: can you give a concise description of what exactly has changed in the nova-api?

Is it that the nova hypervisors API now returns host UUIDs wheeas previously it reported symbolic hostnames?

Comment 2 Sylvain Bauza 2015-11-30 11:33:21 UTC
Not sure I understand the problem.
The output of _server_evacuate() (ie. the dict keyed with server_uuid) has been introduced with https://github.com/ClusterLabs/fence-agents/commit/855c7f617e6afc840540439c359de970d3dc8cee

We haven't changed that since the beginning, so I don't get what's the problem here.

Could you please be more explicit, and tell us what has been regressed so we could identify how to fix that ?

Comment 3 Sylvain Bauza 2015-11-30 11:34:46 UTC
To be clear, I'm speaking of https://github.com/ClusterLabs/fence-agents/blob/f32efc776fd146aa9f386f2e635707763baf231f/fence/agents/compute/fence_compute.py#L63-L67 which is independent of what provides the Nova API.

Comment 4 Andrew Beekhof 2015-12-02 03:08:56 UTC
Eoghan, Sylvain, apologies I thought I had closed this bug.

I misattributed the change in output to changes to nova.

In practice, the person who set up the environment had accidentally pointed the fencing configuration to nova on the undercloud instead of the overcloud (and I was slow to realise what was going on).

No bug here. Sorry for the noise.


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