[DRE-commits] [vagrant-libvirt] 35/67: Support for cpu_mode configuration while using the nested option.

Antonio Terceiro terceiro at moszumanska.debian.org
Sun Apr 24 13:56:03 UTC 2016


This is an automated email from the git hooks/post-receive script.

terceiro pushed a commit to annotated tag 0.0.14
in repository vagrant-libvirt.

commit cffb351d44b38c17162d6909fa81f906897c6c76
Author: Jordan Tardif <jordan at dreamhost.com>
Date:   Wed Dec 18 04:12:38 2013 -0500

    Support for cpu_mode configuration while using the nested option.
---
 README.md                                    | 1 +
 lib/vagrant-libvirt/action/create_domain.rb  | 1 +
 lib/vagrant-libvirt/config.rb                | 3 +++
 lib/vagrant-libvirt/templates/domain.xml.erb | 2 +-
 4 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 08df1bb..f02f8a7 100644
--- a/README.md
+++ b/README.md
@@ -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.
 * `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.
+* `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).
 
 Specific domain settings can be set for each domain separately in multi-VM
diff --git a/lib/vagrant-libvirt/action/create_domain.rb b/lib/vagrant-libvirt/action/create_domain.rb
index fcee258..f714039 100644
--- a/lib/vagrant-libvirt/action/create_domain.rb
+++ b/lib/vagrant-libvirt/action/create_domain.rb
@@ -19,6 +19,7 @@ module VagrantPlugins
           # Gather some info about domain
           @name = env[:domain_name]
           @cpus = config.cpus
+          @cpu_mode = config.cpu_mode
           @nested = config.nested
           @memory_size = config.memory*1024
           @domain_volume_cache = config.volume_cache
diff --git a/lib/vagrant-libvirt/config.rb b/lib/vagrant-libvirt/config.rb
index 4f91aa5..4930cbc 100644
--- a/lib/vagrant-libvirt/config.rb
+++ b/lib/vagrant-libvirt/config.rb
@@ -31,6 +31,7 @@ module VagrantPlugins
       # Domain specific settings used while creating new domain.
       attr_accessor :memory
       attr_accessor :cpus
+      attr_accessor :cpu_mode
       attr_accessor :nested
       attr_accessor :volume_cache
 
@@ -47,6 +48,7 @@ module VagrantPlugins
         # Domain specific settings.
         @memory            = UNSET_VALUE
         @cpus              = UNSET_VALUE
+        @cpu_mode          = UNSET_VALUE
         @nested            = UNSET_VALUE
         @volume_cache      = UNSET_VALUE
       end
@@ -64,6 +66,7 @@ module VagrantPlugins
         # Domain specific settings.
         @memory = 512 if @memory == UNSET_VALUE
         @cpus = 1 if @cpus == UNSET_VALUE
+        @cpu_mode = host-model if @cpu_mode == UNSET_VALUE
         @nested = false if @nested == UNSET_VALUE
         @volume_cache = 'default' if @volume_cache == UNSET_VALUE
       end
diff --git a/lib/vagrant-libvirt/templates/domain.xml.erb b/lib/vagrant-libvirt/templates/domain.xml.erb
index 8497a11..3ad8f4c 100644
--- a/lib/vagrant-libvirt/templates/domain.xml.erb
+++ b/lib/vagrant-libvirt/templates/domain.xml.erb
@@ -4,7 +4,7 @@
   <vcpu><%= @cpus %></vcpu>
 
   <% if @nested %>
-    <cpu mode='host-model'>
+    <cpu mode='<%= @cpu_mode %>'>
       <model fallback='allow'>qemu64</model>
       <feature policy='optional' name='vmx'/>
       <feature policy='optional' name='svm'/>

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/vagrant-libvirt.git



More information about the Pkg-ruby-extras-commits mailing list