Conversation
|
Can one of the admins verify this patch? |
|
It's failing CI now on absence of Updated: figured that out -- that last bit of the doc at FenceAgentAPI hinted at what to do. |
|
|
||
| rescue_url = "/cloud/project/%s/instance/%s/rescueMode" % (options['--service-name'], options['--instance-id']) | ||
|
|
||
| if options["--action"] == "off": |
There was a problem hiding this comment.
You should put the on/off code into e.g. set_power_status() and make a get_power_status() where it returns on/off/unknown. This way it can e.g. send reboot as send power-off, wait for power off, send power-on, wait for power-on.
Similar agent with a good example on how to do this:
https://github.com/ClusterLabs/fence-agents/blob/master/agents/vmware_rest/fence_vmware_rest.py#L178
There was a problem hiding this comment.
Ah, good idea. I misread part of the FenceAgentAPI doc and thought it meant reboot was a bad idea in general (but I see it suggests that only that is a bad idea for fabric fencing).
I'll make this change.
There was a problem hiding this comment.
@oalbrigt One question -- does it matter if my get_power_status fails? As in, will the code in fencing.py retry until it gets a valid status? Or does my code need to sleep and poll until it gets a valid power status (as I've done in the code here)? It's not 100% obvious to me as I don't know if the vmware example one sometimes returns states between off and on as the OVH one does (ie if going to RESCUE, it returns RESCUING until it is ready and then RESCUE).
There was a problem hiding this comment.
Just make it return Unknown when it's in those states. That way it will keep on trying until it gets OFF/ON or times out. You can try running it with -o off, on or reboot and using the -v parameter to see what it's actually doing (requires you to use "result = fence_action(conn, options, set_power_status, get_power_status, get_list)" to set the functions used for set_power_status/get_power_status).
|
You can run "make xml-upload" to generate/update this. |
This adds an agent for the OVH Cloud servers via the REST API. The REST API uses Oauth for authentication. Because of the authentication method, the agent ends up expecting an application key, an application secret and a consumer key or token. Getting/creating these values is explained at First Steps with the API. When creating the consumer key or token, it's important to select the option that disables expiration of it. Noting this here as it was unclear where this kind of documentation should go.
I'm also a bit unclear on the metadata aspect however I've implemented both
onandoff(with polling to verify status before it exits with return value0or1).