mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
Allow specification of numa nodeset (#924)
This specifies the physical numa nodes on which the virtual memory can be placed.
This commit is contained in:
@@ -299,6 +299,7 @@ end
|
||||
* `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).
|
||||
* `cputopology` - Number of CPU sockets, cores and threads running per core. All fields of `:sockets`, `:cores` and `:threads` are mandatory, `cpus` domain option must be present and must be equal to total count of **sockets * cores * threads**. For more details see [documentation](https://libvirt.org/formatdomain.html#elementsCPU).
|
||||
* `nodeset` - Physical NUMA nodes where virtual memory can be pinned. For more details see [documentation](https://libvirt.org/formatdomain.html#elementsNUMATuning).
|
||||
|
||||
```ruby
|
||||
Vagrant.configure("2") do |config|
|
||||
|
||||
@@ -36,6 +36,7 @@ module VagrantPlugins
|
||||
@cpuset = config.cpuset
|
||||
@cpu_features = config.cpu_features
|
||||
@cpu_topology = config.cpu_topology
|
||||
@nodeset = config.nodeset
|
||||
@features = config.features
|
||||
@features_hyperv = config.features_hyperv
|
||||
@cpu_mode = config.cpu_mode
|
||||
@@ -206,6 +207,9 @@ module VagrantPlugins
|
||||
env[:ui].info(" -- Feature (HyperV): name=#{feature[:name]}, state=#{feature[:state]}")
|
||||
end
|
||||
env[:ui].info(" -- Memory: #{@memory_size / 1024}M")
|
||||
unless @nodeset.nil?
|
||||
env[:ui].info(" -- Nodeset: #{@nodeset}")
|
||||
end
|
||||
@memory_backing.each do |backing|
|
||||
env[:ui].info(" -- Memory Backing: #{backing[:name]}: #{backing[:config].map { |k,v| "#{k}='#{v}'"}.join(' ')}")
|
||||
end
|
||||
|
||||
@@ -69,6 +69,7 @@ module VagrantPlugins
|
||||
# Domain specific settings used while creating new domain.
|
||||
attr_accessor :uuid
|
||||
attr_accessor :memory
|
||||
attr_accessor :nodeset
|
||||
attr_accessor :memory_backing
|
||||
attr_accessor :channel
|
||||
attr_accessor :cpus
|
||||
@@ -194,6 +195,7 @@ module VagrantPlugins
|
||||
# Domain specific settings.
|
||||
@uuid = UNSET_VALUE
|
||||
@memory = UNSET_VALUE
|
||||
@nodeset = UNSET_VALUE
|
||||
@memory_backing = UNSET_VALUE
|
||||
@cpus = UNSET_VALUE
|
||||
@cpuset = UNSET_VALUE
|
||||
@@ -672,6 +674,7 @@ module VagrantPlugins
|
||||
# Domain specific settings.
|
||||
@uuid = '' if @uuid == UNSET_VALUE
|
||||
@memory = 512 if @memory == UNSET_VALUE
|
||||
@nodeset = nil if @nodeset == UNSET_VALUE
|
||||
@memory_backing = [] if @memory_backing == UNSET_VALUE
|
||||
@cpus = 1 if @cpus == UNSET_VALUE
|
||||
@cpuset = nil if @cpuset == UNSET_VALUE
|
||||
|
||||
@@ -33,6 +33,11 @@
|
||||
<% end %>
|
||||
</cpu>
|
||||
|
||||
<%- if @nodeset -%>
|
||||
<numatune>
|
||||
<memory nodeset='<%= @nodeset %>'/>
|
||||
</numatune>
|
||||
<%- end -%>
|
||||
<% unless @memory_backing.empty? %>
|
||||
<memoryBacking>
|
||||
<% @memory_backing.each do |backing| %>
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
<topology sockets='1' cores='3' threads='2'/>
|
||||
</cpu>
|
||||
|
||||
<numatune>
|
||||
<memory nodeset='1-4,^3,6'/>
|
||||
</numatune>
|
||||
|
||||
<os>
|
||||
<type arch='x86_64' machine='pc-compatible'>hvm</type>
|
||||
|
||||
@@ -77,6 +77,7 @@ describe 'templates/domain' do
|
||||
domain.qemuargs(value: '-device')
|
||||
domain.qemuargs(value: 'dummy-device')
|
||||
domain.cpuset = '1-4,^3,6'
|
||||
domain.nodeset = '1-4,^3,6'
|
||||
end
|
||||
let(:test_file) { 'domain_all_settings.xml' }
|
||||
it 'renders template' do
|
||||
|
||||
Reference in New Issue
Block a user