@MathieuRA I see, no problem! Would be nice to see something like this in the future. Just to make sure: there is also no actions to start a job via API? That would be a workaround with a job doing nothing but host.stop.
Thank you for your time and help!
Best posts made by hanzzz
-
RE: Run a job (host.stop) defined in XOCE via API
Latest posts made by hanzzz
-
RE: Run a job (host.stop) defined in XOCE via API
@MathieuRA I see, no problem! Would be nice to see something like this in the future. Just to make sure: there is also no actions to start a job via API? That would be a workaround with a job doing nothing but host.stop.
Thank you for your time and help! -
RE: Run a job (host.stop) defined in XOCE via API
@olivierlambert hi, I think so, or let's say I could not find the correct endpoint at least.
To shutdown the VMs I used:
'http://{{xoserver}}/rest/v0/vms/{{vmcode}}/actions/clean_shutdown'
But adjusting this to:
'http://{{xoserver}}/rest/v0/hosts/{{hostcode}}/actions/clean_shutdown'
to stop the host did not work. Most likely I am just missing the correct action term to stop it? -
Run a job (host.stop) defined in XOCE via API
Dear all,
My setup is far from advanced (single host in the pool) that is only on on demand not 24h - it is more playing than productivity. I am trying to use home assistant to control my XCP-ng 8.3 host. I would like to be able to start the host, start/stop/restart VMs on that host, shutdown the host (all VMs shutdown before). The following steps I solved:- Start host (wake on lan)
- Control VMs (shell command: shell_command: curl -X POST -b authenticationToken={{token}} 'http://{{xoserver}}/rest/v0/vms/{{vmcode}}/actions/{{action}}')
For the last part (shutdown host) I could not figure out a solution so far. I think there is no endpoint to stop the host or do I just miss it? That would the simplest way to go. Alternatively, I tried to setup a job with the only command "Host.stop". So an alternative approach could be to run this job from API but I could not find an endpoint for this as well...
Actually, I am running XOCE in a Docker on a Synology NAS, so I can control the host from that and make sure that all VMs are shutdown.
Does anyone have an idea how to realize this with API calls (via Home Assistent) or is this just not possible?