mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
Merge pull request #110 from jordant/master
Support for cpu_mode configuration while using the nested option.
This commit is contained in:
@@ -106,6 +106,7 @@ This provider exposes quite a few provider-specific configuration options:
|
|||||||
* `memory` - Amount of memory in MBytes. Defaults to 512 if not set.
|
* `memory` - Amount of memory in MBytes. Defaults to 512 if not set.
|
||||||
* `cpus` - Number of virtual cpus. Defaults to 1 if not set.
|
* `cpus` - Number of virtual cpus. Defaults to 1 if not set.
|
||||||
* `nested` - [Enable nested virtualization](https://github.com/torvalds/linux/blob/master/Documentation/virtual/kvm/nested-vmx.txt). Default is false.
|
* `nested` - [Enable nested virtualization](https://github.com/torvalds/linux/blob/master/Documentation/virtual/kvm/nested-vmx.txt). Default is false.
|
||||||
|
* `cpu_mode` - What cpu mode to use for nested virtualization. Defaults to 'host-model' if not set.
|
||||||
* `volume_cache` - Controls the cache mechanism. Possible values are "default", "none", "writethrough", "writeback", "directsync" and "unsafe". [See driver->cache in libvirt documentation](http://libvirt.org/formatdomain.html#elementsDisks).
|
* `volume_cache` - Controls the cache mechanism. Possible values are "default", "none", "writethrough", "writeback", "directsync" and "unsafe". [See driver->cache in libvirt documentation](http://libvirt.org/formatdomain.html#elementsDisks).
|
||||||
|
|
||||||
Specific domain settings can be set for each domain separately in multi-VM
|
Specific domain settings can be set for each domain separately in multi-VM
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ module VagrantPlugins
|
|||||||
# Gather some info about domain
|
# Gather some info about domain
|
||||||
@name = env[:domain_name]
|
@name = env[:domain_name]
|
||||||
@cpus = config.cpus
|
@cpus = config.cpus
|
||||||
|
@cpu_mode = config.cpu_mode
|
||||||
@nested = config.nested
|
@nested = config.nested
|
||||||
@memory_size = config.memory*1024
|
@memory_size = config.memory*1024
|
||||||
@domain_volume_cache = config.volume_cache
|
@domain_volume_cache = config.volume_cache
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ module VagrantPlugins
|
|||||||
# Domain specific settings used while creating new domain.
|
# Domain specific settings used while creating new domain.
|
||||||
attr_accessor :memory
|
attr_accessor :memory
|
||||||
attr_accessor :cpus
|
attr_accessor :cpus
|
||||||
|
attr_accessor :cpu_mode
|
||||||
attr_accessor :nested
|
attr_accessor :nested
|
||||||
attr_accessor :volume_cache
|
attr_accessor :volume_cache
|
||||||
|
|
||||||
@@ -47,6 +48,7 @@ module VagrantPlugins
|
|||||||
# Domain specific settings.
|
# Domain specific settings.
|
||||||
@memory = UNSET_VALUE
|
@memory = UNSET_VALUE
|
||||||
@cpus = UNSET_VALUE
|
@cpus = UNSET_VALUE
|
||||||
|
@cpu_mode = UNSET_VALUE
|
||||||
@nested = UNSET_VALUE
|
@nested = UNSET_VALUE
|
||||||
@volume_cache = UNSET_VALUE
|
@volume_cache = UNSET_VALUE
|
||||||
end
|
end
|
||||||
@@ -64,6 +66,7 @@ module VagrantPlugins
|
|||||||
# Domain specific settings.
|
# Domain specific settings.
|
||||||
@memory = 512 if @memory == UNSET_VALUE
|
@memory = 512 if @memory == UNSET_VALUE
|
||||||
@cpus = 1 if @cpus == UNSET_VALUE
|
@cpus = 1 if @cpus == UNSET_VALUE
|
||||||
|
@cpu_mode = 'host-model' if @cpu_mode == UNSET_VALUE
|
||||||
@nested = false if @nested == UNSET_VALUE
|
@nested = false if @nested == UNSET_VALUE
|
||||||
@volume_cache = 'default' if @volume_cache == UNSET_VALUE
|
@volume_cache = 'default' if @volume_cache == UNSET_VALUE
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<vcpu><%= @cpus %></vcpu>
|
<vcpu><%= @cpus %></vcpu>
|
||||||
|
|
||||||
<% if @nested %>
|
<% if @nested %>
|
||||||
<cpu mode='host-model'>
|
<cpu mode='<%= @cpu_mode %>'>
|
||||||
<model fallback='allow'>qemu64</model>
|
<model fallback='allow'>qemu64</model>
|
||||||
<feature policy='optional' name='vmx'/>
|
<feature policy='optional' name='vmx'/>
|
||||||
<feature policy='optional' name='svm'/>
|
<feature policy='optional' name='svm'/>
|
||||||
|
|||||||
Reference in New Issue
Block a user