Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Allow disks to be managed individually #299

Open
smrqdt opened this issue Feb 21, 2024 · 1 comment
Open

[Feature] Allow disks to be managed individually #299

smrqdt opened this issue Feb 21, 2024 · 1 comment

Comments

@smrqdt
Copy link

smrqdt commented Feb 21, 2024

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)
}
@ddelnano
Copy link
Collaborator

Hey @smrqdt, thanks for reaching out and providing a detailed feature request. I need to spend some time investigating this, but at a first glance it seems feasible to do and I agree it would be worthwhile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants