XCP-ng
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Running xe from XOA

    Scheduled Pinned Locked Moved Management
    10 Posts 2 Posters 617 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K Offline
      KPS Top contributor
      last edited by

      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=$sruuid
      

      Thank you and best wishes
      KPS

      1 Reply Last reply Reply Quote 0
      • olivierlambertO Offline
        olivierlambert Vates 🪐 Co-Founder CEO
        last edited by

        XO CLI can probably do that already. We can add it to the REST API also, for convenience.

        K 1 Reply Last reply Reply Quote 0
        • K Offline
          KPS Top contributor @olivierlambert
          last edited by

          @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
          
          1 Reply Last reply Reply Quote 0
          • olivierlambertO Offline
            olivierlambert Vates 🪐 Co-Founder CEO
            last edited by

            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)

            K 1 Reply Last reply Reply Quote 0
            • K Offline
              KPS Top contributor @olivierlambert
              last edited by

              @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)"
              }
              
              1 Reply Last reply Reply Quote 0
              • olivierlambertO Offline
                olivierlambert Vates 🪐 Co-Founder CEO
                last edited by

                You are trying to trim a SR that doesn't support it. Trim is only for block based SR.

                K 1 Reply Last reply Reply Quote 0
                • K Offline
                  KPS Top contributor @olivierlambert
                  last edited by

                  @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.

                  1 Reply Last reply Reply Quote 0
                  • olivierlambertO Offline
                    olivierlambert Vates 🪐 Co-Founder CEO
                    last edited by

                    Use xo-cli --list-commands to see all the available commands 🙂 If you grep on reclaim or trim, you should fine what you need 🙂

                    K 1 Reply Last reply Reply Quote 0
                    • K Offline
                      KPS Top contributor @olivierlambert
                      last edited by

                      @olivierlambert
                      Thank you. I was searching for trim (only).

                      sr.reclaimSpace seems to be the one

                      1 Reply Last reply Reply Quote 1
                      • olivierlambertO Offline
                        olivierlambert Vates 🪐 Co-Founder CEO
                        last edited by

                        Nice! Let us know if you want it to be added on the REST API 🙂

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post