Mind Passthrough

Nicolas Ochem's mumblings on virtualization and network policy

Nested Virtualization : A Generic CPU Config for Intel and AMD

Nested virtualization with Libvirt is not straightforward. Your mileage may vary depending on your CPU and operating system.

Often, you need to pass the virtualization feature to the guest so that it behaves like a virtualization host. But on Intel, this feature is named “vmx” and on AMD, it is named “svm”.

If like me you have a heterogeneous pool of hypervisors, some Intel and some AMD, and you do not wish to write a different VM definition, here is the CPU node XML I am using to ensure the virtualization extensions will be available in my VM, no matter if running on Intel or AMD :

1
2
3
4
5
6
7
8
<cpu mode='custom' match='exact'>
  <model fallback='allow'>cpu64-rhel5</model>
  <feature policy='optional' name='vmx'/>
  <feature policy='optional' name='svm'/>
  <feature policy='optional' name='fxsr_opt'/>
  <feature policy='optional' name='monitor'/>
  <feature policy='optional' name='mmxext'/>
</cpu>