XCP-ng
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login
    1. Home
    2. Gurve
    3. Best
    G
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 0
    • Posts 7
    • Groups 0

    Posts

    Recent Best Controversial
    • RE: Extracting data from XO with terraformer

      @michael132 First post so hopefully I don't mess up the formatting too bad.

      I did the import with openTofu (AFAIK it's identical to terraform since it uses the terraform provider behind the scenes).

      After import I got some fields during "plan" action that said it would need to be recreated
      I followed the blogpost here:
      https://xen-orchestra.com/blog/managing-existing-infrastructure-with-terraform-2/

      the 2 offending fields for me was:

      • template
      • destroy_cloud_config_vdi_after_boot

      so I added the small lifecycle part in the bottom and now "plan" is agreeing with the configured infrastructure.

      I also added some math for memory and disk to make it easier to see how many GB it is easier.

      resource "xenorchestra_vm" "imported" {
          template           = "template"
          auto_poweron       = true
          cpus               = 2
          exp_nested_hvm     = false
          hvm_boot_firmware  = "bios"
          memory_max         = 4*1073741824
          name_description   = "k8s-clu01-01"
          name_label         = "K8S-clu01-01"
          start_delay        = 0
          tags               = [
              "k8s-clu-01",
          ]
          cdrom {
              id = "some-cdrom-id"
          }
      
          disk {
              attached         = true
              name_description = "Created by XO"
              name_label       = "Debian Bookworm 12_evibo"
              size             = 50*1073741824
              sr_id            = "some-sr-id"
          }
      
          network {
              attached       = true
              mac_address    = "de:ad:be:ef"
              network_id     = "some-network-id"
          }
          lifecycle {
            ignore_changes = [
              template,
              destroy_cloud_config_vdi_after_boot,
            ]
          }
      }
      
      posted in Infrastructure as Code
      G
      Gurve
    • RE: How to expand a VM disk using xo-cli?

      @eeldivad I think i can "help" somewhat. the "new" and probably more supported in the future way as I see it is doing stuff through xen orchestra Rest api (not everything is possible there yet however)

      http://[yourXO]/rest/v0/vms

      this endpoint is pretty "fire" as the kids say

      as per the README of the rest-api here

      you can add fields to the result, so adding "name_label" like so:

      http://[yourXO]/rest/v0/vms?fields=name_label

      http://[yourXO]/rest/v0/vms?fields=name_label&filter=[namelabelSearch]

      we can then search this output for the VM UUID we want (if you didn't just filter the api query)
      in my example i want "9a5730fa-77bc-1730-4583-c383cbc5c1f1"

      I then call:

      http://[yourXO]/rest/v0/vms/9a5730fa-77bc-1730-4583-c383cbc5c1f1/vdis

      which again is a list of endpoints like this:

      /rest/v0/vdis/cd59c164-b382-4a5c-8449-e668d31696da

      the last part after "vdis" is the disk UUID, you could then call that endpoint to get the VDI size, usage etc.

      Hope this was somewhat helpful 😄

      I did not see a easy way to get this from xo-cli but I figured you can probably get the UUID's from REST and then the "rest" on xo-cli

      posted in REST API
      G
      Gurve