Open MatiasLGonzalez opened 1 year ago
Hello, I've done this for my private purposes and it seems to work fine for q35 machine type.
However, I think it would be best to parametrize the cloudinit disk bus type. At first I wanted to make it somehow auto-detect the machine type, but I think that would be a little bit too risky.
Perhaps it's better to add a new field to the libvirt_domain
resource, called cloudinit_bus
. That would be the most backwards compatible change.
Alternatively, the cloudinit
parameter could be changed to an object:
cloudinit {
id: ...
bus: "sata|ide|whatever"
}
Generally, I think another parameter could be added to newDiskForCloudInit
. I know there are two references to that function and they'll have to get the new field from somewhere. I just tried to implement this and if I understood the code right, this should work (will check in a few moments).
EDIT: I had to "touch grass" for some time, but now I did manage to actually try it out - and it does seem to work. I haven't yet added any acceptance test as it's a broader topic I have to learn.
If anyone's interested, checkout my fork https://github.com/artur-borys/terraform-provider-libvirt/commit/78e99493c33bf25037e1e79b76b334bcdb566a6f - maybe someone can use it already
I hope I'll be able to write the acceptance test soon and create a PR
It could be a general idea to make the bus configurable for any disk that is added, as, for instance, creating a Windows VM from ISO without embedded virtio drivers will require a SATA main disk for the setup.
Is there a way to do this without compiling the plugin on my own? I'm trying to use this for aarch64 and am running into this issue.
Is there a way to do this without compiling the plugin on my own? I'm trying to use this for aarch64 and am running into this issue.
I don't think so, you'll have to compile it
Thanks, alrready compiled and now I just have to figure out how to set up the EFI/nvram stuff.
And thanks for having this... I would have never found this issue on my own, or it would have taken me a very long time. 8-)
Using the XSLT patch works well. Using a vfat
disk is also a working alternative: https://github.com/dmacvicar/terraform-provider-libvirt/pull/895#issuecomment-1911167872
Seems like #895 has stalled but it should be addressed somehow.
System Information
Linux distribution
Debian 11
Terraform version
Provider and libvirt versions
Checklist
[x] Is your issue/contribution related with enabling some setting/option exposed by libvirt that the plugin does not yet support, or requires changing/extending the provider terraform schema?
[ ] Is it a bug or something that does not work as expected? Please make sure you fill the version information below:
Description of Issue/Question
Setup
main.tf
Steps to Reproduce Issue
Error when running
terraform apply
Additional information:
Do you have SELinux or Apparmor/Firewall enabled? Some special configuration? Have you tried to reproduce the issue without them enabled?
Discussion
This isn't really a issue more of a discussion, I was wondering if there would be any issue if the provider created the cloudinit disk as a sata device by default, therefor allowing the use of both Q35 and i44fx easily, from what I can tell both support sata controllers so I don't think many things would break by this change.
From
libvirt/domain.go
So it would be like: