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

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