mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
Support graphics_type = none
Devices which do not support any default vga device (e.g. ARM boards) can't be started when a video device is present. Libvirt automatically adds a <video> device whenever a <graphics> element is defined. Using 'none' was already documented as supported but did not work.
This commit is contained in:
parent
dc1a8d421f
commit
0016f34851
@ -135,33 +135,44 @@ module VagrantPlugins
|
|||||||
|
|
||||||
# Graphics
|
# Graphics
|
||||||
graphics = REXML::XPath.first(xml_descr,'/domain/devices/graphics')
|
graphics = REXML::XPath.first(xml_descr,'/domain/devices/graphics')
|
||||||
if graphics.attributes['type'] != config.graphics_type
|
if config.graphics_type != 'none'
|
||||||
descr_changed = true
|
if graphics.nil?
|
||||||
graphics.attributes['type'] = config.graphics_type
|
descr_changed = true
|
||||||
end
|
graphics = REXML::Element.new('graphics', REXML::XPath.first(xml_descr,'/domain/devices'))
|
||||||
if graphics.attributes['listen'] != config.graphics_ip
|
|
||||||
descr_changed = true
|
|
||||||
graphics.attributes['listen'] = config.graphics_ip
|
|
||||||
graphics.delete_element('//listen')
|
|
||||||
end
|
|
||||||
if graphics.attributes['autoport'] != config.graphics_autoport
|
|
||||||
descr_changed = true
|
|
||||||
graphics.attributes['autoport'] = config.graphics_autoport
|
|
||||||
if config.graphics_autoport == 'no'
|
|
||||||
graphics.attributes['port'] = config.graphics_port
|
|
||||||
end
|
end
|
||||||
end
|
if graphics.attributes['type'] != config.graphics_type
|
||||||
if graphics.attributes['keymap'] != config.keymap
|
descr_changed = true
|
||||||
descr_changed = true
|
graphics.attributes['type'] = config.graphics_type
|
||||||
graphics.attributes['keymap'] = config.keymap
|
|
||||||
end
|
|
||||||
if graphics.attributes['passwd'] != config.graphics_passwd
|
|
||||||
descr_changed = true
|
|
||||||
if config.graphics_passwd.nil?
|
|
||||||
graphics.attributes.delete 'passwd'
|
|
||||||
else
|
|
||||||
graphics.attributes['passwd'] = config.graphics_passwd
|
|
||||||
end
|
end
|
||||||
|
if graphics.attributes['listen'] != config.graphics_ip
|
||||||
|
descr_changed = true
|
||||||
|
graphics.attributes['listen'] = config.graphics_ip
|
||||||
|
graphics.delete_element('//listen')
|
||||||
|
end
|
||||||
|
if graphics.attributes['autoport'] != config.graphics_autoport
|
||||||
|
descr_changed = true
|
||||||
|
graphics.attributes['autoport'] = config.graphics_autoport
|
||||||
|
if config.graphics_autoport == 'no'
|
||||||
|
graphics.attributes['port'] = config.graphics_port
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if graphics.attributes['keymap'] != config.keymap
|
||||||
|
descr_changed = true
|
||||||
|
graphics.attributes['keymap'] = config.keymap
|
||||||
|
end
|
||||||
|
if graphics.attributes['passwd'] != config.graphics_passwd
|
||||||
|
descr_changed = true
|
||||||
|
if config.graphics_passwd.nil?
|
||||||
|
graphics.attributes.delete 'passwd'
|
||||||
|
else
|
||||||
|
graphics.attributes['passwd'] = config.graphics_passwd
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
# graphics_type = none, remove entire element
|
||||||
|
if !graphics.nil?
|
||||||
|
graphics.parent.delete_element(graphics)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#TPM
|
#TPM
|
||||||
@ -194,12 +205,24 @@ module VagrantPlugins
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Video device
|
# Video device
|
||||||
video = REXML::XPath.first(xml_descr,'/domain/devices/video/model')
|
video = REXML::XPath.first(xml_descr,'/domain/devices/video')
|
||||||
if video.attributes['type'] != config.video_type || video.attributes['vram'] != config.video_vram
|
if !video.nil? and config.graphics_type == 'none'
|
||||||
|
# graphics_type = none, video devices are removed since there is no possible output
|
||||||
descr_changed = true
|
descr_changed = true
|
||||||
video.attributes.each_attribute {|attr| video.attributes.delete attr}
|
video.parent.delete_element(video)
|
||||||
video.attributes['type'] = config.video_type
|
else
|
||||||
video.attributes['vram'] = config.video_vram
|
video_model = REXML::XPath.first(xml_descr,'/domain/devices/video/model')
|
||||||
|
if video_model.nil?
|
||||||
|
video_model = REXML::Element.new('model', REXML::XPath.first(xml_descr,'/domain/devices/video'))
|
||||||
|
video_model.attributes['type'] = config.video_type
|
||||||
|
video_model.attributes['vram'] = config.video_vram
|
||||||
|
else
|
||||||
|
if video_model.attributes['type'] != config.video_type || video_model.attributes['vram'] != config.video_vram
|
||||||
|
descr_changed = true
|
||||||
|
video_model.attributes['type'] = config.video_type
|
||||||
|
video_model.attributes['vram'] = config.video_vram
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# dtb
|
# dtb
|
||||||
|
@ -100,12 +100,14 @@
|
|||||||
<input type='<%= input[:type] %>' bus='<%= input[:bus] %>'/>
|
<input type='<%= input[:type] %>' bus='<%= input[:bus] %>'/>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%# Video device -%>
|
<% if @graphics_type != 'none' %>
|
||||||
<graphics type='<%= @graphics_type %>' port='<%= @graphics_port %>' autoport='<%= @graphics_autoport %>' listen='<%= @graphics_ip %>' keymap='<%= @keymap %>' <%= @graphics_passwd%> />
|
<%# Video device -%>
|
||||||
<video>
|
<graphics type='<%= @graphics_type %>' port='<%= @graphics_port %>' autoport='<%= @graphics_autoport %>' listen='<%= @graphics_ip %>' keymap='<%= @keymap %>' <%= @graphics_passwd%> />
|
||||||
<model type='<%= @video_type %>' vram='<%= @video_vram %>' heads='1'/>
|
<video>
|
||||||
</video>
|
<model type='<%= @video_type %>' vram='<%= @video_vram %>' heads='1'/>
|
||||||
<%#End Video -%>
|
</video>
|
||||||
|
<%#End Video -%>
|
||||||
|
<% end %>
|
||||||
<% @pcis.each do |pci| %>
|
<% @pcis.each do |pci| %>
|
||||||
<hostdev mode='subsystem' type='pci' managed='yes'>
|
<hostdev mode='subsystem' type='pci' managed='yes'>
|
||||||
<source>
|
<source>
|
||||||
|
Loading…
Reference in New Issue
Block a user