|
|
3012c9 |
From 98fec5c6d55369ad681abc0cde0d8677835957ab Mon Sep 17 00:00:00 2001
|
|
|
3012c9 |
From: Arnold Beilmann <arnoldbeilmann@macbook-pro.speedport.ip>
|
|
|
3012c9 |
Date: Thu, 5 May 2022 15:26:22 +0200
|
|
|
3012c9 |
Subject: [PATCH 1/2] modified for PowerVS
|
|
|
3012c9 |
|
|
|
3012c9 |
---
|
|
|
3012c9 |
agents/ibm_powervs/fence_ibm_powervs.py | 108 +++++++++++++++++++-----
|
|
|
3012c9 |
1 file changed, 89 insertions(+), 19 deletions(-)
|
|
|
3012c9 |
|
|
|
3012c9 |
diff --git a/agents/ibm_powervs/fence_ibm_powervs.py b/agents/ibm_powervs/fence_ibm_powervs.py
|
|
|
3012c9 |
index 6649771ea..727009220 100755
|
|
|
3012c9 |
--- a/agents/ibm_powervs/fence_ibm_powervs.py
|
|
|
3012c9 |
+++ b/agents/ibm_powervs/fence_ibm_powervs.py
|
|
|
3012c9 |
@@ -1,10 +1,11 @@
|
|
|
3012c9 |
-#!@PYTHON@ -tt
|
|
|
3012c9 |
+#!/usr/libexec/platform-python -tt
|
|
|
3012c9 |
|
|
|
3012c9 |
import sys
|
|
|
3012c9 |
import pycurl, io, json
|
|
|
3012c9 |
import logging
|
|
|
3012c9 |
import atexit
|
|
|
3012c9 |
-sys.path.append("@FENCEAGENTSLIBDIR@")
|
|
|
3012c9 |
+import time
|
|
|
3012c9 |
+sys.path.append("/usr/share/fence")
|
|
|
3012c9 |
from fencing import *
|
|
|
3012c9 |
from fencing import fail, run_delay, EC_LOGIN_DENIED, EC_STATUS
|
|
|
3012c9 |
|
|
|
3012c9 |
@@ -14,16 +15,30 @@
|
|
|
3012c9 |
"ERROR": "unknown"
|
|
|
3012c9 |
}
|
|
|
3012c9 |
|
|
|
3012c9 |
+def get_token(conn, options):
|
|
|
3012c9 |
+
|
|
|
3012c9 |
+ try:
|
|
|
3012c9 |
+ command = "identity/token"
|
|
|
3012c9 |
+ action = "grant_type=urn%3Aibm%3Aparams%3Aoauth%3Agrant-type%3Aapikey&apikey={}".format(options["--token"])
|
|
|
3012c9 |
+ res = send_command(conn, command, "POST", action, printResult=False)
|
|
|
3012c9 |
+ except Exception as e:
|
|
|
3012c9 |
+ logging.debug("Failed: {}".format(e))
|
|
|
3012c9 |
+ return "TOKEN_IS_MISSING_OR_WRONG"
|
|
|
3012c9 |
+
|
|
|
3012c9 |
+ #if "--verbose" in options:
|
|
|
3012c9 |
+ # logging.debug(json.dumps(res, indent=2))
|
|
|
3012c9 |
+
|
|
|
3012c9 |
+ return res["access_token"]
|
|
|
3012c9 |
+
|
|
|
3012c9 |
def get_list(conn, options):
|
|
|
3012c9 |
outlets = {}
|
|
|
3012c9 |
-
|
|
|
3012c9 |
+
|
|
|
3012c9 |
try:
|
|
|
3012c9 |
command = "cloud-instances/{}/pvm-instances".format(options["--instance"])
|
|
|
3012c9 |
res = send_command(conn, command)
|
|
|
3012c9 |
except Exception as e:
|
|
|
3012c9 |
logging.debug("Failed: {}".format(e))
|
|
|
3012c9 |
return outlets
|
|
|
3012c9 |
-
|
|
|
3012c9 |
for r in res["pvmInstances"]:
|
|
|
3012c9 |
if "--verbose" in options:
|
|
|
3012c9 |
logging.debug(json.dumps(r, indent=2))
|
|
|
3012c9 |
@@ -32,6 +47,7 @@ def get_list(conn, options):
|
|
|
3012c9 |
return outlets
|
|
|
3012c9 |
|
|
|
3012c9 |
def get_power_status(conn, options):
|
|
|
3012c9 |
+
|
|
|
3012c9 |
try:
|
|
|
3012c9 |
command = "cloud-instances/{}/pvm-instances/{}".format(
|
|
|
3012c9 |
options["--instance"], options["--plug"])
|
|
|
3012c9 |
@@ -40,10 +56,11 @@ def get_power_status(conn, options):
|
|
|
3012c9 |
except KeyError as e:
|
|
|
3012c9 |
logging.debug("Failed: Unable to get status for {}".format(e))
|
|
|
3012c9 |
fail(EC_STATUS)
|
|
|
3012c9 |
-
|
|
|
3012c9 |
+
|
|
|
3012c9 |
return result
|
|
|
3012c9 |
|
|
|
3012c9 |
def set_power_status(conn, options):
|
|
|
3012c9 |
+
|
|
|
3012c9 |
action = {
|
|
|
3012c9 |
"on" : '{"action" : "start"}',
|
|
|
3012c9 |
"off" : '{"action" : "immediate-shutdown"}',
|
|
|
3012c9 |
@@ -56,35 +73,63 @@ def set_power_status(conn, options):
|
|
|
3012c9 |
logging.debug("Failed: Unable to set power to {} for {}".format(options["--action"], e))
|
|
|
3012c9 |
fail(EC_STATUS)
|
|
|
3012c9 |
|
|
|
3012c9 |
-def connect(opt):
|
|
|
3012c9 |
+def connect(opt, token):
|
|
|
3012c9 |
conn = pycurl.Curl()
|
|
|
3012c9 |
|
|
|
3012c9 |
## setup correct URL
|
|
|
3012c9 |
- conn.base_url = "https://" + opt["--region"] + ".power-iaas.cloud.ibm.com/pcloud/v1/"
|
|
|
3012c9 |
+ conn.base_url = "https://private." + opt["--region"] + ".power-iaas.cloud.ibm.com/pcloud/v1/"
|
|
|
3012c9 |
+ if opt["--api-type"] == "public":
|
|
|
3012c9 |
+ conn.base_url = "https://" + opt["--region"] + ".power-iaas.cloud.ibm.com/pcloud/v1/"
|
|
|
3012c9 |
|
|
|
3012c9 |
if opt["--verbose-level"] > 1:
|
|
|
3012c9 |
- conn.setopt(pycurl.VERBOSE, 1)
|
|
|
3012c9 |
+ conn.setopt(pycurl.VERBOSE, 0)
|
|
|
3012c9 |
|
|
|
3012c9 |
+ conn.setopt(pycurl.CONNECTTIMEOUT,int(opt["--shell-timeout"]))
|
|
|
3012c9 |
conn.setopt(pycurl.TIMEOUT, int(opt["--shell-timeout"]))
|
|
|
3012c9 |
conn.setopt(pycurl.SSL_VERIFYPEER, 1)
|
|
|
3012c9 |
conn.setopt(pycurl.SSL_VERIFYHOST, 2)
|
|
|
3012c9 |
+ conn.setopt(pycurl.PROXY, "{}".format(opt["--proxy"]))
|
|
|
3012c9 |
|
|
|
3012c9 |
# set auth token for later requests
|
|
|
3012c9 |
conn.setopt(pycurl.HTTPHEADER, [
|
|
|
3012c9 |
"Content-Type: application/json",
|
|
|
3012c9 |
- "Authorization: Bearer {}".format(opt["--token"]),
|
|
|
3012c9 |
+ "Authorization: Bearer {}".format(token),
|
|
|
3012c9 |
"CRN: {}".format(opt["--crn"]),
|
|
|
3012c9 |
"User-Agent: curl",
|
|
|
3012c9 |
])
|
|
|
3012c9 |
+
|
|
|
3012c9 |
+ return conn
|
|
|
3012c9 |
+
|
|
|
3012c9 |
+def auth_connect(opt):
|
|
|
3012c9 |
+ conn = pycurl.Curl()
|
|
|
3012c9 |
+
|
|
|
3012c9 |
+ # setup correct URL
|
|
|
3012c9 |
+ conn.base_url = "https://iam.cloud.ibm.com/"
|
|
|
3012c9 |
+
|
|
|
3012c9 |
+ if opt["--verbose-level"] > 1:
|
|
|
3012c9 |
+ conn.setopt(pycurl.VERBOSE, 1)
|
|
|
3012c9 |
+
|
|
|
3012c9 |
+ conn.setopt(pycurl.CONNECTTIMEOUT,int(opt["--shell-timeout"]))
|
|
|
3012c9 |
+ conn.setopt(pycurl.TIMEOUT, int(opt["--shell-timeout"]))
|
|
|
3012c9 |
+ conn.setopt(pycurl.SSL_VERIFYPEER, 1)
|
|
|
3012c9 |
+ conn.setopt(pycurl.SSL_VERIFYHOST, 2)
|
|
|
3012c9 |
+ conn.setopt(pycurl.PROXY, "{}".format(opt["--proxy"]))
|
|
|
3012c9 |
+
|
|
|
3012c9 |
+ # set auth token for later requests
|
|
|
3012c9 |
+ conn.setopt(pycurl.HTTPHEADER, [
|
|
|
3012c9 |
+ "Content-type: application/x-www-form-urlencoded",
|
|
|
3012c9 |
+ "Accept: application/json",
|
|
|
3012c9 |
+ "User-Agent: curl",
|
|
|
3012c9 |
+ ])
|
|
|
3012c9 |
|
|
|
3012c9 |
return conn
|
|
|
3012c9 |
|
|
|
3012c9 |
def disconnect(conn):
|
|
|
3012c9 |
conn.close()
|
|
|
3012c9 |
|
|
|
3012c9 |
-def send_command(conn, command, method="GET", action=None):
|
|
|
3012c9 |
+def send_command(conn, command, method="GET", action=None, printResult=True):
|
|
|
3012c9 |
url = conn.base_url + command
|
|
|
3012c9 |
-
|
|
|
3012c9 |
+
|
|
|
3012c9 |
conn.setopt(pycurl.URL, url.encode("ascii"))
|
|
|
3012c9 |
|
|
|
3012c9 |
web_buffer = io.BytesIO()
|
|
|
3012c9 |
@@ -99,8 +144,10 @@ def send_command(conn, command, method="GET", action=None):
|
|
|
3012c9 |
conn.setopt(pycurl.WRITEFUNCTION, web_buffer.write)
|
|
|
3012c9 |
|
|
|
3012c9 |
try:
|
|
|
3012c9 |
+ time.sleep(3)
|
|
|
3012c9 |
conn.perform()
|
|
|
3012c9 |
except Exception as e:
|
|
|
3012c9 |
+ logging.error("ADD_DEBUG: {}".format(e))
|
|
|
3012c9 |
raise(e)
|
|
|
3012c9 |
|
|
|
3012c9 |
rc = conn.getinfo(pycurl.HTTP_CODE)
|
|
|
3012c9 |
@@ -110,8 +157,7 @@ def send_command(conn, command, method="GET", action=None):
|
|
|
3012c9 |
|
|
|
3012c9 |
if rc != 200:
|
|
|
3012c9 |
if len(result) > 0:
|
|
|
3012c9 |
- raise Exception("{}: {}".format(rc,
|
|
|
3012c9 |
- result["value"]["messages"][0]["default_message"]))
|
|
|
3012c9 |
+ raise Exception("{}: {}".format(rc,result))
|
|
|
3012c9 |
else:
|
|
|
3012c9 |
raise Exception("Remote returned {} for request to {}".format(rc, url))
|
|
|
3012c9 |
|
|
|
3012c9 |
@@ -121,7 +167,8 @@ def send_command(conn, command, method="GET", action=None):
|
|
|
3012c9 |
logging.debug("url: {}".format(url))
|
|
|
3012c9 |
logging.debug("method: {}".format(method))
|
|
|
3012c9 |
logging.debug("response code: {}".format(rc))
|
|
|
3012c9 |
- logging.debug("result: {}\n".format(result))
|
|
|
3012c9 |
+ if printResult:
|
|
|
3012c9 |
+ logging.debug("result: {}\n".format(result))
|
|
|
3012c9 |
|
|
|
3012c9 |
return result
|
|
|
3012c9 |
|
|
|
3012c9 |
@@ -129,9 +176,9 @@ def define_new_opts():
|
|
|
3012c9 |
all_opt["token"] = {
|
|
|
3012c9 |
"getopt" : ":",
|
|
|
3012c9 |
"longopt" : "token",
|
|
|
3012c9 |
- "help" : "--token=[token] Bearer Token",
|
|
|
3012c9 |
+ "help" : "--token=[token] API Token",
|
|
|
3012c9 |
"required" : "1",
|
|
|
3012c9 |
- "shortdesc" : "Bearer Token",
|
|
|
3012c9 |
+ "shortdesc" : "API Token",
|
|
|
3012c9 |
"order" : 0
|
|
|
3012c9 |
}
|
|
|
3012c9 |
all_opt["crn"] = {
|
|
|
3012c9 |
@@ -158,6 +205,22 @@ def define_new_opts():
|
|
|
3012c9 |
"shortdesc" : "Region",
|
|
|
3012c9 |
"order" : 0
|
|
|
3012c9 |
}
|
|
|
3012c9 |
+ all_opt["api-type"] = {
|
|
|
3012c9 |
+ "getopt" : ":",
|
|
|
3012c9 |
+ "longopt" : "api-type",
|
|
|
3012c9 |
+ "help" : "--api-type=[private|public] API-type: 'private' (default) or 'public'",
|
|
|
3012c9 |
+ "required" : "0",
|
|
|
3012c9 |
+ "shortdesc" : "API-type (private|public)",
|
|
|
3012c9 |
+ "order" : 0
|
|
|
3012c9 |
+ }
|
|
|
3012c9 |
+ all_opt["proxy"] = {
|
|
|
3012c9 |
+ "getopt" : ":",
|
|
|
3012c9 |
+ "longopt" : "proxy",
|
|
|
3012c9 |
+ "help" : "--proxy=[http://<URL>:<PORT>] Proxy: 'http://<URL>:<PORT>'",
|
|
|
3012c9 |
+ "required" : "0",
|
|
|
3012c9 |
+ "shortdesc" : "Network proxy",
|
|
|
3012c9 |
+ "order" : 0
|
|
|
3012c9 |
+ }
|
|
|
3012c9 |
|
|
|
3012c9 |
|
|
|
3012c9 |
def main():
|
|
|
3012c9 |
@@ -166,6 +229,8 @@ def main():
|
|
|
3012c9 |
"crn",
|
|
|
3012c9 |
"instance",
|
|
|
3012c9 |
"region",
|
|
|
3012c9 |
+ "api-type",
|
|
|
3012c9 |
+ "proxy",
|
|
|
3012c9 |
"port",
|
|
|
3012c9 |
"no_password",
|
|
|
3012c9 |
]
|
|
|
3012c9 |
@@ -173,9 +238,11 @@ def main():
|
|
|
3012c9 |
atexit.register(atexit_handler)
|
|
|
3012c9 |
define_new_opts()
|
|
|
3012c9 |
|
|
|
3012c9 |
- all_opt["shell_timeout"]["default"] = "15"
|
|
|
3012c9 |
+ all_opt["shell_timeout"]["default"] = "500"
|
|
|
3012c9 |
all_opt["power_timeout"]["default"] = "30"
|
|
|
3012c9 |
all_opt["power_wait"]["default"] = "1"
|
|
|
3012c9 |
+ all_opt["api-type"]["default"] = "private"
|
|
|
3012c9 |
+ all_opt["proxy"]["default"] = ""
|
|
|
3012c9 |
|
|
|
3012c9 |
options = check_input(device_opt, process_input(device_opt))
|
|
|
3012c9 |
|
|
|
3012c9 |
@@ -190,8 +257,11 @@ def main():
|
|
|
3012c9 |
## Fence operations
|
|
|
3012c9 |
####
|
|
|
3012c9 |
run_delay(options)
|
|
|
3012c9 |
-
|
|
|
3012c9 |
- conn = connect(options)
|
|
|
3012c9 |
+
|
|
|
3012c9 |
+ auth_conn = auth_connect(options)
|
|
|
3012c9 |
+ token = get_token(auth_conn, options)
|
|
|
3012c9 |
+ disconnect(auth_conn)
|
|
|
3012c9 |
+ conn = connect(options, token)
|
|
|
3012c9 |
atexit.register(disconnect, conn)
|
|
|
3012c9 |
|
|
|
3012c9 |
result = fence_action(conn, options, set_power_status, get_power_status, get_list)
|
|
|
3012c9 |
|
|
|
3012c9 |
From fbe9a539ac8f40686a8027b7e768d9f7b799e485 Mon Sep 17 00:00:00 2001
|
|
|
3012c9 |
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
|
|
|
3012c9 |
Date: Fri, 6 May 2022 11:22:47 +0200
|
|
|
3012c9 |
Subject: [PATCH 2/2] fence_ibm_powervs: cleanup and fixes
|
|
|
3012c9 |
|
|
|
3012c9 |
---
|
|
|
3012c9 |
agents/ibm_powervs/fence_ibm_powervs.py | 37 ++++++++++-------------
|
|
|
3012c9 |
tests/data/metadata/fence_ibm_powervs.xml | 19 ++++++++++--
|
|
|
3012c9 |
2 files changed, 33 insertions(+), 23 deletions(-)
|
|
|
3012c9 |
|
|
|
3012c9 |
diff --git a/agents/ibm_powervs/fence_ibm_powervs.py b/agents/ibm_powervs/fence_ibm_powervs.py
|
|
|
3012c9 |
index 727009220..819ab8896 100755
|
|
|
3012c9 |
--- a/agents/ibm_powervs/fence_ibm_powervs.py
|
|
|
3012c9 |
+++ b/agents/ibm_powervs/fence_ibm_powervs.py
|
|
|
3012c9 |
@@ -1,11 +1,11 @@
|
|
|
3012c9 |
-#!/usr/libexec/platform-python -tt
|
|
|
3012c9 |
+#!@PYTHON@ -tt
|
|
|
3012c9 |
|
|
|
3012c9 |
import sys
|
|
|
3012c9 |
import pycurl, io, json
|
|
|
3012c9 |
import logging
|
|
|
3012c9 |
import atexit
|
|
|
3012c9 |
import time
|
|
|
3012c9 |
-sys.path.append("/usr/share/fence")
|
|
|
3012c9 |
+sys.path.append("@FENCEAGENTSLIBDIR@")
|
|
|
3012c9 |
from fencing import *
|
|
|
3012c9 |
from fencing import fail, run_delay, EC_LOGIN_DENIED, EC_STATUS
|
|
|
3012c9 |
|
|
|
3012c9 |
@@ -16,7 +16,6 @@
|
|
|
3012c9 |
}
|
|
|
3012c9 |
|
|
|
3012c9 |
def get_token(conn, options):
|
|
|
3012c9 |
-
|
|
|
3012c9 |
try:
|
|
|
3012c9 |
command = "identity/token"
|
|
|
3012c9 |
action = "grant_type=urn%3Aibm%3Aparams%3Aoauth%3Agrant-type%3Aapikey&apikey={}".format(options["--token"])
|
|
|
3012c9 |
@@ -25,20 +24,18 @@ def get_token(conn, options):
|
|
|
3012c9 |
logging.debug("Failed: {}".format(e))
|
|
|
3012c9 |
return "TOKEN_IS_MISSING_OR_WRONG"
|
|
|
3012c9 |
|
|
|
3012c9 |
- #if "--verbose" in options:
|
|
|
3012c9 |
- # logging.debug(json.dumps(res, indent=2))
|
|
|
3012c9 |
-
|
|
|
3012c9 |
return res["access_token"]
|
|
|
3012c9 |
|
|
|
3012c9 |
def get_list(conn, options):
|
|
|
3012c9 |
outlets = {}
|
|
|
3012c9 |
-
|
|
|
3012c9 |
+
|
|
|
3012c9 |
try:
|
|
|
3012c9 |
command = "cloud-instances/{}/pvm-instances".format(options["--instance"])
|
|
|
3012c9 |
res = send_command(conn, command)
|
|
|
3012c9 |
except Exception as e:
|
|
|
3012c9 |
logging.debug("Failed: {}".format(e))
|
|
|
3012c9 |
return outlets
|
|
|
3012c9 |
+
|
|
|
3012c9 |
for r in res["pvmInstances"]:
|
|
|
3012c9 |
if "--verbose" in options:
|
|
|
3012c9 |
logging.debug(json.dumps(r, indent=2))
|
|
|
3012c9 |
@@ -47,7 +44,6 @@ def get_list(conn, options):
|
|
|
3012c9 |
return outlets
|
|
|
3012c9 |
|
|
|
3012c9 |
def get_power_status(conn, options):
|
|
|
3012c9 |
-
|
|
|
3012c9 |
try:
|
|
|
3012c9 |
command = "cloud-instances/{}/pvm-instances/{}".format(
|
|
|
3012c9 |
options["--instance"], options["--plug"])
|
|
|
3012c9 |
@@ -56,11 +52,10 @@ def get_power_status(conn, options):
|
|
|
3012c9 |
except KeyError as e:
|
|
|
3012c9 |
logging.debug("Failed: Unable to get status for {}".format(e))
|
|
|
3012c9 |
fail(EC_STATUS)
|
|
|
3012c9 |
-
|
|
|
3012c9 |
+
|
|
|
3012c9 |
return result
|
|
|
3012c9 |
|
|
|
3012c9 |
def set_power_status(conn, options):
|
|
|
3012c9 |
-
|
|
|
3012c9 |
action = {
|
|
|
3012c9 |
"on" : '{"action" : "start"}',
|
|
|
3012c9 |
"off" : '{"action" : "immediate-shutdown"}',
|
|
|
3012c9 |
@@ -77,11 +72,11 @@ def connect(opt, token):
|
|
|
3012c9 |
conn = pycurl.Curl()
|
|
|
3012c9 |
|
|
|
3012c9 |
## setup correct URL
|
|
|
3012c9 |
- conn.base_url = "https://private." + opt["--region"] + ".power-iaas.cloud.ibm.com/pcloud/v1/"
|
|
|
3012c9 |
- if opt["--api-type"] == "public":
|
|
|
3012c9 |
- conn.base_url = "https://" + opt["--region"] + ".power-iaas.cloud.ibm.com/pcloud/v1/"
|
|
|
3012c9 |
+ conn.base_url = "https://" + opt["--region"] + ".power-iaas.cloud.ibm.com/pcloud/v1/"
|
|
|
3012c9 |
+ if opt["--api-type"] == "private":
|
|
|
3012c9 |
+ conn.base_url = "https://private." + opt["--region"] + ".power-iaas.cloud.ibm.com/pcloud/v1/"
|
|
|
3012c9 |
|
|
|
3012c9 |
- if opt["--verbose-level"] > 1:
|
|
|
3012c9 |
+ if opt["--verbose-level"] < 3:
|
|
|
3012c9 |
conn.setopt(pycurl.VERBOSE, 0)
|
|
|
3012c9 |
|
|
|
3012c9 |
conn.setopt(pycurl.CONNECTTIMEOUT,int(opt["--shell-timeout"]))
|
|
|
3012c9 |
@@ -129,7 +124,7 @@ def disconnect(conn):
|
|
|
3012c9 |
|
|
|
3012c9 |
def send_command(conn, command, method="GET", action=None, printResult=True):
|
|
|
3012c9 |
url = conn.base_url + command
|
|
|
3012c9 |
-
|
|
|
3012c9 |
+
|
|
|
3012c9 |
conn.setopt(pycurl.URL, url.encode("ascii"))
|
|
|
3012c9 |
|
|
|
3012c9 |
web_buffer = io.BytesIO()
|
|
|
3012c9 |
@@ -144,10 +139,9 @@ def send_command(conn, command, method="GET", action=None, printResult=True):
|
|
|
3012c9 |
conn.setopt(pycurl.WRITEFUNCTION, web_buffer.write)
|
|
|
3012c9 |
|
|
|
3012c9 |
try:
|
|
|
3012c9 |
- time.sleep(3)
|
|
|
3012c9 |
conn.perform()
|
|
|
3012c9 |
except Exception as e:
|
|
|
3012c9 |
- logging.error("ADD_DEBUG: {}".format(e))
|
|
|
3012c9 |
+ logging.error("send_command(): {}".format(e))
|
|
|
3012c9 |
raise(e)
|
|
|
3012c9 |
|
|
|
3012c9 |
rc = conn.getinfo(pycurl.HTTP_CODE)
|
|
|
3012c9 |
@@ -208,9 +202,9 @@ def define_new_opts():
|
|
|
3012c9 |
all_opt["api-type"] = {
|
|
|
3012c9 |
"getopt" : ":",
|
|
|
3012c9 |
"longopt" : "api-type",
|
|
|
3012c9 |
- "help" : "--api-type=[private|public] API-type: 'private' (default) or 'public'",
|
|
|
3012c9 |
+ "help" : "--api-type=[public|private] API-type: 'public' (default) or 'private'",
|
|
|
3012c9 |
"required" : "0",
|
|
|
3012c9 |
- "shortdesc" : "API-type (private|public)",
|
|
|
3012c9 |
+ "shortdesc" : "API-type (public|private)",
|
|
|
3012c9 |
"order" : 0
|
|
|
3012c9 |
}
|
|
|
3012c9 |
all_opt["proxy"] = {
|
|
|
3012c9 |
@@ -238,9 +232,10 @@ def main():
|
|
|
3012c9 |
atexit.register(atexit_handler)
|
|
|
3012c9 |
define_new_opts()
|
|
|
3012c9 |
|
|
|
3012c9 |
- all_opt["shell_timeout"]["default"] = "500"
|
|
|
3012c9 |
+ all_opt["shell_timeout"]["default"] = "15"
|
|
|
3012c9 |
all_opt["power_timeout"]["default"] = "30"
|
|
|
3012c9 |
all_opt["power_wait"]["default"] = "1"
|
|
|
3012c9 |
+ all_opt["stonith_status_sleep"]["default"] = "3"
|
|
|
3012c9 |
all_opt["api-type"]["default"] = "private"
|
|
|
3012c9 |
all_opt["proxy"]["default"] = ""
|
|
|
3012c9 |
|
|
|
3012c9 |
@@ -257,7 +252,7 @@ def main():
|
|
|
3012c9 |
## Fence operations
|
|
|
3012c9 |
####
|
|
|
3012c9 |
run_delay(options)
|
|
|
3012c9 |
-
|
|
|
3012c9 |
+
|
|
|
3012c9 |
auth_conn = auth_connect(options)
|
|
|
3012c9 |
token = get_token(auth_conn, options)
|
|
|
3012c9 |
disconnect(auth_conn)
|
|
|
3012c9 |
diff --git a/tests/data/metadata/fence_ibm_powervs.xml b/tests/data/metadata/fence_ibm_powervs.xml
|
|
|
3012c9 |
index fe86331bd..81cea4379 100644
|
|
|
3012c9 |
--- a/tests/data/metadata/fence_ibm_powervs.xml
|
|
|
3012c9 |
+++ b/tests/data/metadata/fence_ibm_powervs.xml
|
|
|
3012c9 |
@@ -3,6 +3,16 @@
|
|
|
3012c9 |
<longdesc>fence_ibm_powervs is an I/O Fencing agent which can be used with IBM PowerVS to fence virtual machines.</longdesc>
|
|
|
3012c9 |
<vendor-url>https://www.ibm.com</vendor-url>
|
|
|
3012c9 |
<parameters>
|
|
|
3012c9 |
+ <parameter name="api-type" unique="0" required="0" deprecated="1">
|
|
|
3012c9 |
+ <getopt mixed="--api-type=[public|private]" />
|
|
|
3012c9 |
+ <content type="string" default="private" />
|
|
|
3012c9 |
+ <shortdesc lang="en">API-type (public|private)</shortdesc>
|
|
|
3012c9 |
+ </parameter>
|
|
|
3012c9 |
+ <parameter name="api_type" unique="0" required="0" obsoletes="api-type">
|
|
|
3012c9 |
+ <getopt mixed="--api-type=[public|private]" />
|
|
|
3012c9 |
+ <content type="string" default="private" />
|
|
|
3012c9 |
+ <shortdesc lang="en">API-type (public|private)</shortdesc>
|
|
|
3012c9 |
+ </parameter>
|
|
|
3012c9 |
<parameter name="crn" unique="0" required="1">
|
|
|
3012c9 |
<getopt mixed="--crn=[crn]" />
|
|
|
3012c9 |
<content type="string" />
|
|
|
3012c9 |
@@ -13,6 +23,11 @@
|
|
|
3012c9 |
<content type="string" />
|
|
|
3012c9 |
<shortdesc lang="en">PowerVS Instance</shortdesc>
|
|
|
3012c9 |
</parameter>
|
|
|
3012c9 |
+ <parameter name="proxy" unique="0" required="0">
|
|
|
3012c9 |
+ <getopt mixed="--proxy=[http://<URL>:<PORT>]" />
|
|
|
3012c9 |
+ <content type="string" default="" />
|
|
|
3012c9 |
+ <shortdesc lang="en">Network proxy</shortdesc>
|
|
|
3012c9 |
+ </parameter>
|
|
|
3012c9 |
<parameter name="region" unique="0" required="1">
|
|
|
3012c9 |
<getopt mixed="--region=[region]" />
|
|
|
3012c9 |
<content type="string" />
|
|
|
3012c9 |
@@ -21,7 +36,7 @@
|
|
|
3012c9 |
<parameter name="token" unique="0" required="1">
|
|
|
3012c9 |
<getopt mixed="--token=[token]" />
|
|
|
3012c9 |
<content type="string" />
|
|
|
3012c9 |
- <shortdesc lang="en">Bearer Token</shortdesc>
|
|
|
3012c9 |
+ <shortdesc lang="en">API Token</shortdesc>
|
|
|
3012c9 |
</parameter>
|
|
|
3012c9 |
<parameter name="action" unique="0" required="1">
|
|
|
3012c9 |
<getopt mixed="-o, --action=[action]" />
|
|
|
3012c9 |
@@ -110,7 +125,7 @@
|
|
|
3012c9 |
</parameter>
|
|
|
3012c9 |
<parameter name="stonith_status_sleep" unique="0" required="0">
|
|
|
3012c9 |
<getopt mixed="--stonith-status-sleep=[seconds]" />
|
|
|
3012c9 |
- <content type="second" default="1" />
|
|
|
3012c9 |
+ <content type="second" default="3" />
|
|
|
3012c9 |
<shortdesc lang="en">Sleep X seconds between status calls during a STONITH action</shortdesc>
|
|
|
3012c9 |
</parameter>
|
|
|
3012c9 |
<parameter name="retry_on" unique="0" required="0">
|