Running xe from XOA
-
Hi!
I want to schedule some maintenance processes on XCP-ng - e.g. an automatic trim on my storage.
Is there any option to schedule from XOA, or is it the only way to do this on the XCP-host itself?
The task, I want to schedule is:
xe host-call-plugin plugin=trim host-uuid=$hostuuid fn=do_trim args:sr_uuid=$sruuidThank you and best wishes
KPS -
XO CLI can probably do that already. We can add it to the REST API also, for convenience.
-
@olivierlambert
Sounds good! Currently, I cannot find any trim-options in xo-cli, but that would be great. Currently, my workaround was a crontab-entry on the host:for sruuid in $(xe sr-list type=lvmoiscsi | grep uuid | awk '{print $5}'); do sleep 10 && /opt/xensource/bin/xe host-call-plugin plugin=trim host-uuid=$(xe host-list name-label=$(hostname) | grep uuid | awk '{print $5}') fn=do_trim args:sr_uuid=$sruuid; done -
If you can do it in the UI, then you can do it with the CLI, since it's calling the same component in the end (
xo-server) -
@olivierlambert
There is a "reclaim free disk space" button in the GUI, but I am getting with latest XOA stable:sr.reclaimSpace { "id": "xxxxx-xxxxx-xxxxx-xxxxx" } { "code": "UnsupportedSRForTrim", "message": "Trim on [xxxxx-xxxxx-xxxxx-xxxxx] not supported", "name": "Error", "stack": "Error: Trim on [xxxxx-xxxxx-xxxxx-xxxxx] not supported at Xapi.reclaimSpace (file:///usr/local/lib/node_modules/xo-server/node_modules/@xen-orchestra/xapi/sr.mjs:159:19) at Xo.reclaimSpace (file:///usr/local/lib/node_modules/xo-server/src/api/sr.mjs:966:3) at Api.#callApiMethod (file:///usr/local/lib/node_modules/xo-server/src/xo-mixins/api.mjs:445:20)" } -
You are trying to trim a SR that doesn't support it. Trim is only for block based SR.
-
@olivierlambert
Sorry about that! I did click on the wrong SR...Can you tell me the cli-command to start the trim to schedule it? I did not find it in the xo-cli manpage.
-
Use
xo-cli --list-commandsto see all the available commands
If you grep on reclaim or trim, you should fine what you need 
-
@olivierlambert
Thank you. I was searching for trim (only).sr.reclaimSpace seems to be the one
-
Nice! Let us know if you want it to be added on the REST API

Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login