terraform-provider-libvirt -version
.terraform/plugins/linux_amd64/terraform-provider-libvirt was not built correctly
Compiled against library: libvirt 1.3.1
Using library: libvirt 1.3.1
Running hypervisor: QEMU 2.5.0
Running against daemon: 1.3.1
If that gives you "was not built correctly", get the Git commit hash from your local provider repository:
thanks @dmacvicar. It is nice feature. But looks too advanced for me and for this task. I am not familiar with with xslt.
HCL(.tf file) is a kind of configuration language, and here introduce another one(xslt). I am not sure if this is a good idea.
Ok, ignore everything I said.
I just realized we already support the _passthrough_ element, and this is about it not working. Then it is (probably, as we may not support all variations with a single attribute) a valid bug and we should read https://libvirt.org/formatdomain.html#elementsNICSHostdev and understand how it should work.
} else if devI, ok := d.GetOk(prefix + ".passthrough"); ok {
netIface.Source = &libvirtxml.DomainInterfaceSource{
Direct: &libvirtxml.DomainInterfaceSourceDirect{
Dev: devI.(string),
Mode: "passthrough",
},
}
We are setting the value you pass to the attribute as the device. We generate a _"direct"_ source, which from the documentation:
PCI Passthrough
A PCI network device (specified by the element) is directly assigned to the guest using generic device passthrough, after first optionally setting the device's MAC address to the configured value, and associating the device with an 802.1Qbh capable switch using an optionally specified element (see the examples of virtualport given above for type='direct' network devices). >Note that - due to limitations in standard single-port PCI ethernet card driver design - only SR-IOV (Single Root I/O Virtualization) virtual function (VF) devices can be assigned in this manner; to assign a standard single-port PCI or PCIe ethernet card to a guest, use the traditional device definition and Since 0.9.11
I would need to understand why we used direct (git history), and in case of switching to the _hostdev_ variant, how to not break SR-IOV capable devices, or how to use _VFIO device assignment_ in a way that works with both.
Hello Duncan Mac-Vicar P.,
Is there any plan to address this ? Otherwise I have working patch which supports PCI Passthrough using (using 'hostdev'. element) would like to integrate it.
Thanks,
hi @amitinfo2k thank you for interest!
We don't have any time in short-term to fix so a contribution from your part would be awesome.
just submit a PR to address this issue #552. Looks I can't reuse existing network_interface element and have to create new type in schema.
My test tf script is:
variable "hostdev_list" {
default = [
[{
domain = 0
bus = 1
solt = 16
function = 0
}],
[{
domain = 0
bus = 1
solt = 16
function = 2
}],
[{
domain = 0
bus = 1
solt = 16
function = 4
}],
]
}
....
hostdev = "${var.hostdev_list[count.index]}"
@fkpwolf The PR #552 was closed. I understood that you agreed that you can achieve the results you need with XSLT. So I'd suggest to @MalloZup to close this one but please feel free to reopen if that's not the case.
Most helpful comment
Can you try with https://github.com/dmacvicar/terraform-provider-libvirt/pull/431 using a xslt transform?