dmacvicar / terraform-provider-libvirt

Terraform provider to provision infrastructure with Linux's KVM using libvirt
Apache License 2.0
1.6k stars 459 forks source link

Using full clone feature for volumes when running terraform from remote location #676

Open avekrivoy opened 4 years ago

avekrivoy commented 4 years ago

Is it possible to create new volume for domain from base image using full copy feature? Not CoW mechanism. I'm running terraform from my local machine and therefore can't use the following syntax

provider "libvirt" {
    uri = "qemu+ssh://remote-host.com/system"
}

resource "libvirt_volume" "ubuntu18-qcow2" {
  name = "ubuntu18-qcow2"
  pool = "default"
  source = "/var/packer/templates/ubuntu-18.04-base"
  format = "qcow2"
}

because terraform will lookup for an image on my local machine, where terraform provider is installed.

So, is there any option that will allow me to make a full copy from base image in pool?

a0s commented 4 years ago

+1

avekrivoy commented 4 years ago

I browsed the code and seems like it's not possible. I modified code (in a quite ugly way) and made it working for me. Added full_clone option and when used with source it clones image:

resource "libvirt_volume" "kube-node-1" {
  name = "kube-node-1"
  pool = "default"
  source = "ubuntu-18.04-base"
  format = "qcow2"
  full_clone = true
}

For this feature I used StorageVolCreateXMLFrom

nmaludy commented 3 years ago

+1 would like this also!

DanielWood commented 3 years ago

Bumping this. Would be extremely useful to have this work remotely

jattind commented 1 year ago

Would be really nice to have clone feature. Creating volumes on remote servers is very expensive and time consuming. Thanks.

streicherishere commented 5 hours ago

+1