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

    Inquiry about Obtaining VM Disk Space Usage via XO API or XO-CLI

    Scheduled Pinned Locked Moved REST API
    5 Posts 3 Posters 350 Views 3 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.
    • S Offline
      samuelolavo
      last edited by

      Hello,

      I'm currently using Xen Orchestra (XO) to manage my virtual machines (VMs), and I need to retrieve the amount of disk space each VM is occupying on the underlying storage. Could you please guide me on how to achieve this using either the XO API or XO-CLI?

      Specifically, I would like to know:

      How can I programmatically retrieve the disk space usage for each VM via the XO API?
      Alternatively, how can I use XO-CLI to gather information about the disk space utilization of each VM?
      Any assistance or examples demonstrating the API endpoints or CLI commands to accomplish this task would be greatly appreciated.

      Thank you for your support.
      Samuel Olavo

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

        Hi,

        Sadly, it's impossible to answer since we have no idea what kind of storage do you use, and what's really your problem right now. What do you mean by retrieve disk space exactly?

        S 1 Reply Last reply Reply Quote 0
        • S Offline
          samuelolavo @olivierlambert
          last edited by samuelolavo

          @olivierlambert
          Hi,

          At my workplace, we usually create virtual machines (VMs) for each user. However, some of these VMs are no longer in use. The goal is to understand how much storage space these inactive VMs are occupying.

          We have 3 SR block based per iSCSI

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

            Ah I see! I think there's a way via the REST API, with the VDI endpoint. Just let me ask @julien-f here to answer 🙂

            julien-fJ 1 Reply Last reply Reply Quote 0
            • julien-fJ Offline
              julien-f Vates 🪐 Co-Founder XO Team @olivierlambert
              last edited by

              First of all, take a look at the general XO REST API documentation.

              Then, take a look at xo-cli --help which explain how to use it to interact with the REST API.

              You can list all VDIs at /rest/v0/vdis, snapshots are available at /rest/v0/vdi-snapshots.

              You also have the ability to list the VDIs attached to a specific VM at /rest/v0/vms/:id/vdis.

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