dmacvicar / terraform-provider-libvirt

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

LVM storage pool implementation #814

Open dpap-qs opened 3 years ago

dpap-qs commented 3 years ago

Logical storage pool implementation.

Our team needed the lvm storage pool, so I implemented it. We tested, it seems fine. What do you think @dmacvicar ? If you say it's ok, then I write acceptance tests, and add the documentation.

If everything is fine, I think we should discuss about this: The volumes created in logical storage pool, don't preserve de volume format. See: pool and volume. It's a problem when you try to determine the disk driver based on volume format during the domain creation here:https://github.com/dmacvicar/terraform-provider-libvirt/blob/30595333cabd9d1651449c18acfaa2f99aaef928/libvirt/domain.go#L513 So right now we can only use the default disk driver, which is raw, so e.g. cqow2 cannot be used. I see two options:

  1. The more elegant: extend the disk resource with a driver attribute. If it's provided, we use it, otherwise we should use the current logic.
  2. Use the volume name to figure out the driver (as you do with files and url-s) e.g. if it ends with .raw or .qcow2, use them.
dmacvicar commented 3 years ago

Thanks for the PR. I need to dive a bit into the libvirt documentation to understand well how this is supposed to work.

x70b1 commented 3 years ago

Any progress?

@dpap-qs I have tested this. Its awesome! :sunglasses:

MalloZup commented 3 years ago

we will review this PR after the 13 release see #813 PR which . Stay tuned :)

x70b1 commented 3 years ago

@dpap-qs A suggestion: At the moment the name of the storage pool in libvirt is the name of the volume group. We could reuse the path setting to select a volume group (my-volumegroup) and create a volume pool (example-pool):

resource "libvirt_pool" "example" {
  name = "example-pool"
  type = "logical"
  path = "my-volumegroup"
}
atlasloewenherz commented 2 years ago

any update on this guys??

jimnydev commented 3 months ago

I'm interested in seeing this implemented. Are there any plans to continue with this? If not, perhaps I can try to do a new PR against current master instead?

Thanks!