Disable graphics autoport attr when using spice (#1636)

If the graphics type is set to spice, then skip setting the autoport as
the attribute will be discarded by libvirt causing it to appear as
though not all of the XML sent to start the domain was accepted.
This commit is contained in:
Darragh Bailey 2022-10-11 18:12:32 +01:00 committed by GitHub
parent 59c7d9f18e
commit a8ab0040ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -956,7 +956,7 @@ module VagrantPlugins
@initrd = '' if @initrd == UNSET_VALUE
@dtb = nil if @dtb == UNSET_VALUE
@graphics_type = 'vnc' if @graphics_type == UNSET_VALUE
@graphics_autoport = @graphics_port == UNSET_VALUE ? 'yes' : nil
@graphics_autoport = @graphics_type != 'spice' && @graphics_port == UNSET_VALUE ? 'yes' : nil
if (@graphics_type != 'vnc' && @graphics_type != 'spice') ||
@graphics_passwd == UNSET_VALUE
@graphics_passwd = nil

View File

@ -673,7 +673,7 @@ describe VagrantPlugins::ProviderLibvirt::Config do
expect(subject.graphics_port).to eq(nil)
expect(subject.graphics_ip).to eq(nil)
expect(subject.graphics_autoport).to eq('yes')
expect(subject.graphics_autoport).to eq(nil)
expect(subject.channels).to match([a_hash_including({:target_name => 'com.redhat.spice.0'})])
end
end