oVirt / terraform-provider-ovirt

Terraform provider for oVirt 4.x
https://registry.terraform.io/providers/oVirt/ovirt/latest/docs
Other
137 stars 72 forks source link

ovirt_vm with template not create preallocated disk #473

Closed PedroSilvaUW closed 2 years ago

PedroSilvaUW commented 2 years ago

Describe the bug

I made a template in ovirt with pre-allocated disk but when i point to this template in terraform the vm is created with thin-provisioning disk. Also i use a template_disk_attachement_override but not change anything

To Reproduce

If you can please provide the steps to reproduce the issue.

  1. Terraform will perform the following actions:
    
    # module.temp02.ovirt_vm.vm["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"] will be created
    + resource "ovirt_vm" "vm" {
      + clone                     = false
      + cluster_id                = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
      + effective_template_id     = (known after apply)
      + id                        = (known after apply)
      + memory                    = 2000000000
      + name                      = "terraform_hello_world"
      + placement_policy_affinity = "migratable"
      + placement_policy_host_ids = [
          + "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
        ]
      + status                    = (known after apply)
      + template_id               = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    
      + template_disk_attachment_override {
          + disk_id      = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
          + format       = "raw"
          + provisioning = "non-sparse"
        }
    }
  2. Error: Failed to create VM
    │ 
    │   with module.temp02.ovirt_vm.vm["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"],
    │   on modules/vms/main.tf line 25, in resource "ovirt_vm" "vm":
    │   25: resource "ovirt_vm" "vm" {
    │ 
    │ generic_error: non-retryable error encountered while creating VM terraform_hello_world, giving up
    │ (Fault reason is "Operation Failed". Fault detail is "[Cannot add VM. Thin provisioned template disks
    │ can not be defined as Raw.]". HTTP response code is "400". HTTP response message is "400 Bad
    │ Request".)

    Expected behavior

Create a vm form a template with preallocated disk. Is that possible manually.

ghost commented 2 years ago

Hey @PedroSilvaUW please set clone=true in order to use preallocated VMs, otherwise the preallocation will not work. This is an oVirt limitation and not related to the Terraform provider.

PedroSilvaUW commented 2 years ago

works :) thanks :100: