Tidy up XML generated (#1407)

To make it easier to see when the XML generated has deviated from
expected, tidy up the emitted XML to use a more consistent formatting
that would be inline with what would be expected to be output by virsh
directly.
This commit is contained in:
Darragh Bailey
2021-11-22 17:29:11 +00:00
committed by GitHub
parent d752138d10
commit f221daaaaf
15 changed files with 345 additions and 525 deletions

View File

@@ -75,11 +75,7 @@ module VagrantPlugins
@graphics_autoport = config.graphics_autoport @graphics_autoport = config.graphics_autoport
@graphics_port = config.graphics_port @graphics_port = config.graphics_port
@graphics_ip = config.graphics_ip @graphics_ip = config.graphics_ip
@graphics_passwd = if config.graphics_passwd.to_s.empty? @graphics_passwd = config.graphics_passwd
''
else
"passwd='#{config.graphics_passwd}'"
end
@graphics_gl = config.graphics_gl @graphics_gl = config.graphics_gl
@video_type = config.video_type @video_type = config.video_type
@sound_type = config.sound_type @sound_type = config.sound_type
@@ -312,7 +308,7 @@ module VagrantPlugins
env[:ui].info(" -- Graphics Type: #{@graphics_type}") env[:ui].info(" -- Graphics Type: #{@graphics_type}")
env[:ui].info(" -- Graphics Port: #{@graphics_port}") env[:ui].info(" -- Graphics Port: #{@graphics_port}")
env[:ui].info(" -- Graphics IP: #{@graphics_ip}") env[:ui].info(" -- Graphics IP: #{@graphics_ip}")
env[:ui].info(" -- Graphics Password: #{@graphics_passwd.empty? ? 'Not defined' : 'Defined'}") env[:ui].info(" -- Graphics Password: #{@graphics_passwd.nil? ? 'Not defined' : 'Defined'}")
env[:ui].info(" -- Video Type: #{@video_type}") env[:ui].info(" -- Video Type: #{@video_type}")
env[:ui].info(" -- Video VRAM: #{@video_vram}") env[:ui].info(" -- Video VRAM: #{@video_vram}")
env[:ui].info(" -- Video 3D accel: #{@video_accel3d}") env[:ui].info(" -- Video 3D accel: #{@video_accel3d}")

View File

@@ -5,115 +5,111 @@
<uuid><%= @uuid %></uuid> <uuid><%= @uuid %></uuid>
<memory><%= @memory_size %></memory> <memory><%= @memory_size %></memory>
<vcpu<% if @cpuset %> cpuset='<%= @cpuset %>'<% end %>><%= @cpus %></vcpu> <vcpu<% if @cpuset %> cpuset='<%= @cpuset %>'<% end %>><%= @cpus %></vcpu>
<cpu mode='<%= @cpu_mode %>'> <cpu mode='<%= @cpu_mode %>'>
<% if @cpu_mode != 'host-passthrough' %> <%- if @cpu_mode != 'host-passthrough' -%>
<model fallback='<%= @cpu_fallback %>'><% if @cpu_mode == 'custom' %><%= @cpu_model %><% end %></model> <model fallback='<%= @cpu_fallback %>'><% if @cpu_mode == 'custom' %><%= @cpu_model %><% end %></model>
<% if @nested %> <%- if @nested -%>
<% if @cpu_features.select{|x| x[:name] == 'vmx'}.empty? %> <%- if @cpu_features.select{|x| x[:name] == 'vmx'}.empty? -%>
<feature policy='optional' name='vmx'/> <feature policy='optional' name='vmx'/>
<% end %> <%- end -%>
<% if @cpu_features.select{|x| x[:name] == 'svm'}.empty? %> <%- if @cpu_features.select{|x| x[:name] == 'svm'}.empty? -%>
<feature policy='optional' name='svm'/> <feature policy='optional' name='svm'/>
<% end %> <%- end -%>
<% end %> <%- end -%>
<% @cpu_features.each do |cpu_feature| %> <%- @cpu_features.each do |cpu_feature| -%>
<feature name='<%= cpu_feature[:name] %>' policy='<%= cpu_feature[:policy] %>'/> <feature name='<%= cpu_feature[:name] %>' policy='<%= cpu_feature[:policy] %>'/>
<% end %> <%- end -%>
<% unless @cpu_topology.empty? %> <%- unless @cpu_topology.empty? -%>
<%# CPU topology -%> <%# CPU topology -%>
<topology sockets='<%= @cpu_topology[:sockets] %>' cores='<%= @cpu_topology[:cores] %>' threads='<%= @cpu_topology[:threads] %>'/> <topology sockets='<%= @cpu_topology[:sockets] %>' cores='<%= @cpu_topology[:cores] %>' threads='<%= @cpu_topology[:threads] %>'/>
<% end %> <%- end -%>
<% end %> <%- end -%>
<% if @numa_nodes %> <%- if @numa_nodes -%>
<numa> <numa>
<% @numa_nodes.each_with_index do |node, index| %> <%- @numa_nodes.each_with_index do |node, index| -%>
<cell id='<%= index %>' cpus='<%= node[:cpus] %>' memory='<%= node[:memory] %>'/> <cell id='<%= index %>' cpus='<%= node[:cpus] %>' memory='<%= node[:memory] %>'/>
<% end %> <%- end -%>
</numa> </numa>
<% end %> <%- end -%>
</cpu> </cpu>
<%- if @nodeset -%> <%- if @nodeset -%>
<numatune> <numatune>
<memory nodeset='<%= @nodeset %>'/> <memory nodeset='<%= @nodeset %>'/>
</numatune> </numatune>
<%- end -%> <%- end -%>
<% unless @memory_backing.empty? %> <%- unless @memory_backing.empty? -%>
<memoryBacking> <memoryBacking>
<% @memory_backing.each do |backing| %> <%- @memory_backing.each do |backing| -%>
<<%= backing[:name] %> <%= backing[:config].map { |k,v| "#{k}='#{v}'"}.join(' ') %>/> <<%= backing[:name] %> <%= backing[:config].map { |k,v| "#{k}='#{v}'"}.join(' ') %>/>
<% end %> <%- end -%>
</memoryBacking> </memoryBacking>
<% end%> <%- end%>
<% if @shares %> <%- if @shares -%>
<cputune> <cputune>
<shares><%= @shares %></shares> <shares><%= @shares %></shares>
</cputune> </cputune>
<% end %> <%- end -%>
<os> <os>
<% if @machine_type %> <%- if @machine_type -%>
<% if @machine_arch %> <%- if @machine_arch -%>
<type arch='<%= @machine_arch %>' machine='<%= @machine_type %>'>hvm</type> <type arch='<%= @machine_arch %>' machine='<%= @machine_type %>'>hvm</type>
<% else %> <%- else -%>
<type machine='<%= @machine_type %>'>hvm</type> <type machine='<%= @machine_type %>'>hvm</type>
<% end %> <%- end -%>
<% else %> <%- else -%>
<% if @machine_arch %> <%- if @machine_arch -%>
<type arch='<%= @machine_arch %>'>hvm</type> <type arch='<%= @machine_arch %>'>hvm</type>
<% else %> <%- else -%>
<type>hvm</type> <type>hvm</type>
<% end %> <%- end -%>
<% end %> <%- end -%>
<% if @loader %> <%- if @loader -%>
<% if @nvram %> <%- if @nvram -%>
<loader readonly='yes' type='pflash'><%= @loader %></loader> <loader readonly='yes' type='pflash'><%= @loader %></loader>
<% else %> <%- else -%>
<loader readonly='yes' type='rom'><%= @loader %></loader> <loader readonly='yes' type='rom'><%= @loader %></loader>
<% end %> <%- end -%>
<% end %> <%- end -%>
<% if @nvram %> <%- if @nvram -%>
<nvram><%= @nvram %></nvram> <nvram><%= @nvram %></nvram>
<% end %> <%- end -%>
<% if @boot_order.count >= 1 %> <%- if @boot_order.count >= 1 -%>
<bootmenu enable='yes'/> <bootmenu enable='yes'/>
<% end %> <%- end -%>
<kernel><%= @kernel %></kernel> <kernel><%= @kernel %></kernel>
<initrd><%= @initrd %></initrd> <initrd><%= @initrd %></initrd>
<cmdline><%= @cmd_line %></cmdline> <cmdline><%= @cmd_line %></cmdline>
<% if @dtb %> <%- if @dtb -%>
<dtb><%= @dtb %></dtb> <dtb><%= @dtb %></dtb>
<% end %> <% end -%>
</os> </os>
<features> <features>
<% @features.each do |feature| %> <%- @features.each do |feature| -%>
<<%= feature %>/> <<%= feature %>/>
<% end %> <%- end -%>
<% if @kvm_hidden %> <%- if @kvm_hidden -%>
<kvm> <kvm>
<hidden state='on'/> <hidden state='on'/>
</kvm> </kvm>
<% end %> <%- end -%>
<% if !@features_hyperv.empty? %> <%- if !@features_hyperv.empty? -%>
<hyperv> <hyperv>
<% @features_hyperv.each do |feature| %> <%- @features_hyperv.each do |feature| -%>
<<%= feature[:name] %> state='<%= feature[:state] %>'<% if feature[:name] == 'spinlocks' %> retries='<%= feature[:retries] %>'<% end %> /> <<%= feature[:name] %> state='<%= feature[:state] %>'<% if feature[:name] == 'spinlocks' %> retries='<%= feature[:retries] %>'<% end %> />
<% end %> <%- end -%>
</hyperv> </hyperv>
<% end %> <%- end -%>
</features> </features>
<clock offset='<%= @clock_offset %>'> <clock offset='<%= @clock_offset %>'>
<% @clock_timers.each do |clock_timer| %> <%- @clock_timers.each do |clock_timer| -%>
<timer<% clock_timer.each do |attr, value| %> <%= attr %>='<%= value %>'<% end %>/> <timer<% clock_timer.each do |attr, value| %> <%= attr %>='<%= value %>'<% end %>/>
<% end %> <%- end -%>
</clock> </clock>
<devices> <devices>
<% if @emulator_path %> <%- if @emulator_path -%>
<emulator><%= @emulator_path %></emulator> <emulator><%= @emulator_path %></emulator>
<% end %> <%- end -%>
<% @domain_volumes.each_with_index do |volume, index| -%> <%- @domain_volumes.each_with_index do |volume, index| -%>
<disk type='file' device='disk'> <disk type='file' device='disk'>
<alias name='ua-box-volume-<%= index -%>'/> <alias name='ua-box-volume-<%= index -%>'/>
<driver name='qemu' type='qcow2' <%= <driver name='qemu' type='qcow2' <%=
@@ -125,9 +121,9 @@
<%# we need to ensure a unique target dev -%> <%# we need to ensure a unique target dev -%>
<target dev='<%= volume[:dev] %>' bus='<%= volume[:bus] %>'/> <target dev='<%= volume[:dev] %>' bus='<%= volume[:bus] %>'/>
</disk> </disk>
<% end -%> <%- end -%>
<%# additional disks -%> <%# additional disks -%>
<% @disks.each_with_index do |d, index| -%> <%- @disks.each_with_index do |d, index| -%>
<disk type='file' device='disk'> <disk type='file' device='disk'>
<alias name='ua-disk-volume-<%= index -%>'/> <alias name='ua-disk-volume-<%= index -%>'/>
<driver name='qemu' type='<%= d[:type] %>' <%= <driver name='qemu' type='<%= d[:type] %>' <%=
@@ -138,187 +134,186 @@
-%>/> -%>/>
<source file='<%= d[:absolute_path] %>'/> <source file='<%= d[:absolute_path] %>'/>
<target dev='<%= d[:device] %>' bus='<%= d[:bus] %>'/> <target dev='<%= d[:device] %>' bus='<%= d[:bus] %>'/>
<% if d[:shareable] %> <%- if d[:shareable] -%>
<shareable/> <shareable/>
<% end %> <%- end -%>
<% if d[:serial] %> <%- if d[:serial] -%>
<serial><%= d[:serial] %></serial> <serial><%= d[:serial] %></serial>
<% end %> <%- end -%>
<% if d[:wwn] %> <%- if d[:wwn] -%>
<wwn><%= d[:wwn] %></wwn> <wwn><%= d[:wwn] %></wwn>
<% end %> <%- end -%>
<%# this will get auto generated by Libvirt <%# this will get auto generated by Libvirt
<address type='pci' domain='0x0000' bus='0x00' slot='???' function='0x0'/> <address type='pci' domain='0x0000' bus='0x00' slot='???' function='0x0'/>
-%> -%>
</disk> </disk>
<% end -%> <% end -%>
<%- @cdroms.each do |c| -%>
<% @cdroms.each do |c| %>
<disk type='file' device='cdrom'> <disk type='file' device='cdrom'>
<driver name='qemu' type='<%= c[:type] %>' /> <driver name='qemu' type='<%= c[:type] %>' />
<source file='<%= c[:path] %>'/> <source file='<%= c[:path] %>'/>
<target dev='<%= c[:dev] %>' bus='<%= c[:bus] %>'/> <target dev='<%= c[:dev] %>' bus='<%= c[:bus] %>'/>
<readonly/> <readonly/>
</disk> </disk>
<% end %> <%- end -%>
<%- @serials.each_with_index do |serial, port| -%>
<% @serials.each_with_index do |serial, port| %>
<serial type='<%= serial[:type] %>'> <serial type='<%= serial[:type] %>'>
<% unless serial[:source].nil? %> <%- unless serial[:source].nil? -%>
<source path='<%= serial[:source][:path] %>'/> <source path='<%= serial[:source][:path] %>'/>
<% end %> <%- end -%>
<target port='<%= port %>'/> <target port='<%= port %>'/>
</serial> </serial>
<% end %> <%- end -%>
<% console_log = @serials.first %> <%- console_log = @serials.first -%>
<console type='<%= console_log[:type] %>'> <console type='<%= console_log[:type] %>'>
<% unless console_log[:source].nil? %> <%- unless console_log[:source].nil? -%>
<source path='<%= console_log[:source][:path] %>'/> <source path='<%= console_log[:source][:path] %>'/>
<% end %> <%- end -%>
<target port='0'/> <target port='0'/>
</console> </console>
<%- @channels.each do |channel| -%>
<% @channels.each do |channel| %> <channel type='<%= channel[:type] %>' >
<channel type='<%= channel[:type] %>' > <%-if channel[:source_mode] or channel[:source_path] -%>
<%if channel[:source_mode] or channel[:source_path] %> <source <%=
<source channel.select { |k,_| [:source_mode, :source_path].include? k }
<% if channel[:source_mode] %> .reject { |k,v| v.nil? }
mode='<%= channel[:source_mode] %>' .map { |k,v| "#{k.to_s.split('_').last}='#{v}'"}
<% end %> .join(' ')
<% if channel[:source_path] %> -%>/>
path="<%= channel[:source_path] %>" <%- end -%>
<% end %> <target type='<%= channel[:target_type] %>' <%=
/> channel.select { |k,_| [:target_name, :target_address, :target_port].include? k }
<% end %> .reject { |k,v| v.nil? }
<target type='<%= channel[:target_type] %>' .map { |k,v| "#{k.to_s.split('_').last}='#{v}'"}
<% if channel[:target_name] %> .join(' ')
name="<%= channel[:target_name] %>" -%>/>
<% end %> </channel>
<% if channel[:target_address] %> <%- end -%>
address="<%= channel[:target_address] %>" <%- @inputs.each do |input| -%>
<% end %>
<% if channel[:target_port] %>
port="<%= channel[:target_port] %>"
<% end %>
/>
</channel>
<% end %>
<% @inputs.each do |input| %>
<input type='<%= input[:type] %>' bus='<%= input[:bus] %>'/> <input type='<%= input[:type] %>' bus='<%= input[:bus] %>'/>
<% end %> <%- end -%>
<%- if !@sound_type.nil? -%>
<% if !@sound_type.nil? %> <%# Sound device-%>
<%# Sound device-%> <sound model='<%= @sound_type %>'>
<sound model='<%= @sound_type %>'> </sound>
</sound> <%# End Sound%>
<%# End Sound%> <%- end -%>
<% end %> <%- if @graphics_type != 'none'
<% if @graphics_type != 'none' %> graphics = {
<%# Video device -%> 'type' => @graphics_type,
<graphics type='<%= @graphics_type %>' port='<%= @graphics_port %>' autoport='<%= @graphics_autoport %>' listen='<%= @graphics_ip %>' keymap='<%= @keymap %>' <%= @graphics_passwd %> <% if not @graphics_gl %>/><% else %>> 'port' => @graphics_port,
<gl enable='yes' /> 'autoport' => @graphics_autoport,
</graphics><% end %> 'listen' => @graphics_ip,
<video> 'keymap' => @keymap,
<model type='<%= @video_type %>' vram='<%= @video_vram %>' heads='1'<% if not @video_accel3d %>/><% else %>> 'passwd' => @graphics_passwd,
<acceleration accel3d='yes'/> }
</model><% end %> -%>
</video> <%# Video device -%>
<%#End Video -%> <graphics <%=
<% end %> graphics.reject { |k,v| v.nil? }
<% if @rng[:model] == "random"%> .map { |k,v| "#{k}='#{v}'" }
<rng model='virtio'> .join(' ')
<backend model='random'>/dev/random</backend> -%><%- if not @graphics_gl %>/><% else %>>
</rng> <gl enable='yes'/>
<% end %> </graphics><% end -%>
<% @pcis.each do |pci| %> <video>
<hostdev mode='subsystem' type='pci' managed='yes'> <model type='<%= @video_type %>' vram='<%= @video_vram %>' heads='1'<% if not @video_accel3d %>/><% else %>>
<source> <acceleration accel3d='yes'/>
<address domain='<%= pci[:domain] %>' </model><% end -%>
bus='<%= pci[:bus] %>' </video>
slot='<%= pci[:slot] %>' <%#End Video -%>
function='<%= pci[:function] %>'/> <%- end -%>
</source> <%- if @rng[:model] == "random"%>
</hostdev> <rng model='virtio'>
<% end %> <backend model='random'>/dev/random</backend>
<% @usbs.each do |usb| %> </rng>
<hostdev mode='subsystem' type='usb'> <%- end -%>
<source startupPolicy='<%= usb[:startupPolicy] || "mandatory" %>'> <%- @pcis.each do |pci| -%>
<% if usb[:vendor] %> <hostdev mode='subsystem' type='pci' managed='yes'>
<vendor id='<%= usb[:vendor] %>'/> <source>
<% end %> <address <%= pci.select { |k,_| [:domain, :bus, :slot, :function].include? k }
<% if usb[:product] %> .reject { |k,v| v.nil? }
<product id='<%= usb[:product] %>'/> .map { |k,v| "#{k.to_s}='#{v}'" }
<% end %> .join(' ')
<% if usb[:bus] && usb[:device] %> -%>/>
<address bus='<%= usb[:bus] %>' device='<%= usb[:device] %>'/> </source>
<% end %> </hostdev>
</source> <%- end -%>
</hostdev> <%- @usbs.each do |usb| -%>
<% end %> <hostdev mode='subsystem' type='usb'>
<% unless @redirdevs.empty? %> <source startupPolicy='<%= usb[:startupPolicy] || "mandatory" %>'>
<% @redirdevs.each do |redirdev| %> <%- if usb[:vendor] -%>
<redirdev bus='usb' type='<%= redirdev[:type] %>'> <vendor id='<%= usb[:vendor] %>'/>
</redirdev> <%- end -%>
<% end %> <%- if usb[:product] -%>
<% unless @redirfilters.empty? %> <product id='<%= usb[:product] %>'/>
<redirfilter> <%- end -%>
<% @redirfilters.each do |usbdev| %> <%- if usb[:bus] && usb[:device] -%>
<usbdev class='<%= usbdev[:class] %>' vendor='<%= usbdev[:vendor] %>' product='<%= usbdev[:product] %>' version='<%= usbdev[:version] %>' allow='<%= usbdev[:allow] %>'/> <address bus='<%= usb[:bus] %>' device='<%= usb[:device] %>'/>
<% end %> <%- end -%>
</redirfilter> </source>
<% end %> </hostdev>
<% end %> <%- end -%>
<% unless @watchdog_dev.empty? %> <%- unless @redirdevs.empty? -%>
<%- @redirdevs.each do |redirdev| -%>
<redirdev bus='usb' type='<%= redirdev[:type] %>'>
</redirdev>
<%- end -%>
<%- unless @redirfilters.empty? -%>
<redirfilter>
<%- @redirfilters.each do |usbdev| -%>
<usbdev class='<%= usbdev[:class] %>' vendor='<%= usbdev[:vendor] %>' product='<%= usbdev[:product] %>' version='<%= usbdev[:version] %>' allow='<%= usbdev[:allow] %>'/>
<%- end -%>
</redirfilter>
<%- end -%>
<%- end -%>
<%- unless @watchdog_dev.empty? -%>
<%# Watchdog Device -%> <%# Watchdog Device -%>
<watchdog model='<%= @watchdog_dev[:model] %>' action='<%= @watchdog_dev[:action] %>'/> <watchdog model='<%= @watchdog_dev[:model] %>' action='<%= @watchdog_dev[:action] %>'/>
<% end %> <%- end -%>
<%- unless @smartcard_dev.empty? -%>
<% unless @smartcard_dev.empty? -%> <%- if @smartcard_dev[:mode] == 'passthrough' -%>
<% if @smartcard_dev[:mode] == 'passthrough' %> <%- if @smartcard_dev[:type] == 'tcp' -%>
<% if @smartcard_dev[:type] == 'tcp' %> <smartcard mode='<%= @smartcard_dev[:mode] %>' type='<%= @smartcard_dev[:type] %>'>
<smartcard mode='<%= @smartcard_dev[:mode] %>' type='<%= @smartcard_dev[:type] %>'> <source mode='<%= @smartcard_dev[:source_mode] %>' host='<%= @smartcard_dev[:source_host] %>' service='<%= @smartcard_dev[:source_service] %>'/>
<source mode='<%= @smartcard_dev[:source_mode] %>' host='<%= @smartcard_dev[:source_host] %>' service='<%= @smartcard_dev[:source_service] %>'/> </smartcard>
</smartcard> <%- else -%>
<% else %> <smartcard mode='<%= @smartcard_dev[:mode] %>' type='<%= @smartcard_dev[:type] %>'/>
<smartcard mode='<%= @smartcard_dev[:mode] %>' type='<%= @smartcard_dev[:type] %>'/> <%- end -%>
<% end %> <%- end -%>
<% end %> <%- end -%>
<% end -%> <%- if @tpm_path || @tpm_version -%>
<% if @tpm_path || @tpm_version -%>
<%# TPM Device -%> <%# TPM Device -%>
<tpm model='<%= @tpm_model %>'> <tpm model='<%= @tpm_model %>'>
<backend type='<%= @tpm_type %>'<% if @tpm_version %> version='<%= @tpm_version %>'<% end %>> <backend type='<%= @tpm_type %>'<% if @tpm_version %> version='<%= @tpm_version %>'<% end %>>
<% if @tpm_path -%> <%- if @tpm_path -%>
<device path='<%= @tpm_path %>'/> <device path='<%= @tpm_path %>'/>
<% end -%> <%- end -%>
</backend> </backend>
</tpm> </tpm>
<% end -%> <%- end -%>
<% if not @usbctl_dev.empty? %> <%- if not @usbctl_dev.empty? -%>
<%# USB Controller -%> <%# USB Controller -%>
<controller type='usb' model='<%= @usbctl_dev[:model] %>' <%= "ports=\"#{@usbctl_dev[:ports]}\" " if @usbctl_dev[:ports] %>/> <controller type='usb' model='<%= @usbctl_dev[:model] %>' <%= "ports=\"#{@usbctl_dev[:ports]}\" " if @usbctl_dev[:ports] %>/>
<% end %> <%- end -%>
<% unless @memballoon_enabled.nil? %> <%- unless @memballoon_enabled.nil? -%>
<% if @memballoon_enabled %> <%- if @memballoon_enabled -%>
<memballoon model='<%= @memballoon_model %>'> <memballoon model='<%= @memballoon_model %>'>
<address type='pci' domain='0x0000' bus='<%= @memballoon_pci_bus %>' slot='<%= @memballoon_pci_slot %>' function='0x0'/> <address type='pci' domain='0x0000' bus='<%= @memballoon_pci_bus %>' slot='<%= @memballoon_pci_slot %>' function='0x0'/>
</memballoon> </memballoon>
<% else %> <%- else -%>
<memballoon model='none'/> <memballoon model='none'/>
<% end %> <%- end -%>
<% end %> <%- end -%>
</devices> </devices>
<%- if not @qemu_args.empty? or not @qemu_env.empty? -%>
<% if not @qemu_args.empty? or not @qemu_env.empty? %>
<qemu:commandline> <qemu:commandline>
<% @qemu_args.each do |arg| %> <%- @qemu_args.each do |arg| -%>
<qemu:arg value='<%= arg[:value] %>'/> <qemu:arg value='<%= arg[:value] %>'/>
<% end %> <%- end -%>
<% @qemu_env.each do |env_var, env_value| %> <%- @qemu_env.each do |env_var, env_value| -%>
<qemu:env name='<%= env_var.to_s %>' value='<%= env_value %>'/> <qemu:env name='<%= env_var.to_s %>' value='<%= env_value %>'/>
<% end %> <%- end -%>
</qemu:commandline> </qemu:commandline>
<% end %> <%- end -%>
</domain> </domain>

View File

@@ -5,15 +5,11 @@
<uuid></uuid> <uuid></uuid>
<memory>524288</memory> <memory>524288</memory>
<vcpu>1</vcpu> <vcpu>1</vcpu>
<cpu mode='host-model'> <cpu mode='host-model'>
<model fallback='allow'></model> <model fallback='allow'></model>
</cpu> </cpu>
<os> <os>
<type>hvm</type> <type>hvm</type>
<kernel></kernel> <kernel></kernel>
<initrd></initrd> <initrd></initrd>
<cmdline></cmdline> <cmdline></cmdline>
@@ -38,24 +34,16 @@
<source file='/var/lib/libvirt/images/vagrant-test_default-vdb.qcow2'/> <source file='/var/lib/libvirt/images/vagrant-test_default-vdb.qcow2'/>
<target dev='vdb' bus='virtio'/> <target dev='vdb' bus='virtio'/>
</disk> </disk>
<serial type='pty'> <serial type='pty'>
<target port='0'/> <target port='0'/>
</serial> </serial>
<console type='pty'> <console type='pty'>
<target port='0'/> <target port='0'/>
</console> </console>
<input type='mouse' bus='ps2'/> <input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' keymap='en-us'/>
<graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' keymap='en-us' /> <video>
<video> <model type='cirrus' vram='9216' heads='1'/>
<model type='cirrus' vram='9216' heads='1'/> </video>
</video>
</devices> </devices>
</domain> </domain>

View File

@@ -5,15 +5,11 @@
<uuid></uuid> <uuid></uuid>
<memory>524288</memory> <memory>524288</memory>
<vcpu>1</vcpu> <vcpu>1</vcpu>
<cpu mode='host-model'> <cpu mode='host-model'>
<model fallback='allow'></model> <model fallback='allow'></model>
</cpu> </cpu>
<os> <os>
<type>hvm</type> <type>hvm</type>
<kernel></kernel> <kernel></kernel>
<initrd></initrd> <initrd></initrd>
<cmdline></cmdline> <cmdline></cmdline>
@@ -32,24 +28,16 @@
<source file='/var/lib/libvirt/images/vagrant-test_default.img'/> <source file='/var/lib/libvirt/images/vagrant-test_default.img'/>
<target dev='sda' bus='virtio'/> <target dev='sda' bus='virtio'/>
</disk> </disk>
<serial type='pty'> <serial type='pty'>
<target port='0'/> <target port='0'/>
</serial> </serial>
<console type='pty'> <console type='pty'>
<target port='0'/> <target port='0'/>
</console> </console>
<input type='mouse' bus='ps2'/> <input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' keymap='en-us'/>
<graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' keymap='en-us' /> <video>
<video> <model type='cirrus' vram='9216' heads='1'/>
<model type='cirrus' vram='9216' heads='1'/> </video>
</video>
</devices> </devices>
</domain> </domain>

View File

@@ -5,15 +5,11 @@
<uuid></uuid> <uuid></uuid>
<memory>524288</memory> <memory>524288</memory>
<vcpu>1</vcpu> <vcpu>1</vcpu>
<cpu mode='host-model'> <cpu mode='host-model'>
<model fallback='allow'></model> <model fallback='allow'></model>
</cpu> </cpu>
<os> <os>
<type>hvm</type> <type>hvm</type>
<kernel></kernel> <kernel></kernel>
<initrd></initrd> <initrd></initrd>
<cmdline></cmdline> <cmdline></cmdline>
@@ -32,24 +28,16 @@
<source file='/var/lib/libvirt/images/vagrant-test_default.img'/> <source file='/var/lib/libvirt/images/vagrant-test_default.img'/>
<target dev='vda' bus='virtio'/> <target dev='vda' bus='virtio'/>
</disk> </disk>
<serial type='pty'> <serial type='pty'>
<target port='0'/> <target port='0'/>
</serial> </serial>
<console type='pty'> <console type='pty'>
<target port='0'/> <target port='0'/>
</console> </console>
<input type='mouse' bus='ps2'/> <input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' keymap='en-us'/>
<graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' keymap='en-us' /> <video>
<video> <model type='cirrus' vram='9216' heads='1'/>
<model type='cirrus' vram='9216' heads='1'/> </video>
</video>
</devices> </devices>
</domain> </domain>

View File

@@ -5,15 +5,11 @@
<uuid></uuid> <uuid></uuid>
<memory>524288</memory> <memory>524288</memory>
<vcpu>1</vcpu> <vcpu>1</vcpu>
<cpu mode='host-model'> <cpu mode='host-model'>
<model fallback='allow'></model> <model fallback='allow'></model>
</cpu> </cpu>
<os> <os>
<type>hvm</type> <type>hvm</type>
<kernel></kernel> <kernel></kernel>
<initrd></initrd> <initrd></initrd>
<cmdline></cmdline> <cmdline></cmdline>
@@ -38,24 +34,16 @@
<source file='/var/lib/libvirt/images/vagrant-test_default_1.img'/> <source file='/var/lib/libvirt/images/vagrant-test_default_1.img'/>
<target dev='vdb' bus='virtio'/> <target dev='vdb' bus='virtio'/>
</disk> </disk>
<serial type='pty'> <serial type='pty'>
<target port='0'/> <target port='0'/>
</serial> </serial>
<console type='pty'> <console type='pty'>
<target port='0'/> <target port='0'/>
</console> </console>
<input type='mouse' bus='ps2'/> <input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' keymap='en-us'/>
<graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' keymap='en-us' /> <video>
<video> <model type='cirrus' vram='9216' heads='1'/>
<model type='cirrus' vram='9216' heads='1'/> </video>
</video>
</devices> </devices>
</domain> </domain>

View File

@@ -5,15 +5,11 @@
<uuid/> <uuid/>
<memory/> <memory/>
<vcpu>1</vcpu> <vcpu>1</vcpu>
<cpu mode='host-model'> <cpu mode='host-model'>
<model fallback='allow'/> <model fallback='allow'/>
</cpu> </cpu>
<os> <os>
<type>hvm</type> <type>hvm</type>
<kernel/> <kernel/>
<initrd/> <initrd/>
<cmdline/> <cmdline/>
@@ -27,24 +23,16 @@
<timer name='rtc'/> <timer name='rtc'/>
</clock> </clock>
<devices> <devices>
<serial type='pty'> <serial type='pty'>
<target port='0'/> <target port='0'/>
</serial> </serial>
<console type='pty'> <console type='pty'>
<target port='0'/> <target port='0'/>
</console> </console>
<input bus='ps2' type='mouse'/> <input bus='ps2' type='mouse'/>
<graphics autoport='yes' keymap='en-us' listen='127.0.0.1' port='-1' type='vnc'/>
<graphics autoport='yes' keymap='en-us' listen='127.0.0.1' port='-1' type='vnc'/> <video>
<video> <model heads='1' type='cirrus' vram='9216'/>
<model heads='1' type='cirrus' vram='9216'/> </video>
</video>
</devices> </devices>
</domain> </domain>

View File

@@ -5,15 +5,11 @@
<uuid/> <uuid/>
<memory/> <memory/>
<vcpu>1</vcpu> <vcpu>1</vcpu>
<cpu mode='host-model'> <cpu mode='host-model'>
<model fallback='allow'/> <model fallback='allow'/>
</cpu> </cpu>
<os> <os>
<type>hvm</type> <type>hvm</type>
<kernel/> <kernel/>
<initrd/> <initrd/>
<cmdline/> <cmdline/>
@@ -25,24 +21,16 @@
</features> </features>
<clock offset='utc'/> <clock offset='utc'/>
<devices> <devices>
<serial type='pty'> <serial type='pty'>
<target port='0'/> <target port='0'/>
</serial> </serial>
<console type='pty'> <console type='pty'>
<target port='0'/> <target port='0'/>
</console> </console>
<input bus='ps2' type='mouse'/> <input bus='ps2' type='mouse'/>
<graphics autoport='yes' keymap='en-us' listen='127.0.0.1' port='-1' type='vnc'/>
<graphics autoport='yes' keymap='en-us' listen='127.0.0.1' port='-1' type='vnc'/> <video>
<video> <model heads='1' type='cirrus' vram='9216'/>
<model heads='1' type='cirrus' vram='9216'/> </video>
</video>
</devices> </devices>
</domain> </domain>

View File

@@ -5,15 +5,11 @@
<uuid/> <uuid/>
<memory/> <memory/>
<vcpu>1</vcpu> <vcpu>1</vcpu>
<cpu mode='host-model'> <cpu mode='host-model'>
<model fallback='allow'/> <model fallback='allow'/>
</cpu> </cpu>
<os> <os>
<type>hvm</type> <type>hvm</type>
<kernel/> <kernel/>
<initrd/> <initrd/>
<cmdline/> <cmdline/>
@@ -25,24 +21,16 @@
</features> </features>
<clock offset='utc'/> <clock offset='utc'/>
<devices> <devices>
<serial type='pty'> <serial type='pty'>
<target port='0'/> <target port='0'/>
</serial> </serial>
<console type='pty'> <console type='pty'>
<target port='0'/> <target port='0'/>
</console> </console>
<input bus='ps2' type='mouse'/> <input bus='ps2' type='mouse'/>
<graphics autoport='yes' keymap='en-us' listen='127.0.0.1' port='-1' type='vnc'/>
<graphics autoport='yes' keymap='en-us' listen='127.0.0.1' port='-1' type='vnc'/> <video>
<video> <model heads='1' type='cirrus' vram='9216'/>
<model heads='1' type='cirrus' vram='9216'/> </video>
</video>
<tpm model='tpm-tis'><backend type='passthrough'><device path='/dev/tpm0'/></backend></tpm></devices> <tpm model='tpm-tis'><backend type='passthrough'><device path='/dev/tpm0'/></backend></tpm></devices>
</domain> </domain>

View File

@@ -5,15 +5,11 @@
<uuid/> <uuid/>
<memory/> <memory/>
<vcpu>1</vcpu> <vcpu>1</vcpu>
<cpu mode='host-model'> <cpu mode='host-model'>
<model fallback='allow'/> <model fallback='allow'/>
</cpu> </cpu>
<os> <os>
<type>hvm</type> <type>hvm</type>
<kernel/> <kernel/>
<initrd/> <initrd/>
<cmdline/> <cmdline/>
@@ -25,24 +21,16 @@
</features> </features>
<clock offset='utc'/> <clock offset='utc'/>
<devices> <devices>
<serial type='pty'> <serial type='pty'>
<target port='0'/> <target port='0'/>
</serial> </serial>
<console type='pty'> <console type='pty'>
<target port='0'/> <target port='0'/>
</console> </console>
<input bus='ps2' type='mouse'/> <input bus='ps2' type='mouse'/>
<graphics autoport='yes' keymap='en-us' listen='127.0.0.1' port='-1' type='vnc'/>
<graphics autoport='yes' keymap='en-us' listen='127.0.0.1' port='-1' type='vnc'/> <video>
<video> <model heads='1' type='cirrus' vram='9216'/>
<model heads='1' type='cirrus' vram='9216'/> </video>
</video>
<tpm model='tpm-crb'><backend type='emulator' version='2.0'/></tpm></devices> <tpm model='tpm-crb'><backend type='emulator' version='2.0'/></tpm></devices>
</domain> </domain>

View File

@@ -5,25 +5,21 @@
<uuid></uuid> <uuid></uuid>
<memory></memory> <memory></memory>
<vcpu cpuset='1-4,^3,6'>1</vcpu> <vcpu cpuset='1-4,^3,6'>1</vcpu>
<cpu mode='custom'> <cpu mode='custom'>
<model fallback='allow'>qemu64</model> <model fallback='allow'>qemu64</model>
<feature name='AAA' policy='required'/> <feature name='AAA' policy='required'/>
<topology sockets='1' cores='3' threads='2'/> <topology sockets='1' cores='3' threads='2'/>
</cpu> </cpu>
<numatune> <numatune>
<memory nodeset='1-4,^3,6'/> <memory nodeset='1-4,^3,6'/>
</numatune> </numatune>
<cputune> <cputune>
<shares>1024</shares> <shares>1024</shares>
</cputune> </cputune>
<os> <os>
<type arch='x86_64' machine='pc-compatible'>hvm</type> <type arch='x86_64' machine='pc-compatible'>hvm</type>
<loader readonly='yes' type='rom'>/efi/loader</loader> <loader readonly='yes' type='rom'>/efi/loader</loader>
<bootmenu enable='yes'/> <bootmenu enable='yes'/>
<kernel></kernel> <kernel></kernel>
<initrd></initrd> <initrd></initrd>
<cmdline></cmdline> <cmdline></cmdline>
@@ -67,7 +63,6 @@
<source file='/var/lib/libvirt/images/test-disk2.qcow2'/> <source file='/var/lib/libvirt/images/test-disk2.qcow2'/>
<target dev='vdd' bus='virtio'/> <target dev='vdd' bus='virtio'/>
</disk> </disk>
<disk type='file' device='cdrom'> <disk type='file' device='cdrom'>
<driver name='qemu' type='raw' /> <driver name='qemu' type='raw' />
<source file=''/> <source file=''/>
@@ -80,7 +75,6 @@
<target dev='hdb' bus='ide'/> <target dev='hdb' bus='ide'/>
<readonly/> <readonly/>
</disk> </disk>
<serial type='file'> <serial type='file'>
<source path='/var/log/vm_consoles/machine.log'/> <source path='/var/log/vm_consoles/machine.log'/>
<target port='0'/> <target port='0'/>
@@ -89,72 +83,52 @@
<source path='/var/log/vm_consoles/machine.log'/> <source path='/var/log/vm_consoles/machine.log'/>
<target port='0'/> <target port='0'/>
</console> </console>
<channel type='unix' >
<channel type='unix' > <target type='virtio' name='org.qemu.guest_agent.0'/>
<target type='virtio' </channel>
name="org.qemu.guest_agent.0" <channel type='spicevmc' >
/> <target type='virtio' name='com.redhat.spice.0'/>
</channel> </channel>
<channel type='spicevmc' > <channel type='unix' >
<target type='virtio' <source path='/tmp/foo'/>
name="com.redhat.spice.0" <target type='guestfwd' address='192.0.2.42' port='4242'/>
/> </channel>
</channel>
<channel type='unix' >
<source
path="/tmp/foo"
/>
<target type='guestfwd'
address="192.0.2.42"
port="4242"
/>
</channel>
<input type='mouse' bus='ps2'/> <input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' keymap='en-us'>
<graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' keymap='en-us' > <gl enable='yes'/>
<gl enable='yes' /> </graphics>
</graphics> <video>
<video> <model type='cirrus' vram='9216' heads='1'>
<model type='cirrus' vram='9216' heads='1'> <acceleration accel3d='yes'/>
<acceleration accel3d='yes'/> </model>
</model> </video>
</video> <rng model='virtio'>
<rng model='virtio'> <backend model='random'>/dev/random</backend>
<backend model='random'>/dev/random</backend> </rng>
</rng> <hostdev mode='subsystem' type='pci' managed='yes'>
<hostdev mode='subsystem' type='pci' managed='yes'> <source>
<source> <address domain='0x0000' bus='0x06' slot='0x12' function='0x5'/>
<address domain='0x0000' </source>
bus='0x06' </hostdev>
slot='0x12' <hostdev mode='subsystem' type='pci' managed='yes'>
function='0x5'/> <source>
</source> <address domain='0x0001' bus='0x03' slot='0x00' function='0x0'/>
</hostdev> </source>
<hostdev mode='subsystem' type='pci' managed='yes'> </hostdev>
<source> <hostdev mode='subsystem' type='usb'>
<address domain='0x0001' <source startupPolicy='mandatory'>
bus='0x03' <vendor id='0x1234'/>
slot='0x00' <product id='0xabcd'/>
function='0x0'/> <address bus='1' device='2'/>
</source> </source>
</hostdev> </hostdev>
<hostdev mode='subsystem' type='usb'> <redirdev bus='usb' type='tcp'>
<source startupPolicy='mandatory'> </redirdev>
<vendor id='0x1234'/> <redirfilter>
<product id='0xabcd'/> <usbdev class='0x0b' vendor='0x08e6' product='0x3437' version='2.00' allow='yes'/>
<address bus='1' device='2'/> </redirfilter>
</source>
</hostdev>
<redirdev bus='usb' type='tcp'>
</redirdev>
<redirfilter>
<usbdev class='0x0b' vendor='0x08e6' product='0x3437' version='2.00' allow='yes'/>
</redirfilter>
<watchdog model='i6300esb' action='reset'/> <watchdog model='i6300esb' action='reset'/>
<smartcard mode='passthrough' type='spicevmc'/>
<smartcard mode='passthrough' type='spicevmc'/>
<tpm model='tpm-tis'> <tpm model='tpm-tis'>
<backend type='passthrough'> <backend type='passthrough'>
<device path='/dev/tpm0'/> <device path='/dev/tpm0'/>
@@ -162,7 +136,6 @@
</tpm> </tpm>
<controller type='usb' model='nec-xhci' ports="4" /> <controller type='usb' model='nec-xhci' ports="4" />
</devices> </devices>
<qemu:commandline> <qemu:commandline>
<qemu:arg value='-device'/> <qemu:arg value='-device'/>
<qemu:arg value='dummy-device'/> <qemu:arg value='dummy-device'/>

View File

@@ -5,15 +5,11 @@
<uuid></uuid> <uuid></uuid>
<memory></memory> <memory></memory>
<vcpu>1</vcpu> <vcpu>1</vcpu>
<cpu mode='custom'> <cpu mode='custom'>
<model fallback='allow'>SandyBridge</model> <model fallback='allow'>SandyBridge</model>
</cpu> </cpu>
<os> <os>
<type>hvm</type> <type>hvm</type>
<kernel></kernel> <kernel></kernel>
<initrd></initrd> <initrd></initrd>
<cmdline></cmdline> <cmdline></cmdline>
@@ -26,24 +22,16 @@
<clock offset='utc'> <clock offset='utc'>
</clock> </clock>
<devices> <devices>
<serial type='pty'> <serial type='pty'>
<target port='0'/> <target port='0'/>
</serial> </serial>
<console type='pty'> <console type='pty'>
<target port='0'/> <target port='0'/>
</console> </console>
<input type='mouse' bus='ps2'/> <input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' keymap='en-us'/>
<graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' keymap='en-us' /> <video>
<video> <model type='cirrus' vram='9216' heads='1'/>
<model type='cirrus' vram='9216' heads='1'/> </video>
</video>
</devices> </devices>
</domain> </domain>

View File

@@ -5,15 +5,11 @@
<uuid></uuid> <uuid></uuid>
<memory></memory> <memory></memory>
<vcpu>1</vcpu> <vcpu>1</vcpu>
<cpu mode='host-model'> <cpu mode='host-model'>
<model fallback='allow'></model> <model fallback='allow'></model>
</cpu> </cpu>
<os> <os>
<type>hvm</type> <type>hvm</type>
<kernel></kernel> <kernel></kernel>
<initrd></initrd> <initrd></initrd>
<cmdline></cmdline> <cmdline></cmdline>
@@ -26,24 +22,16 @@
<clock offset='utc'> <clock offset='utc'>
</clock> </clock>
<devices> <devices>
<serial type='pty'> <serial type='pty'>
<target port='0'/> <target port='0'/>
</serial> </serial>
<console type='pty'> <console type='pty'>
<target port='0'/> <target port='0'/>
</console> </console>
<input type='mouse' bus='ps2'/> <input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' keymap='en-us'/>
<graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' keymap='en-us' /> <video>
<video> <model type='cirrus' vram='9216' heads='1'/>
<model type='cirrus' vram='9216' heads='1'/> </video>
</video>
</devices> </devices>
</domain> </domain>

View File

@@ -5,15 +5,11 @@
<uuid></uuid> <uuid></uuid>
<memory></memory> <memory></memory>
<vcpu>1</vcpu> <vcpu>1</vcpu>
<cpu mode='host-model'> <cpu mode='host-model'>
<model fallback='allow'></model> <model fallback='allow'></model>
</cpu> </cpu>
<os> <os>
<type>hvm</type> <type>hvm</type>
<kernel></kernel> <kernel></kernel>
<initrd></initrd> <initrd></initrd>
<cmdline></cmdline> <cmdline></cmdline>
@@ -26,29 +22,21 @@
<clock offset='utc'> <clock offset='utc'>
</clock> </clock>
<devices> <devices>
<serial type='pty'> <serial type='pty'>
<target port='0'/> <target port='0'/>
</serial> </serial>
<console type='pty'> <console type='pty'>
<target port='0'/> <target port='0'/>
</console> </console>
<input type='mouse' bus='ps2'/> <input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' keymap='en-us'/>
<graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' keymap='en-us' /> <video>
<video> <model type='cirrus' vram='9216' heads='1'/>
<model type='cirrus' vram='9216' heads='1'/> </video>
</video>
<tpm model='tpm-tis'> <tpm model='tpm-tis'>
<backend type='passthrough'> <backend type='passthrough'>
<device path='/dev/tpm0'/> <device path='/dev/tpm0'/>
</backend> </backend>
</tpm> </tpm>
</devices> </devices>
</domain> </domain>

View File

@@ -5,15 +5,11 @@
<uuid></uuid> <uuid></uuid>
<memory></memory> <memory></memory>
<vcpu>1</vcpu> <vcpu>1</vcpu>
<cpu mode='host-model'> <cpu mode='host-model'>
<model fallback='allow'></model> <model fallback='allow'></model>
</cpu> </cpu>
<os> <os>
<type>hvm</type> <type>hvm</type>
<kernel></kernel> <kernel></kernel>
<initrd></initrd> <initrd></initrd>
<cmdline></cmdline> <cmdline></cmdline>
@@ -26,28 +22,20 @@
<clock offset='utc'> <clock offset='utc'>
</clock> </clock>
<devices> <devices>
<serial type='pty'> <serial type='pty'>
<target port='0'/> <target port='0'/>
</serial> </serial>
<console type='pty'> <console type='pty'>
<target port='0'/> <target port='0'/>
</console> </console>
<input type='mouse' bus='ps2'/> <input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' keymap='en-us'/>
<graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' keymap='en-us' /> <video>
<video> <model type='cirrus' vram='9216' heads='1'/>
<model type='cirrus' vram='9216' heads='1'/> </video>
</video>
<tpm model='tpm-crb'> <tpm model='tpm-crb'>
<backend type='emulator' version='2.0'> <backend type='emulator' version='2.0'>
</backend> </backend>
</tpm> </tpm>
</devices> </devices>
</domain> </domain>