Skip to content

Nested virtualization

Cedric Bosdonnat edited this page Feb 24, 2021 · 1 revision

Luring Uyuni to think a VM is a physical machine

Uyuni doesn't support nested virtualization, a system is either physical or virtual for it

In order to get a VM considered a physical machine by Uyuni you need to apply the following XSL to the VM definition:

https://github.com/uyuni-project/sumaform/blob/master/backend_modules/libvirt/host/sysinfos.xsl

That means the definition needs to have the following elements. This will force hiding QEMU from the dmidecode output in the guest.

<domain type='kvm' id='15' 
        xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <qemu:commandline>
    <qemu:arg value='-smbios'/>
    <qemu:arg value='type=17,manufacturer=SUSE'/>
    <qemu:arg value='-smbios'/>
    <qemu:arg value='type=4,manufacturer=SUSE'/>
    <qemu:arg value='-smbios'/>
    <qemu:arg value='type=3,manufacturer=SUSE'/>
  </qemu:commandline>
  <os>
    ...
    <smbios mode='sysinfo'/>
  </os>
  <sysinfo type='smbios'>
    <bios>
      <entry name='vendor'>SUSE</entry>
    </bios>
    <system>
      <entry name='manufacturer'>SUSE</entry>
    </system>
    <baseBoard>
      <entry name='manufacturer'>SUSE</entry>
    </baseBoard>
  </sysinfo>
  ...
</domain>

If you apply those changes after having started the VM, you will need to shut it down and start it again to activate them.

You also need to overwrite /usr/bin/systemd-detect-virt with the following file:

https://github.com/uyuni-project/sumaform/blob/master/salt/virthost/systemd-detect-virt

This one will force the output of systemd-detect-virt because there is no way to force the CPUID Virtualization value of the guest.

Once those changes are done you can register the machine to Uyuni: it should show up as a physical machine.

Enable nested virtualization

For the virtualization features to be fully working, don't forget to enable nested_kvm on the physical machine. This is documented in the openSUSE virtualization guide

Clone this wiki locally