Add support for configuring memballoon-related settings (#1083)

Allow configuration of various memballoon-related settings. It was 
discovered that it may be needed to be able to control the memballoon's 
PCI slot/bus location in order to prevent it from conflicting with 
other explicit PCI location assignments. For example when configuring 
the management network NIC to go to slot 0x05, libvirt would try to put 
the memballoon there as well and resulting in a fatal error.
This commit is contained in:
Edmund Rhudy
2020-12-15 12:40:05 -05:00
committed by GitHub
parent ac2c857599
commit a11750cc3b
4 changed files with 96 additions and 0 deletions

View File

@@ -119,6 +119,12 @@ module VagrantPlugins
attr_accessor :tpm_path
attr_accessor :tpm_version
# Configure the memballoon
attr_accessor :memballoon_enabled
attr_accessor :memballoon_model
attr_accessor :memballoon_pci_bus
attr_accessor :memballoon_pci_slot
# Sets the max number of NICs that can be created
# Default set to 8. Don't change the default unless you know
# what are doing
@@ -248,6 +254,11 @@ module VagrantPlugins
@tpm_path = UNSET_VALUE
@tpm_version = UNSET_VALUE
@memballoon_enabled = UNSET_VALUE
@memballoon_model = UNSET_VALUE
@memballoon_pci_bus = UNSET_VALUE
@memballoon_pci_slot = UNSET_VALUE
@nic_adapter_count = UNSET_VALUE
# Boot order
@@ -784,6 +795,10 @@ module VagrantPlugins
@tpm_type = 'passthrough' if @tpm_type == UNSET_VALUE
@tpm_path = nil if @tpm_path == UNSET_VALUE
@tpm_version = nil if @tpm_version == UNSET_VALUE
@memballoon_enabled = nil if @memballoon_enabled == UNSET_VALUE
@memballoon_model = 'virtio' if @memballoon_model == UNSET_VALUE
@memballoon_pci_bus = '0x00' if @memballoon_pci_bus == UNSET_VALUE
@memballoon_pci_slot = '0x0f' if @memballoon_pci_slot == UNSET_VALUE
@nic_adapter_count = 8 if @nic_adapter_count == UNSET_VALUE
@emulator_path = nil if @emulator_path == UNSET_VALUE

View File

@@ -271,6 +271,15 @@
<%# USB Controller -%>
<controller type='usb' model='<%= @usbctl_dev[:model] %>' <%= "ports=\"#{@usbctl_dev[:ports]}\" " if @usbctl_dev[:ports] %>/>
<% end %>
<% unless @memballoon_enabled.nil? %>
<% if @memballoon_enabled %>
<memballoon model='<%= @memballoon_model %>'>
<address type='pci' domain='0x0000' bus='<%= @memballoon_pci_bus %>' slot='<%= @memballoon_pci_slot %>' function='0x0'/>
</memballoon>
<% else %>
<memballoon model='none'/>
<% end %>
<% end %>
</devices>
<% if not @qemu_args.empty? or not @qemu_env.empty? %>