Repository navigation
Inner Workings
Important
This page was written for version 0.0.13
The tofu module uses a base template ( UserDefault or UserL40 for GPUs) that contains some restricted attributes that are effectively mandatory for users to use.
Then, tofu adds its own configuration (cpu, memory, disks, …) on top of that to create the VM.
Warning
At the time of writing, there are quite a few issues with disks, so there are a lot of workarounds in the code
This module clones the given image into a new, persistent image that will be the root disk for the VM. For convenience, disk creation of any kind is handled by the disk submodule.
Windows only supports 1 or 2 CPU sockets (depending on the edition), and the hypervisor exposes vCPUs as sockets. To get around this, the tofu module defines a different topology:
content {
name = "TOPOLOGY"
elements = {
"CORES" = max(coalesce(var.cpu / 2, data.opennebula_template.template.cpu / 2), 1),
"SOCKETS" = 1,
"THREADS" = 2,
"HUGEPAGE_SIZE" = 1024, # Since this is in the base template, removing it is not allowed.
}
}
Just like the VMs, routers have a base template (vr and vr_vsc). vr_vsc contains a startup script that creates all the routes for the VSC network. This way we can update the routes without updating the tofu templates.
The routes will not be updated on existing VMs, however.
The router submodule supports port forwarding. The OpenNebula Virtual Router appliance takes these rules as entries in the CONTEXT in the following format:
ONEAPP_VNF_NAT4_PORT_FWDX = "publicip:port:privateip:port"
portforwarding.tf processes both the access_vm port forwarding rules, as well as any custom port forwarding rules in order to append them to the virtual router.