nested virtualization

This commit is contained in:
dima 2013-05-06 19:47:53 +02:00
parent 2eb772b6ce
commit c1c360f2cb
4 changed files with 15 additions and 2 deletions

View File

@ -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.

View File

@ -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

View File

@ -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)

View File

@ -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'/>