Blame SOURCES/bz1549699-2-fence_compute-fence_evacuate-fix-compute-domain.patch

554a6e
From 15635df9d12ce693f473d5ebcd5b7cacb81e2295 Mon Sep 17 00:00:00 2001
554a6e
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
554a6e
Date: Mon, 16 Jul 2018 11:14:16 +0200
554a6e
Subject: [PATCH] fence_compute/fence_evacuate: workaround for compute-domain
554a6e
 regression
554a6e
554a6e
---
554a6e
 agents/compute/fence_compute.py        | 24 +++++++++++++++++++-----
554a6e
 agents/evacuate/fence_evacuate.py      | 24 +++++++++++++++++++-----
554a6e
 tests/data/metadata/fence_compute.xml  | 24 ++++++++++++++++++++++--
554a6e
 tests/data/metadata/fence_evacuate.xml | 24 ++++++++++++++++++++++--
554a6e
 4 files changed, 82 insertions(+), 14 deletions(-)
554a6e
554a6e
diff --git a/agents/compute/fence_compute.py b/agents/compute/fence_compute.py
554a6e
index ec2d093c..aac9b296 100644
554a6e
--- a/agents/compute/fence_compute.py
554a6e
+++ b/agents/compute/fence_compute.py
554a6e
@@ -353,7 +353,7 @@ def define_new_opts():
67bff5
 		"default" : "",
67bff5
 		"order": 1,
67bff5
 	}
67bff5
-	all_opt["user_domain"] = {
67bff5
+	all_opt["user-domain"] = {
67bff5
 		"getopt" : "u:",
67bff5
 		"longopt" : "user-domain",
67bff5
 		"help" : "-u, --user-domain=[name]       Keystone v3 User Domain",
554a6e
@@ -362,7 +362,7 @@ def define_new_opts():
67bff5
 		"default" : "Default",
67bff5
 		"order": 2,
67bff5
 	}
67bff5
-	all_opt["project_domain"] = {
67bff5
+	all_opt["project-domain"] = {
67bff5
 		"getopt" : "P:",
67bff5
 		"longopt" : "project-domain",
67bff5
 		"help" : "-d, --project-domain=[name]    Keystone v3 Project Domain",
554a6e
@@ -433,6 +433,14 @@ def define_new_opts():
67bff5
 		"default" : "False",
67bff5
 		"order": 5,
67bff5
 	}
67bff5
+	all_opt["compute-domain"] = {
67bff5
+		"getopt" : ":",
67bff5
+		"longopt" : "compute-domain",
67bff5
+		"help" : "--compute-domain=[string]      Replaced by --domain",
67bff5
+		"required" : "0",
67bff5
+		"shortdesc" : "Replaced by domain",
67bff5
+		"order": 6,
67bff5
+	}
67bff5
 
67bff5
 def set_multi_power_fn(connection, options, set_power_fn, get_power_fn, retry_attempts=1):
67bff5
 	for _ in range(retry_attempts):
554a6e
@@ -450,9 +458,10 @@ def main():
67bff5
 	global override_status
67bff5
 	atexit.register(atexit_handler)
67bff5
 
67bff5
-	device_opt = ["login", "passwd", "tenant_name", "auth_url", "fabric_fencing",
67bff5
-		      "no_login", "no_password", "port", "domain", "project_domain", "user_domain",
67bff5
-		      "no_shared_storage", "endpoint_type", "record_only", "instance_filtering", "insecure", "region_name"]
67bff5
+	device_opt = ["login", "passwd", "tenant_name", "auth_url", "fabric_fencing", "no_login",
67bff5
+			"no_password", "port", "domain", "compute-domain", "project-domain",
67bff5
+			"user-domain", "no_shared_storage", "endpoint_type", "record_only",
67bff5
+			"instance_filtering", "insecure", "region_name"]
67bff5
 	define_new_opts()
67bff5
 	all_opt["shell_timeout"]["default"] = "180"
67bff5
 
554a6e
@@ -470,6 +479,11 @@ def main():
67bff5
 
67bff5
 	run_delay(options)
67bff5
 
67bff5
+	# workaround to avoid regressions
67bff5
+	if "--compute-domain" in options and options["--compute-domain"]:
67bff5
+		options["--domain"] = options["--compute-domain"]
67bff5
+		del options["--domain"]
67bff5
+
67bff5
 	logging.debug("Running "+options["--action"])
67bff5
 	connection = create_nova_connection(options)
67bff5
 
554a6e
diff --git a/agents/evacuate/fence_evacuate.py b/agents/evacuate/fence_evacuate.py
554a6e
index 615dede7..529a60dd 100644
554a6e
--- a/agents/evacuate/fence_evacuate.py
554a6e
+++ b/agents/evacuate/fence_evacuate.py
554a6e
@@ -287,7 +287,7 @@ def define_new_opts():
67bff5
 		"default" : "",
67bff5
 		"order": 1,
67bff5
 	}
67bff5
-	all_opt["user_domain"] = {
67bff5
+	all_opt["user-domain"] = {
67bff5
 		"getopt" : "u:",
67bff5
 		"longopt" : "user-domain",
67bff5
 		"help" : "-u, --user-domain=[name]       Keystone v3 User Domain",
554a6e
@@ -296,7 +296,7 @@ def define_new_opts():
67bff5
 		"default" : "Default",
67bff5
 		"order": 2,
67bff5
 	}
67bff5
-	all_opt["project_domain"] = {
67bff5
+	all_opt["project-domain"] = {
67bff5
 		"getopt" : "P:",
67bff5
 		"longopt" : "project-domain",
67bff5
 		"help" : "-d, --project-domain=[name]    Keystone v3 Project Domain",
554a6e
@@ -358,14 +358,22 @@ def define_new_opts():
67bff5
 		"default" : "False",
67bff5
 		"order": 5,
67bff5
 	}
67bff5
+	all_opt["compute-domain"] = {
67bff5
+		"getopt" : ":",
67bff5
+		"longopt" : "compute-domain",
67bff5
+		"help" : "--compute-domain=[string]      Replaced by --domain",
67bff5
+		"required" : "0",
67bff5
+		"shortdesc" : "Replaced by domain",
67bff5
+		"order": 6,
67bff5
+	}
67bff5
 
67bff5
 def main():
67bff5
 	atexit.register(atexit_handler)
67bff5
 
67bff5
 	device_opt = ["login", "passwd", "tenant_name", "auth_url",
67bff5
-		      "no_login", "no_password", "port", "domain", "project_domain",
67bff5
-		      "user_domain", "no_shared_storage", "endpoint_type",
67bff5
-		      "instance_filtering", "insecure", "region_name"]
67bff5
+		      "no_login", "no_password", "port", "domain", "compute-domain",
67bff5
+		      "project-domain", "user-domain", "no_shared_storage",
67bff5
+		      "endpoint_type", "instance_filtering", "insecure", "region_name"]
67bff5
 	define_new_opts()
67bff5
 	all_opt["shell_timeout"]["default"] = "180"
67bff5
 
554a6e
@@ -380,6 +388,12 @@ def main():
67bff5
 
67bff5
 	run_delay(options)
67bff5
 
67bff5
+	# workaround to avoid regressions
67bff5
+	if "--compute-domain" in options and options["--compute-domain"]:
67bff5
+		options["--domain"] = options["--compute-domain"]
67bff5
+		del options["--domain"]
67bff5
+
67bff5
+
67bff5
 	connection = create_nova_connection(options)
67bff5
 
67bff5
 	# Un-evacuating a server doesn't make sense
554a6e
diff --git a/tests/data/metadata/fence_compute.xml b/tests/data/metadata/fence_compute.xml
554a6e
index e1dac97c..1dcbfc54 100644
554a6e
--- a/tests/data/metadata/fence_compute.xml
554a6e
+++ b/tests/data/metadata/fence_compute.xml
554a6e
@@ -73,12 +73,22 @@
554a6e
 		<content type="boolean" default="False"  />
554a6e
 		<shortdesc lang="en">Allow Insecure TLS Requests</shortdesc>
554a6e
 	</parameter>
554a6e
-	<parameter name="project_domain" unique="0" required="0">
554a6e
+	<parameter name="project-domain" unique="0" required="0" deprecated="1">
554a6e
 		<getopt mixed="-d, --project-domain=[name]" />
554a6e
 		<content type="string" default="Default"  />
554a6e
 		<shortdesc lang="en">Keystone v3 Project Domain</shortdesc>
554a6e
 	</parameter>
554a6e
-	<parameter name="user_domain" unique="0" required="0">
554a6e
+	<parameter name="project_domain" unique="0" required="0" obsoletes="project-domain">
554a6e
+		<getopt mixed="-d, --project-domain=[name]" />
554a6e
+		<content type="string" default="Default"  />
554a6e
+		<shortdesc lang="en">Keystone v3 Project Domain</shortdesc>
554a6e
+	</parameter>
554a6e
+	<parameter name="user-domain" unique="0" required="0" deprecated="1">
554a6e
+		<getopt mixed="-u, --user-domain=[name]" />
554a6e
+		<content type="string" default="Default"  />
554a6e
+		<shortdesc lang="en">Keystone v3 User Domain</shortdesc>
554a6e
+	</parameter>
554a6e
+	<parameter name="user_domain" unique="0" required="0" obsoletes="user-domain">
554a6e
 		<getopt mixed="-u, --user-domain=[name]" />
554a6e
 		<content type="string" default="Default"  />
554a6e
 		<shortdesc lang="en">Keystone v3 User Domain</shortdesc>
554a6e
@@ -103,6 +113,16 @@
554a6e
 		<content type="string" default="False"  />
554a6e
 		<shortdesc lang="en">Only record the target as needing evacuation</shortdesc>
554a6e
 	</parameter>
554a6e
+	<parameter name="compute-domain" unique="0" required="0" deprecated="1">
554a6e
+		<getopt mixed="--compute-domain=[string]" />
554a6e
+		<content type="string"  />
554a6e
+		<shortdesc lang="en">Replaced by domain</shortdesc>
554a6e
+	</parameter>
554a6e
+	<parameter name="compute_domain" unique="0" required="0" obsoletes="compute-domain">
554a6e
+		<getopt mixed="--compute-domain=[string]" />
554a6e
+		<content type="string"  />
554a6e
+		<shortdesc lang="en">Replaced by domain</shortdesc>
554a6e
+	</parameter>
554a6e
 	<parameter name="quiet" unique="0" required="0">
554a6e
 		<getopt mixed="-q, --quiet" />
554a6e
 		<content type="boolean"  />
554a6e
diff --git a/tests/data/metadata/fence_evacuate.xml b/tests/data/metadata/fence_evacuate.xml
554a6e
index 6f8bd0a4..4f1f6a58 100644
554a6e
--- a/tests/data/metadata/fence_evacuate.xml
554a6e
+++ b/tests/data/metadata/fence_evacuate.xml
554a6e
@@ -73,12 +73,22 @@
554a6e
 		<content type="boolean" default="False"  />
554a6e
 		<shortdesc lang="en">Allow Insecure TLS Requests</shortdesc>
554a6e
 	</parameter>
554a6e
-	<parameter name="project_domain" unique="0" required="0">
554a6e
+	<parameter name="project-domain" unique="0" required="0" deprecated="1">
554a6e
 		<getopt mixed="-d, --project-domain=[name]" />
554a6e
 		<content type="string" default="Default"  />
554a6e
 		<shortdesc lang="en">Keystone v3 Project Domain</shortdesc>
554a6e
 	</parameter>
554a6e
-	<parameter name="user_domain" unique="0" required="0">
554a6e
+	<parameter name="project_domain" unique="0" required="0" obsoletes="project-domain">
554a6e
+		<getopt mixed="-d, --project-domain=[name]" />
554a6e
+		<content type="string" default="Default"  />
554a6e
+		<shortdesc lang="en">Keystone v3 Project Domain</shortdesc>
554a6e
+	</parameter>
554a6e
+	<parameter name="user-domain" unique="0" required="0" deprecated="1">
554a6e
+		<getopt mixed="-u, --user-domain=[name]" />
554a6e
+		<content type="string" default="Default"  />
554a6e
+		<shortdesc lang="en">Keystone v3 User Domain</shortdesc>
554a6e
+	</parameter>
554a6e
+	<parameter name="user_domain" unique="0" required="0" obsoletes="user-domain">
554a6e
 		<getopt mixed="-u, --user-domain=[name]" />
554a6e
 		<content type="string" default="Default"  />
554a6e
 		<shortdesc lang="en">Keystone v3 User Domain</shortdesc>
554a6e
@@ -98,6 +108,16 @@
554a6e
 		<content type="boolean" default="False"  />
554a6e
 		<shortdesc lang="en">Disable functionality for dealing with shared storage</shortdesc>
554a6e
 	</parameter>
554a6e
+	<parameter name="compute-domain" unique="0" required="0" deprecated="1">
554a6e
+		<getopt mixed="--compute-domain=[string]" />
554a6e
+		<content type="string"  />
554a6e
+		<shortdesc lang="en">Replaced by domain</shortdesc>
554a6e
+	</parameter>
554a6e
+	<parameter name="compute_domain" unique="0" required="0" obsoletes="compute-domain">
554a6e
+		<getopt mixed="--compute-domain=[string]" />
554a6e
+		<content type="string"  />
554a6e
+		<shortdesc lang="en">Replaced by domain</shortdesc>
554a6e
+	</parameter>
554a6e
 	<parameter name="quiet" unique="0" required="0">
554a6e
 		<getopt mixed="-q, --quiet" />
554a6e
 		<content type="boolean"  />
554a6e
-- 
554a6e
2.17.1
554a6e