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:
parent
2eb772b6ce
commit
c1c360f2cb
@ -72,11 +72,11 @@ Vagrant.configure("2") do |config|
|
||||
libvirt.connect_via_ssh = true
|
||||
libvirt.username = "root"
|
||||
libvirt.storage_pool_name = "default"
|
||||
libvirt.nested = true
|
||||
end
|
||||
end
|
||||
|
||||
```
|
||||
|
||||
### Libvirt Configuration Options
|
||||
|
||||
This provider exposes quite a few provider-specific configuration options:
|
||||
@ -93,6 +93,7 @@ This provider exposes quite a few provider-specific configuration options:
|
||||
|
||||
* `memory` - Amount of memory in MBytes. Defaults to 512 if not set.
|
||||
* `cpus` - Number of virtual cpus. Defaults to 1 if not set.
|
||||
* `nested` - [Enable nested virtualization.Default: false] (https://github.com/torvalds/linux/blob/master/Documentation/virtual/kvm/nested-vmx.txt)
|
||||
|
||||
Specific domain settings can be set for each domain separately in multi-VM
|
||||
environment. Example below shows a part of Vagrantfile, where specific options
|
||||
@ -130,7 +131,7 @@ Vagrant goes through steps below when creating new project:
|
||||
|
||||
1. Connect to Libvirt localy or remotely via SSH.
|
||||
2. Check if box image is available in Libvirt storage pool. If not, upload it to
|
||||
remote Libvirt storage pool as new volume.
|
||||
remote Libvirt storage pool as new volume.
|
||||
3. Create COW diff image of base box image for new Libvirt domain.
|
||||
4. Create and start new domain on Libvirt host.
|
||||
5. Check for DHCP lease from dnsmasq server.
|
||||
|
@ -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'/>
|
||||
|
Loading…
Reference in New Issue
Block a user