Greetings everyone, I am having another problem that I was hoping to get some
assistance with.
I have created my own custom fence agent for some tasmota-flashed wifi smart
plugs, that can control plug power input to ovirt nodes. This works great;
however I am running into a problem getting it added to ovirt as a power
manager. I got the custom fence agent added with engine-config -s, and it shows
up in the webui to select as a power management agent, then I put in the
details for the plug, IP address, login, password, and press the "test" button,
which passes, and shows the status as power=on. Once I save the settings,
however, it is logged in the engine.log file that fencing will fail, because
there is no node available to proxy the operation. When I go back into the
power management settings, and press "test" again, then I get the error: "Test
failed: Failed to run fence status-check on host 'ovirt1'. No other host was
available to serve as proxy for the operation."
I have the agent script in /usr/sbin/ on all nodes, execute permissions set,
and I can run it manually at the command line just fine, so I am really at a
loss here as what to check. What am I missing here? Please help.
Thank you for your time.
Script:
#!/usr/libexec/platform-python -tt
from urllib.parse import quote
import requests
import sys
import atexit
sys.path.append("/usr/share/fence")
from fencing import *
def set_power_status(conn, options):
if "on" in options["--action"]:
response = requests.get(buildUrl(options, "on"))
elif "off" in options["--action"]:
response = requests.get(buildUrl(options, "off"))
return
def get_power_status(conn, options):
response = requests.get(buildUrl(options, "status"))
if "\"Power\":0" in response.text:
return "off"
elif "\"Power\":1" in response.text:
return "on"
def buildUrl(options, action):
cmnd = {
'on' : 'Power On',
'off' : 'Power Off',
'status' : 'Status'
}
return "http://" + options["--ip"] + "/cm?user=" +
quote(options["--username"]) + "&password=" + quote(options["--password"]) +
"&cmnd=" + quote(cmnd.get(action, "Error"))
def main():
device_opt = ["ipaddr", "login", "passwd", "web"]
atexit.register(atexit_handler)
all_opt["power_wait"]["default"] = 5
options = check_input(device_opt, process_input(device_opt))
docs = {}
docs["shortdesc"] = "Fence agent for Tasmota-flashed Smarthome Plugs"
docs["longdesc"] = ""
docs["vendorurl"] = ""
show_docs(options, docs)
##
## Fence operations
####
result = fence_action(None, options, set_power_status, get_power_status)
sys.exit(result)
if __name__ == "__main__":
main()
_______________________________________________
Users mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Privacy Statement: https://www.ovirt.org/privacy-policy.html
oVirt Code of Conduct:
https://www.ovirt.org/community/about/community-guidelines/
List Archives:
https://lists.ovirt.org/archives/list/[email protected]/message/5CPYEXCOJWRXKFJ2CFBTKOWVX5MHRKHB/