Terraform is missing VM creation attributes CPU_MODEL = [ MODEL = "host-passthrough" ]

HI, I’m using terraform to provision opennebula resources via terraform opennebula provider v 1.1.1
https://registry.terraform.io/providers/OpenNebula/opennebula/latest/docs/resources/virtual_machine

I can add the host-passthrough cpu model manually by creating an opennebula template but there is no option to implement CPU_MODEL via terraform.

The reason for this is so I can create nested hypervisor VM’s basically to run rancher-desktop in a vm.
I’ve been able to get this working using a manually created Ubuntu 22.04 template, I had to install gnutls-bin and I’m getting errors but rancher-desktop is up and running.

These are my current errors

Install and configure rancher-desktop
/bin/sh: 1: p11tool: not found
libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
[19365:0311/214449.071882:ERROR:viz_main_impl.cc(188)] Exiting GPU process due to errors during initialization
creating dir /home/linux/.kube
creating file /home/linux/.kube/config
libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
[19391:0311/214449.115343:ERROR:viz_main_impl.cc(188)] Exiting GPU process due to errors during initialization
libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
[19411:0311/214449.304243:ERROR:viz_main_impl.cc(188)] Exiting GPU process due to errors during initialization
libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
[19444:0311/214449.386151:ERROR:sandbox_linux.cc(377)] InitializeSandbox() called with multiple threads in process gpu-process.
[19444:0311/214449.388532:ERROR:gpu_memory_buffer_support_x11.cc(44)] dri3 extension not supported.
/bin/sh: 1: p11tool: not found
(node:19331) [DEP0123] DeprecationWarning: Setting the TLS ServerName to an IP address is not permitted by RFC 6066. This will be ignored in a future version.
(Use `rancher-desktop --trace-deprecation ...` to show where the warning was created)

I would prefer the opennebula terraform-provider to be updated but that will probably take some time.

I’ve found the following link that explains how to add a cpu model via raw data, I probably need to add this to terraform but I’ve not figured this out yet.

Added the following to my terraform template

  raw {
    type = "kvm"
    data = "<cpu mode='host-passthrough'>"
  }

I don’t get an error when the data element is just “” but when I add the cpu model code I get the following error.

 opennebula_template.kubesphere[0]: Creating...
╷
│ Error: Failed to create the template
│ 
│   with opennebula_template.kubesphere[0],
│   on terraform.tf line 85, in resource "opennebula_template" "kubesphere":
│   85: resource "opennebula_template" "kubesphere" {
│ 
│ OpenNebula error [INTERNAL]: [one.template.allocate] Invalid RAW section: cannot validate DATA with domain.rng schema

Obviously the code in the data element is wrong,

Understanding and fixing the errors in my VM template would also be useful.
Can anyone help?

All good now, I figured out that if I add the following to the vm template it will implement passthru and allow the VM with KVM installed to run rancher-desktop virtualisation.

  raw {
    type = "kvm"
    data = "<cpu mode='host-passthrough'></cpu>"
  }
1 Like