File 0006-fence_compute-On-list-don-t-list-hypervisors-but-nov.patch of Package fence-agents.4607

From a1f665a1f3da3afd94d9888432579ecea7c3bfbf Mon Sep 17 00:00:00 2001
From: Vincent Untz <vuntz@suse.com>
Date: Thu, 4 Feb 2016 09:59:43 +0100
Subject: [PATCH 6/8] fence_compute: On list, don't list hypervisors but
 nova-compute services

Everything we do (evacuate, force_down) is on nova-compute services, so
there's no reason to list hypervisors; just directly look for
nova-compute services.
---
 fence/agents/compute/fence_compute.py | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/fence/agents/compute/fence_compute.py b/fence/agents/compute/fence_compute.py
index be4d173..7d7aa49 100644
--- a/fence/agents/compute/fence_compute.py
+++ b/fence/agents/compute/fence_compute.py
@@ -202,15 +202,9 @@ def get_plugs_list(_, options):
 	result = {}
 
 	if nova:
-		hypervisors = nova.hypervisors.list()
-		for hypervisor in hypervisors:
-			longhost = hypervisor.hypervisor_hostname
-			if options["--domain"] != "":
-				shorthost = longhost.replace("." + options["--domain"], "")
-				result[longhost] = ("", None)
-				result[shorthost] = ("", None)
-			else:
-				result[longhost] = ("", None)
+		services = nova.services.list(binary="nova-compute")
+		for service in services:
+			result[service.host] = ("", None)
 	return result
 
 
-- 
2.6.2

openSUSE Build Service is sponsored by