mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
Merge pull request #741 from azat-archive/qemu-commandline
Introduce qemu:commandline (for osx quirks)
This commit is contained in:
commit
ba9d228b9d
14
README.md
14
README.md
@ -1220,6 +1220,20 @@ Vagrant.configure(2) do |config|
|
||||
end
|
||||
```
|
||||
|
||||
## Custom command line arguments
|
||||
You can also specify multiple qemuargs arguments for qemu-system
|
||||
|
||||
* `value` - Value
|
||||
|
||||
```ruby
|
||||
Vagrant.configure("2") do |config|
|
||||
config.vm.provider :libvirt do |libvirt|
|
||||
libvirt.qemuargs :value => "-device"
|
||||
libvirt.qemuargs :value => "intel-iommu"
|
||||
end
|
||||
end
|
||||
```
|
||||
|
||||
## Box Format
|
||||
|
||||
You can view an example box in the
|
||||
|
@ -88,9 +88,9 @@ module VagrantPlugins
|
||||
|
||||
# PCI device passthrough
|
||||
@pcis = config.pcis
|
||||
|
||||
|
||||
# Watchdog device
|
||||
@watchdog_dev = config.watchdog_dev
|
||||
@watchdog_dev = config.watchdog_dev
|
||||
|
||||
# USB device passthrough
|
||||
@usbs = config.usbs
|
||||
@ -102,6 +102,9 @@ module VagrantPlugins
|
||||
# smartcard device
|
||||
@smartcard_dev = config.smartcard_dev
|
||||
|
||||
# qemuargs
|
||||
@qemuargs = config.qemuargs
|
||||
|
||||
# RNG device passthrough
|
||||
@rng = config.rng
|
||||
|
||||
@ -280,6 +283,14 @@ module VagrantPlugins
|
||||
env[:ui].info(" -- smartcard device: mode=#{@smartcard_dev[:mode]}, type=#{@smartcard_dev[:type]}")
|
||||
end
|
||||
|
||||
unless @qemuargs.empty?
|
||||
env[:ui].info(' -- Command line args: ')
|
||||
@qemuargs.each do |arg|
|
||||
msg = " -> value=#{arg[:value]}, "
|
||||
env[:ui].info(msg)
|
||||
end
|
||||
end
|
||||
|
||||
env[:ui].info(" -- Command line : #{@cmd_line}")
|
||||
|
||||
# Create libvirt domain.
|
||||
|
@ -141,6 +141,9 @@ module VagrantPlugins
|
||||
# Attach mgmt network
|
||||
attr_accessor :mgmt_attach
|
||||
|
||||
# Additional qemuargs arguments
|
||||
attr_accessor :qemuargs
|
||||
|
||||
def initialize
|
||||
@uri = UNSET_VALUE
|
||||
@driver = UNSET_VALUE
|
||||
@ -238,6 +241,8 @@ module VagrantPlugins
|
||||
|
||||
# Attach mgmt network
|
||||
@mgmt_attach = UNSET_VALUE
|
||||
|
||||
@qemuargs = UNSET_VALUE
|
||||
end
|
||||
|
||||
def boot(device)
|
||||
@ -489,6 +494,11 @@ module VagrantPlugins
|
||||
@disks << disk # append
|
||||
end
|
||||
|
||||
def qemuargs(options = {})
|
||||
@qemuargs = [] if @qemuargs == UNSET_VALUE
|
||||
@qemuargs.push(value: options[:value])
|
||||
end
|
||||
|
||||
# code to generate URI from a config moved out of the connect action
|
||||
def _generate_uri
|
||||
# builds the libvirt connection URI from the given driver config
|
||||
@ -651,6 +661,8 @@ module VagrantPlugins
|
||||
|
||||
# Attach mgmt network
|
||||
@mgmt_attach = true if @mgmt_attach == UNSET_VALUE
|
||||
|
||||
@qemuargs = [] if @qemuargs == UNSET_VALUE
|
||||
end
|
||||
|
||||
def validate(machine)
|
||||
@ -676,9 +688,14 @@ module VagrantPlugins
|
||||
c = disks.dup
|
||||
c += other.disks
|
||||
result.disks = c
|
||||
|
||||
c = cdroms.dup
|
||||
c += other.cdroms
|
||||
result.cdroms = c
|
||||
|
||||
c = qemuargs.dup
|
||||
c += other.qemuargs
|
||||
result.qemuargs = c
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,4 +1,4 @@
|
||||
<domain type='<%= @domain_type %>'>
|
||||
<domain type='<%= @domain_type %>' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
|
||||
<name><%= @name %></name>
|
||||
<uuid><%= @uuid %></uuid>
|
||||
<memory><%= @memory_size %></memory>
|
||||
@ -218,4 +218,12 @@
|
||||
</tpm>
|
||||
<% end -%>
|
||||
</devices>
|
||||
|
||||
<% unless @qemuargs.empty? %>
|
||||
<qemu:commandline>
|
||||
<% @qemuargs.each do |arg| %>
|
||||
<qemu:arg value='<%= arg[:value] %>'/>
|
||||
<% end %>
|
||||
</qemu:commandline>
|
||||
<% end %>
|
||||
</domain>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<domain type='kvm'>
|
||||
<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
|
||||
<name></name>
|
||||
<uuid></uuid>
|
||||
<memory></memory>
|
||||
@ -125,4 +125,9 @@
|
||||
</backend>
|
||||
</tpm>
|
||||
</devices>
|
||||
|
||||
<qemu:commandline>
|
||||
<qemu:arg value='-device'/>
|
||||
<qemu:arg value='dummy-device'/>
|
||||
</qemu:commandline>
|
||||
</domain>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<domain type=''>
|
||||
<domain type='' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
|
||||
<name></name>
|
||||
<uuid></uuid>
|
||||
<memory></memory>
|
||||
@ -42,4 +42,5 @@
|
||||
|
||||
|
||||
</devices>
|
||||
|
||||
</domain>
|
||||
|
@ -62,6 +62,9 @@ describe 'templates/domain' do
|
||||
domain.watchdog(model: 'i6300esb', action: 'reset')
|
||||
domain.smartcard(mode: 'passthrough')
|
||||
domain.tpm_path = '/dev/tpm0'
|
||||
|
||||
domain.qemuargs(value: '-device')
|
||||
domain.qemuargs(value: 'dummy-device')
|
||||
end
|
||||
let(:test_file) { 'domain_all_settings.xml' }
|
||||
it 'renders template' do
|
||||
|
Loading…
Reference in New Issue
Block a user