2016-12-01 14:22:57 +01:00
|
|
|
From 02a40aed59e4d6bb48ccd28e7558d18b0d03e7c0 Mon Sep 17 00:00:00 2001
|
2016-06-30 12:01:27 +02:00
|
|
|
From: Vincent Untz <vuntz@suse.com>
|
|
|
|
Date: Wed, 29 Jun 2016 09:50:12 +0200
|
2016-12-01 14:22:57 +01:00
|
|
|
Subject: [PATCH 5/9] fence_compute: Fix fix_domain to not return too early
|
2016-06-30 12:01:27 +02:00
|
|
|
|
|
|
|
We were returning from the loop, while we want the rest of the code to
|
|
|
|
still execute (in case there are multiple domains in nova).
|
|
|
|
|
|
|
|
Also simplify the code...
|
|
|
|
---
|
|
|
|
fence/agents/compute/fence_compute.py | 14 +++++---------
|
|
|
|
1 file changed, 5 insertions(+), 9 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 3c19f02..d39c053 100644
|
2016-06-30 12:01:27 +02:00
|
|
|
--- a/fence/agents/compute/fence_compute.py
|
|
|
|
+++ b/fence/agents/compute/fence_compute.py
|
|
|
|
@@ -229,24 +229,20 @@ def fix_domain(options):
|
|
|
|
# Compute nodes are named as FQDN, strip off the hostname
|
|
|
|
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" % service.host)
|
|
|
|
+ continue
|
|
|
|
|
|
|
|
- elif "--domain" in options and options["--domain"] == calculated:
|
|
|
|
- # Supplied domain name is valid
|
|
|
|
- return
|
|
|
|
+ domains[calculated] = service.host
|
|
|
|
+ last_domain = calculated
|
|
|
|
|
|
|
|
- elif "--domain" in options:
|
|
|
|
+ if "--domain" in options and options["--domain"] != calculated:
|
|
|
|
# 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"], service.host))
|
|
|
|
|
|
|
|
- last_domain = calculated
|
|
|
|
-
|
|
|
|
if len(domains) == 0 and "--domain" not in options:
|
|
|
|
logging.error("Could not calculate the domain names used by compute nodes in nova")
|
|
|
|
|
2016-12-01 14:22:57 +01:00
|
|
|
@@ -255,7 +251,7 @@ def fix_domain(options):
|
2016-06-30 12:01:27 +02:00
|
|
|
|
|
|
|
elif len(domains) == 1 and options["--domain"] != last_domain:
|
|
|
|
logging.error("Overriding supplied domain '%s' as it does not match the one calculated from: %s"
|
|
|
|
- % (options["--domain"], service.host))
|
|
|
|
+ % (options["--domain"], domains[last_domain]))
|
|
|
|
options["--domain"] = last_domain
|
|
|
|
|
2016-12-01 14:22:57 +01:00
|
|
|
elif len(domains) > 1:
|
2016-06-30 12:01:27 +02:00
|
|
|
--
|
2016-12-01 14:22:57 +01:00
|
|
|
2.10.1
|
2016-06-30 12:01:27 +02:00
|
|
|
|