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

Weird behaviour with file_format vs. multiple disks #1458

Open
morsik opened this issue Jul 30, 2024 · 2 comments
Open

Weird behaviour with file_format vs. multiple disks #1458

morsik opened this issue Jul 30, 2024 · 2 comments
Labels
🐛 bug Something isn't working

Comments

@morsik
Copy link

morsik commented Jul 30, 2024

Describe the bug
Proxmox API complains about using qcow2 with Thin-LVM storage after trying to create VM with 2 disks...

Or rather I should say: Provider does something magical and NOT COMPLAIN when creating first boot disk with wrong qcow2.

To Reproduce
This might be kinda hard to explain, as we're using our own module that uses dynamic function, but as a result we're doing this:

  1. Create a resource proxmox_virtual_environment_vm with 1 disk on datastore_id that uses Thin-LVM.
  2. Run terraform apply.
  3. Runs perfectly fine, even thought IT SHOULDN'T because you can't use default qcow2 as file format for Thin-LVM. And disk is actually created as RAW. What's weirder, is that second terraform apply doesn't show any difference even though provider tries to use qcow2 and Proxmox has set raw anyway.
  4. Run terraform destroy (IMPORTANT! as there's no errors when running consecutive applies!).
  5. Add second disk to proxmox_virtual_environment_vm definition.
  6. Run terraform apply again to create everything from scratch with 2 disks (one boot, and second for data).
  7. See (perfectly valid) error this time:
    ╷
    │ Error: error updating VM: received an HTTP 500 response - Reason: unsupported format 'qcow2' at /usr/share/perl5/PVE/Storage/LvmThinPlugin.pm line 87.
    │
    │   with proxmox_virtual_environment_vm.vms["qdrant-3"],
    │   on proxmox.tf line 18, in resource "proxmox_virtual_environment_vm" "vms":
    │   18: resource "proxmox_virtual_environment_vm" "vms" {
    │
    ╵
    

Manually specifying file_format = "raw" of course works, the issue is not with wrong file_format interpretation, it's about incorrect behaviour with first disk.

Expected behavior
Provider should fail at the beginning when boot disk was trying to create with wrong setting.

Additional context

  • Proxmox version: 8.1.3

  • terraform version:

    on darwin_arm64
    + provider registry.terraform.io/bpg/proxmox v0.43.2
    + provider registry.terraform.io/cloudflare/cloudflare v4.35.0
    + provider registry.terraform.io/equinix/equinix v1.20.1
    + provider registry.terraform.io/hashicorp/aws v5.53.0
    + provider registry.terraform.io/hashicorp/random v3.6.2
    + provider registry.terraform.io/hetznercloud/hcloud v1.44.1
    + provider registry.terraform.io/pan-net/powerdns v1.5.0
  • OS (where you run Terraform/OpenTofu from): macOS Sonoma 14.5 / HomeBrew

@morsik morsik added the 🐛 bug Something isn't working label Jul 30, 2024
@bpg
Copy link
Owner

bpg commented Jul 31, 2024

Hi @morsik 👋🏼

  1. Create a resource proxmox_virtual_environment_vm with 1 disk on datastore_id that uses Thin-LVM.

Are you creating an empty disk, or importing some existing disk image via file_id, similar to

file_id = proxmox_virtual_environment_file.latest_ubuntu_22_jammy_qcow2_img.id

@bpg bpg added the ⌛ pending author's response Requested additional information from the reporter label Aug 1, 2024
@morsik
Copy link
Author

morsik commented Aug 5, 2024

@bpg great question! I totally forgot about this important detail!

We're cloning VM Template which already contains disk image with Debian and it's correctly resized later to desired size specified in first disk. VM Template disk is on Thin LVM pool.

And no warning/error about wrong format for that disk.

@bpg bpg removed the ⌛ pending author's response Requested additional information from the reporter label Sep 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants