1

i try to provision some nodes for a kubernetes cluster based on kvm and debian. I want to use the Debian 11 Genericcloud Image and clound-init to initialize it. So i put the debian baseimge to /var/lib/libvirt/images/templates on the remote machine, where kvm runs. I worked thorugh some tutorials and serverfault post and the say, I should handle it like this in my code:

resource "libvirt_volume" "diskimages" {
  count = var.instance_count
  name = "${var.instance_name}-${count.index}.qcow2"
  pool = libvirt_pool.diskimage_pool.name
  source = var.baseimage
  format = "qcow2"
}

where baseimage = "/var/lib/libvirt/images/templates/debian-11-genericcloud-amd64.qcow2". But when i execute this i get the following error:

Error: error while determining image type for /var/lib/libvirt/images/templates/debian-11-genericcloud-amd64.qcow2: error while opening /var/lib/libvirt/images/templates/debian-11-genericcloud-amd64.qcow2: open /var/lib/libvirt/images/templates/debian-11-genericcloud-amd64.qcow2: no such file or directory
│ 
│   with libvirt_volume.diskimages[4],
│   on libvirt.tf line 25, in resource "libvirt_volume" "diskimages":
│   25: resource "libvirt_volume" "diskimages" {

Same when i try the solution from this serverfault post. Then my code looks like this:

# create .qcow2 image for vm
resource "libvirt_volume" "diskimages" {
  count = var.instance_count
  name = "${var.instance_name}-${count.index}.qcow2"
  pool = libvirt_pool.diskimage_pool.name
  source = "file///var/lib/libvirt/images/templates/debian-11-genericcloud-amd64.qcow2"
  format = "qcow2"
}

and i get the same error.

Does anyone have a clue whats going wrong here? Thanks in advance

1 Answer 1

0

Seems like you missed a ":", it's supposed to be

file://<path>

and hence

file:///var/lib/libvirt/images/templates/debian-11-genericcloud-amd64.qcow2

in your case

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .