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

    XenOrchestra with Terraform

    Scheduled Pinned Locked Moved Xen Orchestra
    4 Posts 4 Posters 692 Views 1 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.
    • nickdslN Offline
      nickdsl
      last edited by

      Hello! We got some issues with VM's creating using Terraform via XenOrchestra.
      We prepared some VM Templates with Packer.
      Template VM RAM size: 4 GiB

      For example we need to deploy a new VM with 8 GiB RAM. We add required property to .tf file: memory_max = 8394967296

      This is doc: https://registry.terraform.io/providers/terra-farm/xenorchestra/latest/docs/resources/vm

      After successfuly VM creation we saw that VM has dynamically RAM pool settings: memory min 4 GiB, memory Max: 8 GiB

      Could you tell us how to set a fixed memory size for VM using terraform and XenOrchestra?

      If target VM has same amount RAM as a template we see dynamically RAM pool with 4 GiB min and 4 GiB max settings.
      We tried manually set template size (experiment!) to 128 GiB. We thouhgt that terraform will reduce this value to our target value = 8 GiB. But it failed 😃 VM got 128 GiB RAM and cannot start (Because our host have 128 GiB total mem and other running VM's).

      We saw that dynamically memory feature is deprecated. We wanna know hot to solve this.

      Thank you.

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

        Hmm might be a question for @ddelnano I suppose 🤔

        1 Reply Last reply Reply Quote 0
        • D Offline
          ddelnano Terraform Team @nickdsl
          last edited by

          @nickdsl can you please share a terraform code example and the necessary commands to reproduce the problem? I'm not sure I understand what happened without seeing a concrete example of the problem.

          D 1 Reply Last reply Reply Quote 0
          • D Offline
            David @ddelnano
            last edited by

            @ddelnano Sorry to drag this up and also no OP, but I'm just looking at how to set a static RAM allocation via terraform too so this would be relevant to me.
            Here's a snippet of code, it's using a generic Ubuntu 22.04 LTS cloud image template which has 1GB ram by default, in the code I set the memory to 4GB, which works but uses Dynamic rather than static

            resource "xenorchestra_vm" "bar" {
                name_label = "TerraformCreatedMe"
                name_description = "Terraform Managed"
                template = data.xenorchestra_template.ubuntu22.id
                memory_max = 4294967296
                cpus  = 4
                destroy_cloud_config_vdi_after_boot = true
                hvm_boot_firmware                   = "uefi"
            

            From the hypervisor side the VM looks like this:

            memory-static-max ( RW): 4294967296                         
            memory-dynamic-max ( RW): 4294967296
            memory-dynamic-min ( RW): 1073741824
            memory-static-min ( RW): 1073741824
            

            So to me it looks like memory_max in terraform changes just memory-static-max and memory-dynamic-max which leaves the VM with dynamic memory control.

            I want the behaviour to be, when I create a new VM or change the RAM allocation for the VM to have static RAM not dynamic. I hope this is possible.

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