vagrant-kvm icon indicating copy to clipboard operation
vagrant-kvm copied to clipboard

Issue #270: Add control for cpu_model and cpu_feature.

Open tpodowd opened this issue 10 years ago • 3 comments

Add configuration parameters for cpu_model and cpu_feature which control the setting of the following xml block.

<cpu mode='custom' match='exact'>
    <model fallback='allow'>core2duo</model>
    <feature policy='require' name='vmx'/>
</cpu>

This allows a vagrant KVM guest to provide nested virtualization.

NOTE: The cpu_model parameter was previously was listed to define the cpu architecture but it actually was not doing anything. This parameter has been reused to reflect the preferred guest cpu model.

tpodowd avatar Nov 19 '14 08:11 tpodowd

Here's a snippet showing the feature is working against a vagrant guest.

$ sudo virsh dumpxml 34 | grep -A 4 '<cpu'
<cpu mode='custom' match='exact'>
     <model fallback='allow'>core2duo</model>
     <feature policy='require' name='vmx'/>
     <feature policy='require' name='ht'/>
</cpu>

Also if I log in to the box, I can see the following.

[vagrant@cloud1 ~]$ egrep '(vmx|svm)' --color=always /proc/cpuinfo
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx lm constant_tsc up arch_perfmon rep_good unfair_spinlock pni vmx ssse3 cx16 hypervisor lahf_lm vnmi ept

So, it seems to be working. I can also halt and destroy.

tpodowd avatar Nov 19 '14 08:11 tpodowd

I tested it on arch linux and it works well for me ;-) Thanks @tpodowd

celebdor avatar Dec 15 '14 09:12 celebdor

Awesome. Thanks @celebdor. Hopefully it will get merged soon. It seems to be working well for me also.

tpodowd avatar Dec 15 '14 23:12 tpodowd