mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
Allow specification of domain shares (#925)
Weighted priority of the domain relative to others on the host.
This commit is contained in:
@@ -295,6 +295,7 @@ end
|
||||
you create a domain value by default virtio KVM believe possible values, see
|
||||
the [documentation for
|
||||
Libvirt](https://libvirt.org/formatdomain.html#elementsNICSModel).
|
||||
* `shares` - Proportional weighted share for the domain relative to others. For more details see [documentation](https://libvirt.org/formatdomain.html#elementsCPUTuning).
|
||||
* `memory` - Amount of memory in MBytes. Defaults to 512 if not set.
|
||||
* `cpus` - Number of virtual cpus. Defaults to 1 if not set.
|
||||
* `cpuset` - Physical cpus to which the vcpus can be pinned. For more details see [documentation](https://libvirt.org/formatdomain.html#elementsCPUAllocation).
|
||||
|
||||
@@ -39,6 +39,7 @@ module VagrantPlugins
|
||||
@nodeset = config.nodeset
|
||||
@features = config.features
|
||||
@features_hyperv = config.features_hyperv
|
||||
@shares = config.shares
|
||||
@cpu_mode = config.cpu_mode
|
||||
@cpu_model = config.cpu_model
|
||||
@cpu_fallback = config.cpu_fallback
|
||||
@@ -213,6 +214,9 @@ module VagrantPlugins
|
||||
@memory_backing.each do |backing|
|
||||
env[:ui].info(" -- Memory Backing: #{backing[:name]}: #{backing[:config].map { |k,v| "#{k}='#{v}'"}.join(' ')}")
|
||||
end
|
||||
unless @shares.nil?
|
||||
env[:ui].info(" -- Shares: #{@shares}")
|
||||
end
|
||||
env[:ui].info(" -- Management MAC: #{@management_network_mac}")
|
||||
env[:ui].info(" -- Loader: #{@loader}")
|
||||
env[:ui].info(" -- Nvram: #{@nvram}")
|
||||
|
||||
@@ -79,6 +79,7 @@ module VagrantPlugins
|
||||
attr_accessor :cpu_fallback
|
||||
attr_accessor :cpu_features
|
||||
attr_accessor :cpu_topology
|
||||
attr_accessor :shares
|
||||
attr_accessor :features
|
||||
attr_accessor :features_hyperv
|
||||
attr_accessor :numa_nodes
|
||||
@@ -204,6 +205,7 @@ module VagrantPlugins
|
||||
@cpu_fallback = UNSET_VALUE
|
||||
@cpu_features = UNSET_VALUE
|
||||
@cpu_topology = UNSET_VALUE
|
||||
@shares = UNSET_VALUE
|
||||
@features = UNSET_VALUE
|
||||
@features_hyperv = UNSET_VALUE
|
||||
@numa_nodes = UNSET_VALUE
|
||||
@@ -689,6 +691,7 @@ module VagrantPlugins
|
||||
@cpu_topology = {} if @cpu_topology == UNSET_VALUE
|
||||
@cpu_fallback = 'allow' if @cpu_fallback == UNSET_VALUE
|
||||
@cpu_features = [] if @cpu_features == UNSET_VALUE
|
||||
@shares = nil if @shares == UNSET_VALUE
|
||||
@features = ['acpi','apic','pae'] if @features == UNSET_VALUE
|
||||
@features_hyperv = [] if @features_hyperv == UNSET_VALUE
|
||||
@numa_nodes = @numa_nodes == UNSET_VALUE ? nil : _generate_numa
|
||||
|
||||
@@ -45,6 +45,11 @@
|
||||
<% end %>
|
||||
</memoryBacking>
|
||||
<% end%>
|
||||
<% if @shares %>
|
||||
<cputune>
|
||||
<shares><%= @shares %></shares>
|
||||
</cputune>
|
||||
<% end %>
|
||||
|
||||
<os>
|
||||
<% if @machine_type %>
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
<numatune>
|
||||
<memory nodeset='1-4,^3,6'/>
|
||||
</numatune>
|
||||
<cputune>
|
||||
<shares>1024</shares>
|
||||
</cputune>
|
||||
|
||||
<os>
|
||||
<type arch='x86_64' machine='pc-compatible'>hvm</type>
|
||||
|
||||
@@ -76,6 +76,7 @@ describe 'templates/domain' do
|
||||
|
||||
domain.qemuargs(value: '-device')
|
||||
domain.qemuargs(value: 'dummy-device')
|
||||
domain.shares = '1024'
|
||||
domain.cpuset = '1-4,^3,6'
|
||||
domain.nodeset = '1-4,^3,6'
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user