oVirt / terraform-provider-ovirt

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

Resource `disk_from_image` fails to upload via imageio proxy. #508

Open jzandbergen opened 1 year ago

jzandbergen commented 1 year ago

Describe the bug

I am unable to upload an image to oVirt 4.5 using the disk_from_image resource. Although a upload from the browser works fine.

When examining the terraform logs I see that the provider is trying to connect to a oVirt node directly instead of the imageio service on the ovirt-engine. This fails since the node is not accessible directly.

I'm wondering i'm missing some configuration somewhere or that this might be expected behaviour...

To Reproduce

terraform {
  required_providers {
    ovirt = {
      source = "oVirt/ovirt"
      version = "2.1.5"
    }
  }
}

provider "ovirt" {
  url = var.ovirt_url
  username  = var.ovirt_username
  password  = var.ovirt_password
  tls_system = true
}

resource "ovirt_disk_from_image" "test" {
  storage_domain_id = var.storage_domain_id
  format           = cow
  alias               = DiskyMcDiskface
  sparse           = true
  source_file    = ./debian-12-genericcloud-amd64.qcow2
}

Expected behavior

Disk successfully created in storage domain.

Kind regards

engelmi commented 1 year ago

Hi @jzandbergen

When examining the terraform logs I see that the provider is trying to connect to a oVirt node directly instead of the imageio service on the ovirt-engine.

That is correct and the expected behavior. The oVirt Terraform Provider (only) uses the API of the engine and, therefore, needs access to upload an image as well. Could you make the ovirt-engine node accessible and check if that problem persists? Also, there had been an issue with creating qcow disks (see #496) with this provider. Although it has been fixed, there has been no release for it.

jzandbergen commented 1 year ago

Hi @engelmi thank you very much for your time.

That is correct and the expected behavior. The oVirt Terraform Provider (only) uses the API of the engine and, therefore, needs access to upload an image as well.

Could you make the ovirt-engine node accessible and check if that problem persists?

I think I was unclear in my original message. The ovirt-engine is accessible although the ovirt nodes (eg. the kvm machines) are not.

So the provider first goes to the ovirt-engine where it successfully "creates" the disk image. But when it actually tries to send data it tries to send the data directly to the ovirt nodes (not accessible) instead of the ovirt-engine (is accessible).

When running this terraform from within the network where the ovirt-nodes reside it works like it should.

Also, there had been an issue with creating qcow disks (see https://github.com/oVirt/terraform-provider-ovirt/pull/496) with this provider. Although it has been fixed, there has been no release for it.

Thanks for the heads up :+1:

Regards,