Support configurable hypervisor features

This commit is contained in:
Gerben Meijer 2017-03-23 14:57:28 +01:00
parent 43bd92670d
commit ea8e48bc5f
4 changed files with 37 additions and 3 deletions

View File

@ -914,6 +914,33 @@ Vagrant.configure("2") do |config|
end
end
```
## Features
Hypervisor features can be specified via `libvirt.features` as a list. The default
options that are enabled are `acpi`, `apic` and `pae`. If you define `libvirt.features`
you overwrite the defaults, so keep that in mind.
An example:
```ruby
Vagrant.configure("2") do |config|
config.vm.provider :libvirt do |libvirt|
# Specify the default hypervisor features
libvirt.features = ['acpi', 'apic', 'pae' ]
end
end
```
A different example for ARM boards:
```ruby
Vagrant.configure("2") do |config|
config.vm.provider :libvirt do |libvirt|
# Specify the default hypervisor features
libvirt.features = ["apic", "gic version='2'" ]
end
end
```
## CPU features

View File

@ -34,6 +34,7 @@ module VagrantPlugins
@uuid = config.uuid
@cpus = config.cpus.to_i
@cpu_features = config.cpu_features
@features = config.features
@cpu_mode = config.cpu_mode
@cpu_model = config.cpu_model
@cpu_fallback = config.cpu_fallback
@ -177,6 +178,9 @@ module VagrantPlugins
@cpu_features.each do |cpu_feature|
env[:ui].info(" -- CPU Feature: name=#{cpu_feature[:name]}, policy=#{cpu_feature[:policy]}")
end
@features.each do |feature|
env[:ui].info(" -- Feature: #{feature}")
end
env[:ui].info(" -- Memory: #{@memory_size / 1024}M")
env[:ui].info(" -- Management MAC: #{@management_network_mac}")
env[:ui].info(" -- Loader: #{@loader}")

View File

@ -64,6 +64,7 @@ module VagrantPlugins
attr_accessor :cpu_model
attr_accessor :cpu_fallback
attr_accessor :cpu_features
attr_accessor :features
attr_accessor :numa_nodes
attr_accessor :loader
attr_accessor :boot_order
@ -165,6 +166,7 @@ module VagrantPlugins
@cpu_model = UNSET_VALUE
@cpu_fallback = UNSET_VALUE
@cpu_features = UNSET_VALUE
@features = UNSET_VALUE
@numa_nodes = UNSET_VALUE
@loader = UNSET_VALUE
@machine_type = UNSET_VALUE
@ -566,6 +568,7 @@ module VagrantPlugins
end
@cpu_fallback = 'allow' if @cpu_fallback == UNSET_VALUE
@cpu_features = [] if @cpu_features == UNSET_VALUE
@features = ['acpi','apic','pae'] if @features == UNSET_VALUE
@numa_nodes = @numa_nodes == UNSET_VALUE ? nil : _generate_numa
@loader = nil if @loader == UNSET_VALUE
@machine_type = nil if @machine_type == UNSET_VALUE

View File

@ -55,9 +55,9 @@
<% end %>
</os>
<features>
<acpi/>
<apic/>
<pae/>
<% @features.each do |feature| %>
<<%= feature %>/>
<% end %>
<% if @kvm_hidden %>
<kvm>
<hidden state='on'/>