-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add agent for OVH Cloud (REST API) #202
base: main
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
on
andoff
(with polling to verify status before it exits with return value0
or1
).