2016-12-01 14:22:57 +01:00
|
|
|
From 77a6ad6383ae1ffd26f771e394263e0d2fc4df5e Mon Sep 17 00:00:00 2001
|
2016-06-30 12:01:27 +02:00
|
|
|
From: Vincent Untz <vuntz@suse.com>
|
|
|
|
Date: Thu, 4 Feb 2016 09:59:43 +0100
|
2016-12-01 14:22:57 +01:00
|
|
|
Subject: [PATCH 2/9] fence_compute: Don't list hypervisors but nova-compute
|
2016-06-30 12:01:27 +02:00
|
|
|
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.
|
|
|
|
|
|
|
|
This matters as hypervisors are always FQDN, while nova service hosts
|
|
|
|
can be short hostnames.
|
|
|
|
---
|
|
|
|
fence/agents/compute/fence_compute.py | 22 +++++++++++-----------
|
|
|
|
1 file changed, 11 insertions(+), 11 deletions(-)
|
|
|
|
|
|
|
|
diff --git a/fence/agents/compute/fence_compute.py b/fence/agents/compute/fence_compute.py
|
2016-12-01 14:22:57 +01:00
|
|
|
index 6237f5e..e38c7bb 100644
|
2016-06-30 12:01:27 +02:00
|
|
|
--- a/fence/agents/compute/fence_compute.py
|
|
|
|
+++ b/fence/agents/compute/fence_compute.py
|
|
|
|
@@ -218,23 +218,23 @@ def fix_domain(options):
|
|
|
|
if nova:
|
|
|
|
# Find it in nova
|
|
|
|
|
|
|
|
- hypervisors = nova.hypervisors.list()
|
|
|
|
- for hypervisor in hypervisors:
|
|
|
|
- shorthost = hypervisor.hypervisor_hostname.split('.')[0]
|
|
|
|
+ services = nova.services.list(binary="nova-compute")
|
|
|
|
+ for service in services:
|
|
|
|
+ shorthost = service.host.split('.')[0]
|
|
|
|
|
|
|
|
- if shorthost == hypervisor.hypervisor_hostname:
|
|
|
|
+ if shorthost == service.host:
|
|
|
|
# Nova is not using FQDN
|
|
|
|
calculated = ""
|
|
|
|
else:
|
|
|
|
# Compute nodes are named as FQDN, strip off the hostname
|
|
|
|
- calculated = hypervisor.hypervisor_hostname.replace(shorthost+".", "")
|
|
|
|
+ calculated = service.host.replace(shorthost+".", "")
|
|
|
|
|
|
|
|
domains[calculated] = shorthost
|
|
|
|
|
|
|
|
if calculated == last_domain:
|
|
|
|
# Avoid complaining for each compute node with the same name
|
|
|
|
# One hopes they don't appear interleaved as A.com B.com A.com B.com
|
|
|
|
- logging.debug("Calculated the same domain from: %s" % hypervisor.hypervisor_hostname)
|
|
|
|
+ logging.debug("Calculated the same domain from: %s" % service.host)
|
|
|
|
|
|
|
|
elif "--domain" in options and options["--domain"] == calculated:
|
|
|
|
# Supplied domain name is valid
|
|
|
|
@@ -243,7 +243,7 @@ def fix_domain(options):
|
|
|
|
elif "--domain" in options:
|
|
|
|
# Warn in case nova isn't available at some point
|
|
|
|
logging.warning("Supplied domain '%s' does not match the one calculated from: %s"
|
|
|
|
- % (options["--domain"], hypervisor.hypervisor_hostname))
|
|
|
|
+ % (options["--domain"], service.host))
|
|
|
|
|
|
|
|
last_domain = calculated
|
|
|
|
|
2016-08-26 15:59:46 +02:00
|
|
|
@@ -256,7 +256,7 @@ def fix_domain(options):
|
2016-06-30 12:01:27 +02:00
|
|
|
|
|
|
|
elif len(domains) == 1:
|
|
|
|
logging.error("Overriding supplied domain '%s' does not match the one calculated from: %s"
|
|
|
|
- % (options["--domain"], hypervisor.hypervisor_hostname))
|
|
|
|
+ % (options["--domain"], service.host))
|
|
|
|
options["--domain"] = last_domain
|
2016-08-26 15:59:46 +02:00
|
|
|
return options["--domain"]
|
2016-06-30 12:01:27 +02:00
|
|
|
|
2016-08-26 15:59:46 +02:00
|
|
|
@@ -298,9 +298,9 @@ def get_plugs_list(_, options):
|
2016-06-30 12:01:27 +02:00
|
|
|
result = {}
|
|
|
|
|
|
|
|
if nova:
|
|
|
|
- hypervisors = nova.hypervisors.list()
|
|
|
|
- for hypervisor in hypervisors:
|
|
|
|
- longhost = hypervisor.hypervisor_hostname
|
|
|
|
+ services = nova.services.list(binary="nova-compute")
|
|
|
|
+ for service in services:
|
|
|
|
+ longhost = service.host
|
|
|
|
shorthost = longhost.split('.')[0]
|
|
|
|
result[longhost] = ("", None)
|
|
|
|
result[shorthost] = ("", None)
|
|
|
|
--
|
2016-12-01 14:22:57 +01:00
|
|
|
2.10.1
|
2016-06-30 12:01:27 +02:00
|
|
|
|