Skip to content

[Feature] Allow disks to be managed individually  #299

Description

@smrqdt

Currently, it is not possible to replace a VM while retaining a disk to reuse it with the new VM. It would be very useful, if the provider would allow to manage a VDI as a separate resource which could be referenced by id, similar to the cdrom block.

Motivation

We use Fedora CoreOS as guest OS, which is meant to be managed as immutable infrastructure. To change the configuration, the Ignition file has to be regenerated and the OS has to be redeployed.
To retain state (container volumes) we mount /var to a different disk, while the configuration is discarded and later rewritten by ignition.

Problem

The easiest way to do this would be to trigger a replacement of the VM by terraform. Sadly, currently this means, the disks will also be destroyed and new ones created.

At the moment we resort to leaving the VM as it is and manually triggering a reprovisioning (e.g. rebooting into PXE), which is tedious.

Solution

Therefore it would be useful if:

  • an empty VDI could be created by the xenorchestra_vdi resource and
  • a VDI could be referenced in a disk block

Example

resource "xenorchestra_vm" "vm" {
  # ....

  disk {
    sr_id      = data.xenorchestra_sr.sr.id
    name_label = "example_root"
    size       = 10 * pow(1024, 3)
  }

  disk {
    id = xenorchestra_vdi.var.id
  }
}

resource "xenorchestra_vdi" "var" {
    name_label = "example_var"
    sr_id = data.xenorchestra_sr.sr.id
    size = 10 * pow(1024, 3)
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions