|
|
cbc3ed |
From 3078e4d55d3bad2bbf9309785fdb2b53afac8d65 Mon Sep 17 00:00:00 2001
|
|
|
cbc3ed |
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
|
|
|
cbc3ed |
Date: Tue, 13 Jul 2021 13:39:33 +0200
|
|
|
cbc3ed |
Subject: [PATCH] fence_ibm_vpc/fence_ibm_powervs: new fence agents
|
|
|
cbc3ed |
|
|
|
cbc3ed |
---
|
|
|
cbc3ed |
agents/ibm_powervs/fence_ibm_powervs.py | 202 +++++++++++++++++++
|
|
|
cbc3ed |
agents/ibm_vpc/fence_ibm_vpc.py | 230 ++++++++++++++++++++++
|
|
|
cbc3ed |
tests/data/metadata/fence_ibm_powervs.xml | 134 +++++++++++++
|
|
|
cbc3ed |
tests/data/metadata/fence_ibm_vpc.xml | 134 +++++++++++++
|
|
|
cbc3ed |
5 files changed, 724 insertions(+)
|
|
|
cbc3ed |
create mode 100755 agents/ibm_powervs/fence_ibm_powervs.py
|
|
|
cbc3ed |
create mode 100755 agents/ibm_vpc/fence_ibm_vpc.py
|
|
|
cbc3ed |
create mode 100644 tests/data/metadata/fence_ibm_powervs.xml
|
|
|
cbc3ed |
create mode 100644 tests/data/metadata/fence_ibm_vpc.xml
|
|
|
cbc3ed |
|
|
|
cbc3ed |
diff --git a/agents/ibm_powervs/fence_ibm_powervs.py b/agents/ibm_powervs/fence_ibm_powervs.py
|
|
|
cbc3ed |
new file mode 100755
|
|
|
cbc3ed |
index 000000000..6649771ea
|
|
|
cbc3ed |
--- /dev/null
|
|
|
cbc3ed |
+++ b/agents/ibm_powervs/fence_ibm_powervs.py
|
|
|
cbc3ed |
@@ -0,0 +1,202 @@
|
|
|
cbc3ed |
+#!@PYTHON@ -tt
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+import sys
|
|
|
cbc3ed |
+import pycurl, io, json
|
|
|
cbc3ed |
+import logging
|
|
|
cbc3ed |
+import atexit
|
|
|
cbc3ed |
+sys.path.append("@FENCEAGENTSLIBDIR@")
|
|
|
cbc3ed |
+from fencing import *
|
|
|
cbc3ed |
+from fencing import fail, run_delay, EC_LOGIN_DENIED, EC_STATUS
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+state = {
|
|
|
cbc3ed |
+ "ACTIVE": "on",
|
|
|
cbc3ed |
+ "SHUTOFF": "off",
|
|
|
cbc3ed |
+ "ERROR": "unknown"
|
|
|
cbc3ed |
+}
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+def get_list(conn, options):
|
|
|
cbc3ed |
+ outlets = {}
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ try:
|
|
|
cbc3ed |
+ command = "cloud-instances/{}/pvm-instances".format(options["--instance"])
|
|
|
cbc3ed |
+ res = send_command(conn, command)
|
|
|
cbc3ed |
+ except Exception as e:
|
|
|
cbc3ed |
+ logging.debug("Failed: {}".format(e))
|
|
|
cbc3ed |
+ return outlets
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ for r in res["pvmInstances"]:
|
|
|
cbc3ed |
+ if "--verbose" in options:
|
|
|
cbc3ed |
+ logging.debug(json.dumps(r, indent=2))
|
|
|
cbc3ed |
+ outlets[r["pvmInstanceID"]] = (r["serverName"], state[r["status"]])
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ return outlets
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+def get_power_status(conn, options):
|
|
|
cbc3ed |
+ try:
|
|
|
cbc3ed |
+ command = "cloud-instances/{}/pvm-instances/{}".format(
|
|
|
cbc3ed |
+ options["--instance"], options["--plug"])
|
|
|
cbc3ed |
+ res = send_command(conn, command)
|
|
|
cbc3ed |
+ result = get_list(conn, options)[options["--plug"]][1]
|
|
|
cbc3ed |
+ except KeyError as e:
|
|
|
cbc3ed |
+ logging.debug("Failed: Unable to get status for {}".format(e))
|
|
|
cbc3ed |
+ fail(EC_STATUS)
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ return result
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+def set_power_status(conn, options):
|
|
|
cbc3ed |
+ action = {
|
|
|
cbc3ed |
+ "on" : '{"action" : "start"}',
|
|
|
cbc3ed |
+ "off" : '{"action" : "immediate-shutdown"}',
|
|
|
cbc3ed |
+ }[options["--action"]]
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ try:
|
|
|
cbc3ed |
+ send_command(conn, "cloud-instances/{}/pvm-instances/{}/action".format(
|
|
|
cbc3ed |
+ options["--instance"], options["--plug"]), "POST", action)
|
|
|
cbc3ed |
+ except Exception as e:
|
|
|
cbc3ed |
+ logging.debug("Failed: Unable to set power to {} for {}".format(options["--action"], e))
|
|
|
cbc3ed |
+ fail(EC_STATUS)
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+def connect(opt):
|
|
|
cbc3ed |
+ conn = pycurl.Curl()
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ ## setup correct URL
|
|
|
cbc3ed |
+ conn.base_url = "https://" + opt["--region"] + ".power-iaas.cloud.ibm.com/pcloud/v1/"
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ if opt["--verbose-level"] > 1:
|
|
|
cbc3ed |
+ conn.setopt(pycurl.VERBOSE, 1)
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ conn.setopt(pycurl.TIMEOUT, int(opt["--shell-timeout"]))
|
|
|
cbc3ed |
+ conn.setopt(pycurl.SSL_VERIFYPEER, 1)
|
|
|
cbc3ed |
+ conn.setopt(pycurl.SSL_VERIFYHOST, 2)
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ # set auth token for later requests
|
|
|
cbc3ed |
+ conn.setopt(pycurl.HTTPHEADER, [
|
|
|
cbc3ed |
+ "Content-Type: application/json",
|
|
|
cbc3ed |
+ "Authorization: Bearer {}".format(opt["--token"]),
|
|
|
cbc3ed |
+ "CRN: {}".format(opt["--crn"]),
|
|
|
cbc3ed |
+ "User-Agent: curl",
|
|
|
cbc3ed |
+ ])
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ return conn
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+def disconnect(conn):
|
|
|
cbc3ed |
+ conn.close()
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+def send_command(conn, command, method="GET", action=None):
|
|
|
cbc3ed |
+ url = conn.base_url + command
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ conn.setopt(pycurl.URL, url.encode("ascii"))
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ web_buffer = io.BytesIO()
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ if method == "GET":
|
|
|
cbc3ed |
+ conn.setopt(pycurl.POST, 0)
|
|
|
cbc3ed |
+ if method == "POST":
|
|
|
cbc3ed |
+ conn.setopt(pycurl.POSTFIELDS, action)
|
|
|
cbc3ed |
+ if method == "DELETE":
|
|
|
cbc3ed |
+ conn.setopt(pycurl.CUSTOMREQUEST, "DELETE")
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ conn.setopt(pycurl.WRITEFUNCTION, web_buffer.write)
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ try:
|
|
|
cbc3ed |
+ conn.perform()
|
|
|
cbc3ed |
+ except Exception as e:
|
|
|
cbc3ed |
+ raise(e)
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ rc = conn.getinfo(pycurl.HTTP_CODE)
|
|
|
cbc3ed |
+ result = web_buffer.getvalue().decode("UTF-8")
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ web_buffer.close()
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ if rc != 200:
|
|
|
cbc3ed |
+ if len(result) > 0:
|
|
|
cbc3ed |
+ raise Exception("{}: {}".format(rc,
|
|
|
cbc3ed |
+ result["value"]["messages"][0]["default_message"]))
|
|
|
cbc3ed |
+ else:
|
|
|
cbc3ed |
+ raise Exception("Remote returned {} for request to {}".format(rc, url))
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ if len(result) > 0:
|
|
|
cbc3ed |
+ result = json.loads(result)
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ logging.debug("url: {}".format(url))
|
|
|
cbc3ed |
+ logging.debug("method: {}".format(method))
|
|
|
cbc3ed |
+ logging.debug("response code: {}".format(rc))
|
|
|
cbc3ed |
+ logging.debug("result: {}\n".format(result))
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ return result
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+def define_new_opts():
|
|
|
cbc3ed |
+ all_opt["token"] = {
|
|
|
cbc3ed |
+ "getopt" : ":",
|
|
|
cbc3ed |
+ "longopt" : "token",
|
|
|
cbc3ed |
+ "help" : "--token=[token] Bearer Token",
|
|
|
cbc3ed |
+ "required" : "1",
|
|
|
cbc3ed |
+ "shortdesc" : "Bearer Token",
|
|
|
cbc3ed |
+ "order" : 0
|
|
|
cbc3ed |
+ }
|
|
|
cbc3ed |
+ all_opt["crn"] = {
|
|
|
cbc3ed |
+ "getopt" : ":",
|
|
|
cbc3ed |
+ "longopt" : "crn",
|
|
|
cbc3ed |
+ "help" : "--crn=[crn] CRN",
|
|
|
cbc3ed |
+ "required" : "1",
|
|
|
cbc3ed |
+ "shortdesc" : "CRN",
|
|
|
cbc3ed |
+ "order" : 0
|
|
|
cbc3ed |
+ }
|
|
|
cbc3ed |
+ all_opt["instance"] = {
|
|
|
cbc3ed |
+ "getopt" : ":",
|
|
|
cbc3ed |
+ "longopt" : "instance",
|
|
|
cbc3ed |
+ "help" : "--instance=[instance] PowerVS Instance",
|
|
|
cbc3ed |
+ "required" : "1",
|
|
|
cbc3ed |
+ "shortdesc" : "PowerVS Instance",
|
|
|
cbc3ed |
+ "order" : 0
|
|
|
cbc3ed |
+ }
|
|
|
cbc3ed |
+ all_opt["region"] = {
|
|
|
cbc3ed |
+ "getopt" : ":",
|
|
|
cbc3ed |
+ "longopt" : "region",
|
|
|
cbc3ed |
+ "help" : "--region=[region] Region",
|
|
|
cbc3ed |
+ "required" : "1",
|
|
|
cbc3ed |
+ "shortdesc" : "Region",
|
|
|
cbc3ed |
+ "order" : 0
|
|
|
cbc3ed |
+ }
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+def main():
|
|
|
cbc3ed |
+ device_opt = [
|
|
|
cbc3ed |
+ "token",
|
|
|
cbc3ed |
+ "crn",
|
|
|
cbc3ed |
+ "instance",
|
|
|
cbc3ed |
+ "region",
|
|
|
cbc3ed |
+ "port",
|
|
|
cbc3ed |
+ "no_password",
|
|
|
cbc3ed |
+ ]
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ atexit.register(atexit_handler)
|
|
|
cbc3ed |
+ define_new_opts()
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ all_opt["shell_timeout"]["default"] = "15"
|
|
|
cbc3ed |
+ all_opt["power_timeout"]["default"] = "30"
|
|
|
cbc3ed |
+ all_opt["power_wait"]["default"] = "1"
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ options = check_input(device_opt, process_input(device_opt))
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ docs = {}
|
|
|
cbc3ed |
+ docs["shortdesc"] = "Fence agent for IBM PowerVS"
|
|
|
cbc3ed |
+ docs["longdesc"] = """fence_ibm_powervs is an I/O Fencing agent which can be \
|
|
|
cbc3ed |
+used with IBM PowerVS to fence virtual machines."""
|
|
|
cbc3ed |
+ docs["vendorurl"] = "https://www.ibm.com"
|
|
|
cbc3ed |
+ show_docs(options, docs)
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ ####
|
|
|
cbc3ed |
+ ## Fence operations
|
|
|
cbc3ed |
+ ####
|
|
|
cbc3ed |
+ run_delay(options)
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ conn = connect(options)
|
|
|
cbc3ed |
+ atexit.register(disconnect, conn)
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ result = fence_action(conn, options, set_power_status, get_power_status, get_list)
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ sys.exit(result)
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+if __name__ == "__main__":
|
|
|
cbc3ed |
+ main()
|
|
|
cbc3ed |
diff --git a/agents/ibm_vpc/fence_ibm_vpc.py b/agents/ibm_vpc/fence_ibm_vpc.py
|
|
|
cbc3ed |
new file mode 100755
|
|
|
cbc3ed |
index 000000000..9f84f7b2d
|
|
|
cbc3ed |
--- /dev/null
|
|
|
cbc3ed |
+++ b/agents/ibm_vpc/fence_ibm_vpc.py
|
|
|
cbc3ed |
@@ -0,0 +1,230 @@
|
|
|
cbc3ed |
+#!@PYTHON@ -tt
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+import sys
|
|
|
cbc3ed |
+import pycurl, io, json
|
|
|
cbc3ed |
+import logging
|
|
|
cbc3ed |
+import atexit
|
|
|
cbc3ed |
+sys.path.append("@FENCEAGENTSLIBDIR@")
|
|
|
cbc3ed |
+from fencing import *
|
|
|
cbc3ed |
+from fencing import fail, run_delay, EC_LOGIN_DENIED, EC_STATUS
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+state = {
|
|
|
cbc3ed |
+ "running": "on",
|
|
|
cbc3ed |
+ "stopped": "off",
|
|
|
cbc3ed |
+ "starting": "unknown",
|
|
|
cbc3ed |
+ "stopping": "unknown",
|
|
|
cbc3ed |
+ "restarting": "unknown",
|
|
|
cbc3ed |
+ "pending": "unknown",
|
|
|
cbc3ed |
+}
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+def get_list(conn, options):
|
|
|
cbc3ed |
+ outlets = {}
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ try:
|
|
|
cbc3ed |
+ command = "instances?version=2021-05-25&generation=2&limit={}".format(options["--limit"])
|
|
|
cbc3ed |
+ res = send_command(conn, command)
|
|
|
cbc3ed |
+ except Exception as e:
|
|
|
cbc3ed |
+ logging.debug("Failed: Unable to get list: {}".format(e))
|
|
|
cbc3ed |
+ return outlets
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ for r in res["instances"]:
|
|
|
cbc3ed |
+ if options["--verbose-level"] > 1:
|
|
|
cbc3ed |
+ logging.debug("Node:\n{}".format(json.dumps(r, indent=2)))
|
|
|
cbc3ed |
+ logging.debug("Status: " + state[r["status"]])
|
|
|
cbc3ed |
+ outlets[r["id"]] = (r["name"], state[r["status"]])
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ return outlets
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+def get_power_status(conn, options):
|
|
|
cbc3ed |
+ try:
|
|
|
cbc3ed |
+ command = "instances/{}?version=2021-05-25&generation=2".format(options["--plug"])
|
|
|
cbc3ed |
+ res = send_command(conn, command)
|
|
|
cbc3ed |
+ result = state[res["status"]]
|
|
|
cbc3ed |
+ if options["--verbose-level"] > 1:
|
|
|
cbc3ed |
+ logging.debug("Result:\n{}".format(json.dumps(res, indent=2)))
|
|
|
cbc3ed |
+ logging.debug("Status: " + result)
|
|
|
cbc3ed |
+ except Exception as e:
|
|
|
cbc3ed |
+ logging.debug("Failed: Unable to get status for {}: {}".format(options["--plug"], e))
|
|
|
cbc3ed |
+ fail(EC_STATUS)
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ return result
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+def set_power_status(conn, options):
|
|
|
cbc3ed |
+ action = {
|
|
|
cbc3ed |
+ "on" : '{"type" : "start"}',
|
|
|
cbc3ed |
+ "off" : '{"type" : "stop"}',
|
|
|
cbc3ed |
+ }[options["--action"]]
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ try:
|
|
|
cbc3ed |
+ command = "instances/{}/actions?version=2021-05-25&generation=2".format(options["--plug"])
|
|
|
cbc3ed |
+ send_command(conn, command, "POST", action, 201)
|
|
|
cbc3ed |
+ except Exception as e:
|
|
|
cbc3ed |
+ logging.debug("Failed: Unable to set power to {} for {}".format(options["--action"], e))
|
|
|
cbc3ed |
+ fail(EC_STATUS)
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+def get_bearer_token(conn, options):
|
|
|
cbc3ed |
+ token = None
|
|
|
cbc3ed |
+ try:
|
|
|
cbc3ed |
+ conn.setopt(pycurl.HTTPHEADER, [
|
|
|
cbc3ed |
+ "Content-Type: application/x-www-form-urlencoded",
|
|
|
cbc3ed |
+ "User-Agent: curl",
|
|
|
cbc3ed |
+ ])
|
|
|
cbc3ed |
+ token = send_command(conn, "https://iam.cloud.ibm.com/identity/token", "POST", "grant_type=urn:ibm:params:oauth:grant-type:apikey&apikey={}".format(options["--apikey"]))["access_token"]
|
|
|
cbc3ed |
+ except Exception:
|
|
|
cbc3ed |
+ logging.error("Failed: Unable to authenticate")
|
|
|
cbc3ed |
+ fail(EC_LOGIN_DENIED)
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ return token
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+def connect(opt):
|
|
|
cbc3ed |
+ conn = pycurl.Curl()
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ ## setup correct URL
|
|
|
cbc3ed |
+ conn.base_url = "https://" + opt["--region"] + ".iaas.cloud.ibm.com/v1/"
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ if opt["--verbose-level"] > 1:
|
|
|
cbc3ed |
+ conn.setopt(pycurl.VERBOSE, 1)
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ conn.setopt(pycurl.TIMEOUT, int(opt["--shell-timeout"]))
|
|
|
cbc3ed |
+ conn.setopt(pycurl.SSL_VERIFYPEER, 1)
|
|
|
cbc3ed |
+ conn.setopt(pycurl.SSL_VERIFYHOST, 2)
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ # get bearer token
|
|
|
cbc3ed |
+ bearer_token = get_bearer_token(conn, opt)
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ # set auth token for later requests
|
|
|
cbc3ed |
+ conn.setopt(pycurl.HTTPHEADER, [
|
|
|
cbc3ed |
+ "Content-Type: application/json",
|
|
|
cbc3ed |
+ "Authorization: Bearer {}".format(bearer_token),
|
|
|
cbc3ed |
+ "User-Agent: curl",
|
|
|
cbc3ed |
+ ])
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ return conn
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+def disconnect(conn):
|
|
|
cbc3ed |
+ conn.close()
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+def send_command(conn, command, method="GET", action=None, expected_rc=200):
|
|
|
cbc3ed |
+ if not command.startswith("https"):
|
|
|
cbc3ed |
+ url = conn.base_url + command
|
|
|
cbc3ed |
+ else:
|
|
|
cbc3ed |
+ url = command
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ conn.setopt(pycurl.URL, url.encode("ascii"))
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ web_buffer = io.BytesIO()
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ if method == "GET":
|
|
|
cbc3ed |
+ conn.setopt(pycurl.POST, 0)
|
|
|
cbc3ed |
+ if method == "POST":
|
|
|
cbc3ed |
+ conn.setopt(pycurl.POSTFIELDS, action)
|
|
|
cbc3ed |
+ if method == "DELETE":
|
|
|
cbc3ed |
+ conn.setopt(pycurl.CUSTOMREQUEST, "DELETE")
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ conn.setopt(pycurl.WRITEFUNCTION, web_buffer.write)
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ try:
|
|
|
cbc3ed |
+ conn.perform()
|
|
|
cbc3ed |
+ except Exception as e:
|
|
|
cbc3ed |
+ raise(e)
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ rc = conn.getinfo(pycurl.HTTP_CODE)
|
|
|
cbc3ed |
+ result = web_buffer.getvalue().decode("UTF-8")
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ web_buffer.close()
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ # actions (start/stop/reboot) report 201 when they've been created
|
|
|
cbc3ed |
+ if rc != expected_rc:
|
|
|
cbc3ed |
+ logging.debug("rc: {}, result: {}".format(rc, result))
|
|
|
cbc3ed |
+ if len(result) > 0:
|
|
|
cbc3ed |
+ raise Exception("{}: {}".format(rc,
|
|
|
cbc3ed |
+ result["value"]["messages"][0]["default_message"]))
|
|
|
cbc3ed |
+ else:
|
|
|
cbc3ed |
+ raise Exception("Remote returned {} for request to {}".format(rc, url))
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ if len(result) > 0:
|
|
|
cbc3ed |
+ result = json.loads(result)
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ logging.debug("url: {}".format(url))
|
|
|
cbc3ed |
+ logging.debug("method: {}".format(method))
|
|
|
cbc3ed |
+ logging.debug("response code: {}".format(rc))
|
|
|
cbc3ed |
+ logging.debug("result: {}\n".format(result))
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ return result
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+def define_new_opts():
|
|
|
cbc3ed |
+ all_opt["apikey"] = {
|
|
|
cbc3ed |
+ "getopt" : ":",
|
|
|
cbc3ed |
+ "longopt" : "apikey",
|
|
|
cbc3ed |
+ "help" : "--apikey=[key] API Key",
|
|
|
cbc3ed |
+ "required" : "1",
|
|
|
cbc3ed |
+ "shortdesc" : "API Key",
|
|
|
cbc3ed |
+ "order" : 0
|
|
|
cbc3ed |
+ }
|
|
|
cbc3ed |
+ all_opt["instance"] = {
|
|
|
cbc3ed |
+ "getopt" : ":",
|
|
|
cbc3ed |
+ "longopt" : "instance",
|
|
|
cbc3ed |
+ "help" : "--instance=[instance] Cloud Instance",
|
|
|
cbc3ed |
+ "required" : "1",
|
|
|
cbc3ed |
+ "shortdesc" : "Cloud Instance",
|
|
|
cbc3ed |
+ "order" : 0
|
|
|
cbc3ed |
+ }
|
|
|
cbc3ed |
+ all_opt["region"] = {
|
|
|
cbc3ed |
+ "getopt" : ":",
|
|
|
cbc3ed |
+ "longopt" : "region",
|
|
|
cbc3ed |
+ "help" : "--region=[region] Region",
|
|
|
cbc3ed |
+ "required" : "1",
|
|
|
cbc3ed |
+ "shortdesc" : "Region",
|
|
|
cbc3ed |
+ "order" : 0
|
|
|
cbc3ed |
+ }
|
|
|
cbc3ed |
+ all_opt["limit"] = {
|
|
|
cbc3ed |
+ "getopt" : ":",
|
|
|
cbc3ed |
+ "longopt" : "limit",
|
|
|
cbc3ed |
+ "help" : "--limit=[number] Limit number of nodes returned by API",
|
|
|
cbc3ed |
+ "required" : "1",
|
|
|
cbc3ed |
+ "default": 50,
|
|
|
cbc3ed |
+ "shortdesc" : "Number of nodes returned by API",
|
|
|
cbc3ed |
+ "order" : 0
|
|
|
cbc3ed |
+ }
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+def main():
|
|
|
cbc3ed |
+ device_opt = [
|
|
|
cbc3ed |
+ "apikey",
|
|
|
cbc3ed |
+ "instance",
|
|
|
cbc3ed |
+ "region",
|
|
|
cbc3ed |
+ "limit",
|
|
|
cbc3ed |
+ "port",
|
|
|
cbc3ed |
+ "no_password",
|
|
|
cbc3ed |
+ ]
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ atexit.register(atexit_handler)
|
|
|
cbc3ed |
+ define_new_opts()
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ all_opt["shell_timeout"]["default"] = "15"
|
|
|
cbc3ed |
+ all_opt["power_timeout"]["default"] = "30"
|
|
|
cbc3ed |
+ all_opt["power_wait"]["default"] = "1"
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ options = check_input(device_opt, process_input(device_opt))
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ docs = {}
|
|
|
cbc3ed |
+ docs["shortdesc"] = "Fence agent for IBM Cloud VPC"
|
|
|
cbc3ed |
+ docs["longdesc"] = """fence_ibm_vpc is an I/O Fencing agent which can be \
|
|
|
cbc3ed |
+used with IBM Cloud VPC to fence virtual machines."""
|
|
|
cbc3ed |
+ docs["vendorurl"] = "https://www.ibm.com"
|
|
|
cbc3ed |
+ show_docs(options, docs)
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ ####
|
|
|
cbc3ed |
+ ## Fence operations
|
|
|
cbc3ed |
+ ####
|
|
|
cbc3ed |
+ run_delay(options)
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ conn = connect(options)
|
|
|
cbc3ed |
+ atexit.register(disconnect, conn)
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ result = fence_action(conn, options, set_power_status, get_power_status, get_list)
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+ sys.exit(result)
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+if __name__ == "__main__":
|
|
|
cbc3ed |
+ main()
|
|
|
cbc3ed |
diff --git a/tests/data/metadata/fence_ibm_powervs.xml b/tests/data/metadata/fence_ibm_powervs.xml
|
|
|
cbc3ed |
new file mode 100644
|
|
|
cbc3ed |
index 000000000..fe86331bd
|
|
|
cbc3ed |
--- /dev/null
|
|
|
cbc3ed |
+++ b/tests/data/metadata/fence_ibm_powervs.xml
|
|
|
cbc3ed |
@@ -0,0 +1,134 @@
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+<resource-agent name="fence_ibm_powervs" shortdesc="Fence agent for IBM PowerVS" >
|
|
|
cbc3ed |
+<longdesc>fence_ibm_powervs is an I/O Fencing agent which can be used with IBM PowerVS to fence virtual machines.</longdesc>
|
|
|
cbc3ed |
+<vendor-url>https://www.ibm.com</vendor-url>
|
|
|
cbc3ed |
+<parameters>
|
|
|
cbc3ed |
+ <parameter name="crn" unique="0" required="1">
|
|
|
cbc3ed |
+ <getopt mixed="--crn=[crn]" />
|
|
|
cbc3ed |
+ <content type="string" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">CRN</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="instance" unique="0" required="1">
|
|
|
cbc3ed |
+ <getopt mixed="--instance=[instance]" />
|
|
|
cbc3ed |
+ <content type="string" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">PowerVS Instance</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="region" unique="0" required="1">
|
|
|
cbc3ed |
+ <getopt mixed="--region=[region]" />
|
|
|
cbc3ed |
+ <content type="string" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">Region</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="token" unique="0" required="1">
|
|
|
cbc3ed |
+ <getopt mixed="--token=[token]" />
|
|
|
cbc3ed |
+ <content type="string" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">Bearer Token</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="action" unique="0" required="1">
|
|
|
cbc3ed |
+ <getopt mixed="-o, --action=[action]" />
|
|
|
cbc3ed |
+ <content type="string" default="reboot" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">Fencing action</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="plug" unique="0" required="1" obsoletes="port">
|
|
|
cbc3ed |
+ <getopt mixed="-n, --plug=[id]" />
|
|
|
cbc3ed |
+ <content type="string" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">Physical plug number on device, UUID or identification of machine</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="port" unique="0" required="1" deprecated="1">
|
|
|
cbc3ed |
+ <getopt mixed="-n, --plug=[id]" />
|
|
|
cbc3ed |
+ <content type="string" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">Physical plug number on device, UUID or identification of machine</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="quiet" unique="0" required="0">
|
|
|
cbc3ed |
+ <getopt mixed="-q, --quiet" />
|
|
|
cbc3ed |
+ <content type="boolean" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">Disable logging to stderr. Does not affect --verbose or --debug-file or logging to syslog.</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="verbose" unique="0" required="0">
|
|
|
cbc3ed |
+ <getopt mixed="-v, --verbose" />
|
|
|
cbc3ed |
+ <content type="boolean" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">Verbose mode. Multiple -v flags can be stacked on the command line (e.g., -vvv) to increase verbosity.</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="verbose_level" unique="0" required="0">
|
|
|
cbc3ed |
+ <getopt mixed="--verbose-level" />
|
|
|
cbc3ed |
+ <content type="integer" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">Level of debugging detail in output. Defaults to the number of --verbose flags specified on the command line, or to 1 if verbose=1 in a stonith device configuration (i.e., on stdin).</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="debug" unique="0" required="0" deprecated="1">
|
|
|
cbc3ed |
+ <getopt mixed="-D, --debug-file=[debugfile]" />
|
|
|
cbc3ed |
+ <content type="string" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">Write debug information to given file</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="debug_file" unique="0" required="0" obsoletes="debug">
|
|
|
cbc3ed |
+ <getopt mixed="-D, --debug-file=[debugfile]" />
|
|
|
cbc3ed |
+ <content type="string" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">Write debug information to given file</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="version" unique="0" required="0">
|
|
|
cbc3ed |
+ <getopt mixed="-V, --version" />
|
|
|
cbc3ed |
+ <content type="boolean" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">Display version information and exit</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="help" unique="0" required="0">
|
|
|
cbc3ed |
+ <getopt mixed="-h, --help" />
|
|
|
cbc3ed |
+ <content type="boolean" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">Display help and exit</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="separator" unique="0" required="0">
|
|
|
cbc3ed |
+ <getopt mixed="-C, --separator=[char]" />
|
|
|
cbc3ed |
+ <content type="string" default="," />
|
|
|
cbc3ed |
+ <shortdesc lang="en">Separator for CSV created by 'list' operation</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="delay" unique="0" required="0">
|
|
|
cbc3ed |
+ <getopt mixed="--delay=[seconds]" />
|
|
|
cbc3ed |
+ <content type="second" default="0" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">Wait X seconds before fencing is started</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="disable_timeout" unique="0" required="0">
|
|
|
cbc3ed |
+ <getopt mixed="--disable-timeout=[true/false]" />
|
|
|
cbc3ed |
+ <content type="string" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">Disable timeout (true/false) (default: true when run from Pacemaker 2.0+)</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="login_timeout" unique="0" required="0">
|
|
|
cbc3ed |
+ <getopt mixed="--login-timeout=[seconds]" />
|
|
|
cbc3ed |
+ <content type="second" default="5" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">Wait X seconds for cmd prompt after login</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="power_timeout" unique="0" required="0">
|
|
|
cbc3ed |
+ <getopt mixed="--power-timeout=[seconds]" />
|
|
|
cbc3ed |
+ <content type="second" default="30" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">Test X seconds for status change after ON/OFF</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="power_wait" unique="0" required="0">
|
|
|
cbc3ed |
+ <getopt mixed="--power-wait=[seconds]" />
|
|
|
cbc3ed |
+ <content type="second" default="1" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">Wait X seconds after issuing ON/OFF</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="shell_timeout" unique="0" required="0">
|
|
|
cbc3ed |
+ <getopt mixed="--shell-timeout=[seconds]" />
|
|
|
cbc3ed |
+ <content type="second" default="15" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">Wait X seconds for cmd prompt after issuing command</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="stonith_status_sleep" unique="0" required="0">
|
|
|
cbc3ed |
+ <getopt mixed="--stonith-status-sleep=[seconds]" />
|
|
|
cbc3ed |
+ <content type="second" default="1" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">Sleep X seconds between status calls during a STONITH action</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="retry_on" unique="0" required="0">
|
|
|
cbc3ed |
+ <getopt mixed="--retry-on=[attempts]" />
|
|
|
cbc3ed |
+ <content type="integer" default="1" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">Count of attempts to retry power on</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+</parameters>
|
|
|
cbc3ed |
+<actions>
|
|
|
cbc3ed |
+ <action name="on" automatic="0"/>
|
|
|
cbc3ed |
+ <action name="off" />
|
|
|
cbc3ed |
+ <action name="reboot" />
|
|
|
cbc3ed |
+ <action name="status" />
|
|
|
cbc3ed |
+ <action name="list" />
|
|
|
cbc3ed |
+ <action name="list-status" />
|
|
|
cbc3ed |
+ <action name="monitor" />
|
|
|
cbc3ed |
+ <action name="metadata" />
|
|
|
cbc3ed |
+ <action name="manpage" />
|
|
|
cbc3ed |
+ <action name="validate-all" />
|
|
|
cbc3ed |
+</actions>
|
|
|
cbc3ed |
+</resource-agent>
|
|
|
cbc3ed |
diff --git a/tests/data/metadata/fence_ibm_vpc.xml b/tests/data/metadata/fence_ibm_vpc.xml
|
|
|
cbc3ed |
new file mode 100644
|
|
|
cbc3ed |
index 000000000..926efcaa0
|
|
|
cbc3ed |
--- /dev/null
|
|
|
cbc3ed |
+++ b/tests/data/metadata/fence_ibm_vpc.xml
|
|
|
cbc3ed |
@@ -0,0 +1,134 @@
|
|
|
cbc3ed |
+
|
|
|
cbc3ed |
+<resource-agent name="fence_ibm_vpc" shortdesc="Fence agent for IBM Cloud VPC" >
|
|
|
cbc3ed |
+<longdesc>fence_ibm_vpc is an I/O Fencing agent which can be used with IBM Cloud VPC to fence virtual machines.</longdesc>
|
|
|
cbc3ed |
+<vendor-url>https://www.ibm.com</vendor-url>
|
|
|
cbc3ed |
+<parameters>
|
|
|
cbc3ed |
+ <parameter name="apikey" unique="0" required="1">
|
|
|
cbc3ed |
+ <getopt mixed="--apikey=[key]" />
|
|
|
cbc3ed |
+ <content type="string" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">API Key</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="instance" unique="0" required="1">
|
|
|
cbc3ed |
+ <getopt mixed="--instance=[instance]" />
|
|
|
cbc3ed |
+ <content type="string" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">Cloud Instance</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="limit" unique="0" required="1">
|
|
|
cbc3ed |
+ <getopt mixed="--limit=[number]" />
|
|
|
cbc3ed |
+ <content type="string" default="50" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">Number of nodes returned by API</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="region" unique="0" required="1">
|
|
|
cbc3ed |
+ <getopt mixed="--region=[region]" />
|
|
|
cbc3ed |
+ <content type="string" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">Region</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="action" unique="0" required="1">
|
|
|
cbc3ed |
+ <getopt mixed="-o, --action=[action]" />
|
|
|
cbc3ed |
+ <content type="string" default="reboot" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">Fencing action</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="plug" unique="0" required="1" obsoletes="port">
|
|
|
cbc3ed |
+ <getopt mixed="-n, --plug=[id]" />
|
|
|
cbc3ed |
+ <content type="string" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">Physical plug number on device, UUID or identification of machine</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="port" unique="0" required="1" deprecated="1">
|
|
|
cbc3ed |
+ <getopt mixed="-n, --plug=[id]" />
|
|
|
cbc3ed |
+ <content type="string" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">Physical plug number on device, UUID or identification of machine</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="quiet" unique="0" required="0">
|
|
|
cbc3ed |
+ <getopt mixed="-q, --quiet" />
|
|
|
cbc3ed |
+ <content type="boolean" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">Disable logging to stderr. Does not affect --verbose or --debug-file or logging to syslog.</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="verbose" unique="0" required="0">
|
|
|
cbc3ed |
+ <getopt mixed="-v, --verbose" />
|
|
|
cbc3ed |
+ <content type="boolean" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">Verbose mode. Multiple -v flags can be stacked on the command line (e.g., -vvv) to increase verbosity.</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="verbose_level" unique="0" required="0">
|
|
|
cbc3ed |
+ <getopt mixed="--verbose-level" />
|
|
|
cbc3ed |
+ <content type="integer" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">Level of debugging detail in output. Defaults to the number of --verbose flags specified on the command line, or to 1 if verbose=1 in a stonith device configuration (i.e., on stdin).</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="debug" unique="0" required="0" deprecated="1">
|
|
|
cbc3ed |
+ <getopt mixed="-D, --debug-file=[debugfile]" />
|
|
|
cbc3ed |
+ <content type="string" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">Write debug information to given file</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="debug_file" unique="0" required="0" obsoletes="debug">
|
|
|
cbc3ed |
+ <getopt mixed="-D, --debug-file=[debugfile]" />
|
|
|
cbc3ed |
+ <content type="string" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">Write debug information to given file</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="version" unique="0" required="0">
|
|
|
cbc3ed |
+ <getopt mixed="-V, --version" />
|
|
|
cbc3ed |
+ <content type="boolean" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">Display version information and exit</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="help" unique="0" required="0">
|
|
|
cbc3ed |
+ <getopt mixed="-h, --help" />
|
|
|
cbc3ed |
+ <content type="boolean" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">Display help and exit</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="separator" unique="0" required="0">
|
|
|
cbc3ed |
+ <getopt mixed="-C, --separator=[char]" />
|
|
|
cbc3ed |
+ <content type="string" default="," />
|
|
|
cbc3ed |
+ <shortdesc lang="en">Separator for CSV created by 'list' operation</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="delay" unique="0" required="0">
|
|
|
cbc3ed |
+ <getopt mixed="--delay=[seconds]" />
|
|
|
cbc3ed |
+ <content type="second" default="0" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">Wait X seconds before fencing is started</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="disable_timeout" unique="0" required="0">
|
|
|
cbc3ed |
+ <getopt mixed="--disable-timeout=[true/false]" />
|
|
|
cbc3ed |
+ <content type="string" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">Disable timeout (true/false) (default: true when run from Pacemaker 2.0+)</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="login_timeout" unique="0" required="0">
|
|
|
cbc3ed |
+ <getopt mixed="--login-timeout=[seconds]" />
|
|
|
cbc3ed |
+ <content type="second" default="5" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">Wait X seconds for cmd prompt after login</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="power_timeout" unique="0" required="0">
|
|
|
cbc3ed |
+ <getopt mixed="--power-timeout=[seconds]" />
|
|
|
cbc3ed |
+ <content type="second" default="30" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">Test X seconds for status change after ON/OFF</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="power_wait" unique="0" required="0">
|
|
|
cbc3ed |
+ <getopt mixed="--power-wait=[seconds]" />
|
|
|
cbc3ed |
+ <content type="second" default="1" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">Wait X seconds after issuing ON/OFF</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="shell_timeout" unique="0" required="0">
|
|
|
cbc3ed |
+ <getopt mixed="--shell-timeout=[seconds]" />
|
|
|
cbc3ed |
+ <content type="second" default="15" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">Wait X seconds for cmd prompt after issuing command</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="stonith_status_sleep" unique="0" required="0">
|
|
|
cbc3ed |
+ <getopt mixed="--stonith-status-sleep=[seconds]" />
|
|
|
cbc3ed |
+ <content type="second" default="1" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">Sleep X seconds between status calls during a STONITH action</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+ <parameter name="retry_on" unique="0" required="0">
|
|
|
cbc3ed |
+ <getopt mixed="--retry-on=[attempts]" />
|
|
|
cbc3ed |
+ <content type="integer" default="1" />
|
|
|
cbc3ed |
+ <shortdesc lang="en">Count of attempts to retry power on</shortdesc>
|
|
|
cbc3ed |
+ </parameter>
|
|
|
cbc3ed |
+</parameters>
|
|
|
cbc3ed |
+<actions>
|
|
|
cbc3ed |
+ <action name="on" automatic="0"/>
|
|
|
cbc3ed |
+ <action name="off" />
|
|
|
cbc3ed |
+ <action name="reboot" />
|
|
|
cbc3ed |
+ <action name="status" />
|
|
|
cbc3ed |
+ <action name="list" />
|
|
|
cbc3ed |
+ <action name="list-status" />
|
|
|
cbc3ed |
+ <action name="monitor" />
|
|
|
cbc3ed |
+ <action name="metadata" />
|
|
|
cbc3ed |
+ <action name="manpage" />
|
|
|
cbc3ed |
+ <action name="validate-all" />
|
|
|
cbc3ed |
+</actions>
|
|
|
cbc3ed |
+</resource-agent>
|