Closed Prashanth684 closed 3 years ago
would be nice to expose this as a terraform variable..but there is already a firmware
variable which actually refers to the firmware file path for the loader. should that be changed to some other name ?
Thanks for the PR!
The issue you describe is common. We try to expose an attribute in HCL without exposing the whole XML sub-block. In this case https://github.com/dmacvicar/terraform-provider-libvirt/pull/50 choice of name firmware
was not good.
I am not convinced where to put this. Pehaps the default domain definition should handle this already? ie. set it to EFI for ARM when returning the initial empty definition?
Thanks for the PR!
The issue you describe is common. We try to expose an attribute in HCL without exposing the whole XML sub-block. In this case #50 choice of name
firmware
was not good.I am not convinced where to put this. Pehaps the default domain definition should handle this already? ie. set it to EFI for ARM when returning the initial empty definition?
Thanks for the feedback. That makes sense. I added it to the default definition but had to pass in arch as a parameter to set it for ARM. just used "x86_64" in places where it was just used for go tests.
Thanks for the PR! The issue you describe is common. We try to expose an attribute in HCL without exposing the whole XML sub-block. In this case #50 choice of name
firmware
was not good. I am not convinced where to put this. Pehaps the default domain definition should handle this already? ie. set it to EFI for ARM when returning the initial empty definition?Thanks for the feedback. That makes sense. I added it to the default definition but had to pass in arch as a parameter to set it for ARM. just used "x86_64" in places where it was just used for go tests.
@dmacvicar - does this change look ok ?
thx for PR ! I have added a comment for discussion.
updated PR per comments.
I really like where the code is right now, but as I mentioned
newDomainDefForConnection
is executed onRead
which happens on an explicitRead
or at the end ofCreate
, which means after the XML is injected into libvirt.Are you sure the code working and producing the desired effect?
newDomainDefForConnection
is called in at the beginning of create also: https://github.com/dmacvicar/terraform-provider-libvirt/blob/master/libvirt/resource_libvirt_domain.go#L443. Yes, i tested and it works
Thanks for the contribution @Prashanth684
Thanks for the contribution @Prashanth684
Thank you for helping to get this in!
This new firmare attribute was added to newer versions of libvirt-go-xml. This enables to specify the firmware as 'bios' or 'efi' and automatically fills in the loader and NVRAM elements without having to specify them manually. Refer to https://libvirt.org/formatdomain.html#bios-bootloader for this. As part of this change, libvirt-go and libvirt-go-xml needs to be updated. The old functionality of specifying the loader and NVRAM is also left as such so those can continue to be specified if we do not want automatic selection
Setting this automatically for aarch64 as it is a EFI architecture by default.
Please make sure you read the contributor documentation before opening a Pull Request.