mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
nested virtualization
This commit is contained in:
@@ -19,6 +19,7 @@ module VagrantPlugins
|
||||
# Gather some info about domain
|
||||
@name = env[:domain_name]
|
||||
@cpus = config.cpus
|
||||
@nested = config.nested
|
||||
@memory_size = config.memory*1024
|
||||
|
||||
# TODO get type from driver config option
|
||||
|
||||
@@ -25,6 +25,7 @@ module VagrantPlugins
|
||||
# Domain specific settings used while creating new domain.
|
||||
attr_accessor :memory
|
||||
attr_accessor :cpus
|
||||
attr_accessor :nested
|
||||
|
||||
def initialize
|
||||
@driver = UNSET_VALUE
|
||||
@@ -37,6 +38,7 @@ module VagrantPlugins
|
||||
# Domain specific settings.
|
||||
@memory = UNSET_VALUE
|
||||
@cpus = UNSET_VALUE
|
||||
@nested = UNSET_VALUE
|
||||
end
|
||||
|
||||
def finalize!
|
||||
@@ -50,6 +52,7 @@ module VagrantPlugins
|
||||
# Domain specific settings.
|
||||
@memory = 512 if @memory == UNSET_VALUE
|
||||
@cpus = 1 if @cpus == UNSET_VALUE
|
||||
@nested = false if @nested == UNSET_VALUE
|
||||
end
|
||||
|
||||
def validate(machine)
|
||||
|
||||
@@ -2,6 +2,14 @@
|
||||
<name><%= @name %></name>
|
||||
<memory><%= @memory_size %></memory>
|
||||
<vcpu><%= @cpus %></vcpu>
|
||||
|
||||
<% if @nested %>
|
||||
<cpu match='exact'>
|
||||
<model>core2duo</model>
|
||||
<feature policy='require' name='vmx'/>
|
||||
</cpu>
|
||||
<% end %>
|
||||
|
||||
<os>
|
||||
<type arch='x86_64'>hvm</type>
|
||||
<boot dev='hd'/>
|
||||
|
||||
Reference in New Issue
Block a user