Update to vagrant-libvirt 0.7.0.

Resolves: rhbz#1963360

Also rename patch0 to patch100
 * vagrant-libvirt-0.7.0-enable-qemu-session-by-default.patch

Tests / compatibility fix:
 - Allow the connection.client.libversion call
   https://github.com/vagrant-libvirt/vagrant-libvirt/pull/1416
 - Reduce patching for distro default session use
   https://github.com/vagrant-libvirt/vagrant-libvirt/pull/1424
This commit is contained in:
Pavel Valena 2021-09-14 15:21:56 +02:00
parent 9fa7fba364
commit eb118f573c
7 changed files with 352 additions and 218 deletions

1
.gitignore vendored
View File

@ -1,3 +1,2 @@
/vagrant-spec-*.txz
/vagrant-libvirt-*.gem
/vagrant-spec-*.tar.gz

View File

@ -1,2 +1,2 @@
SHA512 (vagrant-libvirt-0.4.1.gem) = d81196eaa891e429a4ac539b8a0c7074855274627ba1cee54ceafc09969ff604cd208723a1b97d343644a15dbd86b046b579159a3d01c893379ab3e77cb7a237
SHA512 (vagrant-spec-b6b56c8b81351ee38e1dd58900591da566aab98c.tar.gz) = 7df1fa329190114b69356de8917cccdfe34a06ffab888268144cd6ddf6c44a5c29435e6137dc6b179b99dbd9e71f8d76e127ac504b60629288b200f9bef46516
SHA512 (vagrant-libvirt-0.7.0.gem) = d501ce2b65c6df3cc0ac6a831374fb64c7227a930269999592b8ca10f91e2c866aacd9c952c138c442d99d645f39d381f1cbfe21f6c039ad9cd04eb08d494446
SHA512 (vagrant-spec-03d88fe2467716b072951c2b55d78223130851a6.tar.gz) = 3b062cbec04f98355f939c2bf27d35ddcd2bbe0a0734677832d4a656320b44c64b6284e0877dd55e496055e2b969755e1bdc78225010f75ddaafe8f8c8f78a66

View File

@ -10,7 +10,7 @@ diff --git a/lib/vagrant-libvirt/config.rb b/lib/vagrant-libvirt/config.rb
index 4861a4d..71bb909 100644
--- a/lib/vagrant-libvirt/config.rb
+++ b/lib/vagrant-libvirt/config.rb
@@ -762,9 +762,9 @@ module VagrantPlugins
@@ -814,9 +814,9 @@ module VagrantPlugins
@socket = nil if @socket == UNSET_VALUE
# If uri isn't set then let's build one from various sources.
@ -22,42 +22,35 @@ index 4861a4d..71bb909 100644
end
finalize_from_uri
From 30e4f77d16dc7237ba1947c84d37cfd5a39e5071 Mon Sep 17 00:00:00 2001
From b68bf05606da6449966a53a2ea6abe261a03a731 Mon Sep 17 00:00:00 2001
From: Pavel Valena <pvalena@redhat.com>
Date: Wed, 21 Apr 2021 15:47:07 +0200
Subject: [PATCH] Set qemu://session as default in tests.
Date: Mon, 13 Dec 2021 12:06:21 +0100
Subject: [PATCH] Fix tests.
---
unit/action/create_domain_spec.rb | 3 +-
unit/config_spec.rb | 48 +++++++++++++++----------------
2 files changed, 26 insertions(+), 25 deletions(-)
spec/unit/action/create_domain_spec.rb | 2 +-
spec/unit/config_spec.rb | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/spec/unit/action/create_domain_spec.rb b/spec/unit/action/create_domain_spec.rb
index d85d676..3934390 100644
index 342debf..cb51cf5 100644
--- a/spec/unit/action/create_domain_spec.rb
+++ b/spec/unit/action/create_domain_spec.rb
@@ -36,7 +36,7 @@ describe VagrantPlugins::ProviderLibvirt::Action::CreateDomain do
allow(Process).to receive(:gid).and_return(9999)
end
- context 'connection => qemu:///system' do
+ context 'connection => qemu:///session' do
context 'default pool' do
let(:test_file) { 'default_system_storage_pool.xml' }
@@ -56,6 +56,7 @@ describe VagrantPlugins::ProviderLibvirt::Action::CreateDomain do
config.vm.define :test
config.vm.provider :libvirt do |libvirt|
libvirt.storage :file, :size => '20G'
+ libvirt.qemu_use_session = false
end
end
EOF
@@ -34,7 +34,7 @@ describe VagrantPlugins::ProviderLibvirt::Action::CreateDomain do
allow(connection).to receive(:volumes).and_return(volumes)
allow(volumes).to receive(:all).and_return([domain_volume])
allow(domain_volume).to receive(:pool_name).and_return('default')
- allow(domain_volume).to receive(:[]).with('name').and_return('vagrant-test_default.img')
+ #allow(domain_volume).to receive(:[]).with('name').and_return('vagrant-test_default.img')
allow(domain_volume).to receive(:path).and_return('/var/lib/libvirt/images/vagrant-test_default.img')
allow(machine).to receive_message_chain("box.name") { 'vagrant-libvirt/test' }
diff --git a/spec/unit/config_spec.rb b/spec/unit/config_spec.rb
index e0e53ea..79fe77c 100644
index 6f82da1..bd74999 100644
--- a/spec/unit/config_spec.rb
+++ b/spec/unit/config_spec.rb
@@ -72,13 +72,13 @@ describe VagrantPlugins::ProviderLibvirt::Config do
@@ -74,7 +74,7 @@ describe VagrantPlugins::ProviderLibvirt::Config do
# settings
[ # all default
{},
@ -66,151 +59,5 @@ index e0e53ea..79fe77c 100644
],
# explicit uri settings
[ # transport and hostname
- {:uri => "qemu+ssh://localhost/system"},
- {:uri => "qemu+ssh://localhost/system", :connect_via_ssh => true, :host => "localhost", :username => nil},
+ {:uri => "qemu+ssh://localhost/session"},
+ {:uri => "qemu+ssh://localhost/session", :connect_via_ssh => true, :host => "localhost", :username => nil},
],
[ # tcp transport with port
{:uri => "qemu+tcp://localhost:5000/system"},
@@ -153,58 +153,58 @@ describe VagrantPlugins::ProviderLibvirt::Config do
],
[ # when session not set
{},
- {:uri => "qemu:///system", :qemu_use_session => false},
+ {:uri => "qemu:///session", :qemu_use_session => true},
{
- :env => {'LIBVIRT_DEFAULT_URI' => "qemu:///system"},
+ :env => {'LIBVIRT_DEFAULT_URI' => "qemu:///session"},
}
],
[ # when session appearing elsewhere
{},
- {:uri => "qemu://remote/system?keyfile=my_session_id", :qemu_use_session => false},
+ {:uri => "qemu://remote/session?keyfile=my_session_id", :qemu_use_session => true},
{
- :env => {'LIBVIRT_DEFAULT_URI' => "qemu://remote/system?keyfile=my_session_id"},
+ :env => {'LIBVIRT_DEFAULT_URI' => "qemu://remote/session?keyfile=my_session_id"},
}
],
# ignore LIBVIRT_DEFAULT_URI due to explicit settings
[ # when uri explicitly set
- {:uri => 'qemu:///system'},
- {:uri => 'qemu:///system'},
+ {:uri => 'qemu:///session'},
+ {:uri => 'qemu:///session'},
{
:env => {'LIBVIRT_DEFAULT_URI' => 'qemu://session'},
}
],
[ # when host explicitly set
{:host => 'remote'},
- {:uri => 'qemu://remote/system'},
+ {:uri => 'qemu://remote/session'},
{
:env => {'LIBVIRT_DEFAULT_URI' => 'qemu://session'},
}
],
[ # when connect_via_ssh explicitly set
{:connect_via_ssh => true},
- {:uri => 'qemu+ssh://localhost/system?no_verify=1'},
+ {:uri => 'qemu+ssh://localhost/session?no_verify=1'},
{
:env => {'LIBVIRT_DEFAULT_URI' => 'qemu://session'},
}
],
[ # when username explicitly set without ssh
{:username => 'my_user' },
- {:uri => 'qemu:///system'},
+ {:uri => 'qemu:///session'},
{
:env => {'LIBVIRT_DEFAULT_URI' => 'qemu://session'},
}
],
[ # when username explicitly set with host but without ssh
{:username => 'my_user', :host => 'remote'},
- {:uri => 'qemu://remote/system'},
+ {:uri => 'qemu://remote/session'},
{
:env => {'LIBVIRT_DEFAULT_URI' => 'qemu://session'},
}
],
[ # when password explicitly set
{:password => 'some_password'},
- {:uri => 'qemu:///system', :password => 'some_password'},
+ {:uri => 'qemu:///session', :password => 'some_password'},
{
:env => {'LIBVIRT_DEFAULT_URI' => 'qemu://session'},
}
@@ -213,11 +213,11 @@ describe VagrantPlugins::ProviderLibvirt::Config do
# driver settings
[ # set to kvm only
{:driver => 'kvm'},
- {:uri => "qemu:///system"},
+ {:uri => "qemu:///session"},
],
[ # set to qemu only
{:driver => 'qemu'},
- {:uri => "qemu:///system"},
+ {:uri => "qemu:///session"},
],
[ # set to qemu with session enabled
{:driver => 'qemu', :qemu_use_session => true},
@@ -239,29 +239,29 @@ describe VagrantPlugins::ProviderLibvirt::Config do
# connect_via_ssh settings
[ # enabled
{:connect_via_ssh => true},
- {:uri => "qemu+ssh://localhost/system?no_verify=1"},
+ {:uri => "qemu+ssh://localhost/session?no_verify=1"},
],
[ # enabled with user
{:connect_via_ssh => true, :username => 'my_user'},
- {:uri => "qemu+ssh://my_user@localhost/system?no_verify=1"},
+ {:uri => "qemu+ssh://my_user@localhost/session?no_verify=1"},
],
[ # enabled with host
{:connect_via_ssh => true, :host => 'remote_server'},
- {:uri => "qemu+ssh://remote_server/system?no_verify=1"},
+ {:uri => "qemu+ssh://remote_server/session?no_verify=1"},
],
# id_ssh_key_file behaviour
[ # set should take given value
{:connect_via_ssh => true, :id_ssh_key_file => '/path/to/keyfile'},
- {:uri => 'qemu+ssh://localhost/system?no_verify=1&keyfile=/path/to/keyfile', :connect_via_ssh => true},
+ {:uri => 'qemu+ssh://localhost/session?no_verify=1&keyfile=/path/to/keyfile', :connect_via_ssh => true},
],
[ # set should infer use of ssh
{:id_ssh_key_file => '/path/to/keyfile'},
- {:uri => 'qemu+ssh://localhost/system?no_verify=1&keyfile=/path/to/keyfile', :connect_via_ssh => true},
+ {:uri => 'qemu+ssh://localhost/session?no_verify=1&keyfile=/path/to/keyfile', :connect_via_ssh => true},
],
[ # connect_via_ssh should enable default but ignore due to not existing
{:connect_via_ssh => true},
- {:uri => 'qemu+ssh://localhost/system?no_verify=1', :id_ssh_key_file => nil},
+ {:uri => 'qemu+ssh://localhost/session?no_verify=1', :id_ssh_key_file => nil},
{
:setup => ProcWithBinding.new {
expect(File).to receive(:file?).with("/home/tests/.ssh/id_rsa").and_return(false)
@@ -270,7 +270,7 @@ describe VagrantPlugins::ProviderLibvirt::Config do
],
[ # connect_via_ssh should enable default and include due to existing
{:connect_via_ssh => true},
- {:uri => 'qemu+ssh://localhost/system?no_verify=1&keyfile=/home/tests/.ssh/id_rsa', :id_ssh_key_file => '/home/tests/.ssh/id_rsa'},
+ {:uri => 'qemu+ssh://localhost/session?no_verify=1&keyfile=/home/tests/.ssh/id_rsa', :id_ssh_key_file => '/home/tests/.ssh/id_rsa'},
{
:setup => ProcWithBinding.new {
expect(File).to receive(:file?).with("/home/tests/.ssh/id_rsa").and_return(true)
@@ -281,7 +281,7 @@ describe VagrantPlugins::ProviderLibvirt::Config do
# socket behaviour
[ # set
{:socket => '/var/run/libvirt/libvirt-sock'},
- {:uri => "qemu:///system?socket=/var/run/libvirt/libvirt-sock"},
+ {:uri => "qemu:///session?socket=/var/run/libvirt/libvirt-sock"},
],
].each do |inputs, outputs, options|
opts = {}
--
2.30.0
2.33.1

View File

@ -1,27 +0,0 @@
From 28d475ca292b289dd9a8bab7180670e4acfe5b6d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= <emilio@crisal.io>
Date: Tue, 6 Apr 2021 16:20:04 +0200
Subject: [PATCH] Fix forward_ports with ruby 3.0 (#1242)
Fedora 24 has moved to ruby 3.0, which triggers an exception in
vagrant-libvirt when installing it with vagrant provided by the distro.
This is caused by a chance in ruby 3.0 that can be applied to earlier
versions without any down sides:
https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/
---
lib/vagrant-libvirt/action/forward_ports.rb | 2 +-
diff --git a/lib/vagrant-libvirt/action/forward_ports.rb b/lib/vagrant-libvirt/action/forward_ports.rb
index e479ebfe..72da4edf 100644
--- a/lib/vagrant-libvirt/action/forward_ports.rb
+++ b/lib/vagrant-libvirt/action/forward_ports.rb
@@ -44,7 +44,7 @@ def forward_ports
@env[:ui].info(I18n.t(
'vagrant.actions.vm.forward_ports.forwarding_entry',
- message_attributes
+ **message_attributes
))
if fp[:protocol] == 'udp'

View File

@ -0,0 +1,31 @@
From a3d8ecf5cf987e456d0a8398788f4c2b145ea7f4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= <dcermak@suse.com>
Date: Fri, 3 Dec 2021 08:54:27 +0100
Subject: [PATCH] Allow the connection.client.libversion call
When the tests are executed and rsync is not installed on the machine executing
the tests, then vagrant-libvirt will automatically fallback to virtiofs or
9p. Both of these perform the following call to check the libvirt version:
libvirt_version = machine.provider.driver.connection.client.libversion
However, this mock was not setup and thus those tests would fail.
This fixes https://github.com/vagrant-libvirt/vagrant-libvirt/issues/1415
---
spec/unit/action_spec.rb | 2 ++
1 file changed, 2 insertions(+)
diff --git a/spec/unit/action_spec.rb b/spec/unit/action_spec.rb
index 18e31fdf..0eac0636 100644
--- a/spec/unit/action_spec.rb
+++ b/spec/unit/action_spec.rb
@@ -27,6 +27,8 @@
allow(logger).to receive(:info)
allow(logger).to receive(:debug)
allow(logger).to receive(:error)
+
+ allow(connection.client).to receive(:libversion).and_return(6_002_000)
end
def allow_action_env_result(action, *responses)

View File

@ -0,0 +1,278 @@
From 3a465ab12ae806788b0d94dff1eee8c67677ad1c Mon Sep 17 00:00:00 2001
From: Darragh Bailey <daragh.bailey@gmail.com>
Date: Sat, 11 Dec 2021 12:51:25 +0000
Subject: [PATCH 1/2] Reduce patching for distro default session use
Reduce the patching needed should a distro wish to switch the default
from using the system connection by default to using a session
connection by default.
Should now only require patching the default value and a single test
checking the defaults.
---
spec/unit/action/create_domain_spec.rb | 15 +++---
spec/unit/action/create_domain_volume_spec.rb | 8 ++--
spec/unit/action/wait_till_up_spec.rb | 2 +
spec/unit/config_spec.rb | 48 ++++++++++---------
4 files changed, 41 insertions(+), 32 deletions(-)
diff --git a/spec/unit/action/create_domain_spec.rb b/spec/unit/action/create_domain_spec.rb
index 27a5b8b9..c1439665 100644
--- a/spec/unit/action/create_domain_spec.rb
+++ b/spec/unit/action/create_domain_spec.rb
@@ -4,6 +4,8 @@
require 'support/sharedcontext'
require 'support/libvirt_context'
+require 'fog/libvirt/models/compute/volume'
+
require 'vagrant-libvirt/errors'
require 'vagrant-libvirt/util/byte_number'
require 'vagrant-libvirt/action/create_domain'
@@ -14,10 +16,9 @@
include_context 'unit'
include_context 'libvirt'
- let(:libvirt_client) { double('libvirt_client') }
let(:servers) { double('servers') }
let(:volumes) { double('volumes') }
- let(:domain_volume) { double('domain_volume') }
+ let(:domain_volume) { instance_double(::Fog::Libvirt::Compute::Volume) }
let(:domain_xml) { File.read(File.join(File.dirname(__FILE__), File.basename(__FILE__, '.rb'), domain_xml_file)) }
let(:storage_pool_xml) { File.read(File.join(File.dirname(__FILE__), File.basename(__FILE__, '.rb'), storage_pool_xml_file)) }
@@ -57,6 +58,10 @@
context 'connection => qemu:///system' do
let(:domain_xml_file) { 'default_domain.xml' }
+ before do
+ allow(machine.provider_config).to receive(:qemu_use_session).and_return(false)
+ end
+
context 'default pool' do
it 'should execute correctly' do
expect(servers).to receive(:create).with(xml: domain_xml).and_return(machine)
@@ -137,10 +142,8 @@
end
context 'connection => qemu:///session' do
- let(:vagrantfile_providerconfig) do
- <<-EOF
- libvirt.qemu_use_session = true
- EOF
+ before do
+ allow(machine.provider_config).to receive(:qemu_use_session).and_return(true)
end
context 'default pool' do
diff --git a/spec/unit/action/create_domain_volume_spec.rb b/spec/unit/action/create_domain_volume_spec.rb
index 03a07108..54766872 100644
--- a/spec/unit/action/create_domain_volume_spec.rb
+++ b/spec/unit/action/create_domain_volume_spec.rb
@@ -4,6 +4,8 @@
require 'support/sharedcontext'
require 'support/libvirt_context'
+require 'fog/libvirt/models/compute/volume'
+
require 'vagrant-libvirt/action/destroy_domain'
require 'vagrant-libvirt/util/byte_number'
@@ -14,11 +16,9 @@
include_context 'unit'
include_context 'libvirt'
- let(:libvirt_domain) { double('libvirt_domain') }
- let(:libvirt_client) { double('libvirt_client') }
let(:volumes) { double('volumes') }
let(:all) { double('all') }
- let(:box_volume) { double('box_volume') }
+ let(:box_volume) { instance_double(::Fog::Libvirt::Compute::Volume) }
def read_test_file(name)
File.read(File.join(File.dirname(__FILE__), File.basename(__FILE__, '.rb'), name))
@@ -35,6 +35,8 @@ def read_test_file(name)
allow(box_volume).to receive(:id).and_return(nil)
env[:domain_name] = 'test'
+ allow(machine.provider_config).to receive(:qemu_use_session).and_return(false)
+
allow(logger).to receive(:debug)
end
diff --git a/spec/unit/action/wait_till_up_spec.rb b/spec/unit/action/wait_till_up_spec.rb
index 7e697379..61783142 100644
--- a/spec/unit/action/wait_till_up_spec.rb
+++ b/spec/unit/action/wait_till_up_spec.rb
@@ -24,6 +24,8 @@
allow(driver).to receive(:state).and_return(:running)
# return some information for domain when needed
allow(domain).to receive(:mac).and_return('9C:D5:53:F1:5A:E7')
+
+ allow(machine.provider_config).to receive(:qemu_use_session).and_return(false)
end
context 'when machine does not exist' do
diff --git a/spec/unit/config_spec.rb b/spec/unit/config_spec.rb
index bc5bd1bd..36ab7c09 100644
--- a/spec/unit/config_spec.rb
+++ b/spec/unit/config_spec.rb
@@ -171,55 +171,55 @@
# ignore LIBVIRT_DEFAULT_URI due to explicit settings
[ # when uri explicitly set
{:uri => 'qemu:///system'},
- {:uri => 'qemu:///system'},
+ {:uri => %r{qemu:///(system|session)}},
{
- :env => {'LIBVIRT_DEFAULT_URI' => 'qemu://session'},
+ :env => {'LIBVIRT_DEFAULT_URI' => 'qemu:///custom'},
}
],
[ # when host explicitly set
{:host => 'remote'},
- {:uri => 'qemu://remote/system'},
+ {:uri => %r{qemu://remote/(system|session)}},
{
- :env => {'LIBVIRT_DEFAULT_URI' => 'qemu://session'},
+ :env => {'LIBVIRT_DEFAULT_URI' => 'qemu:///custom'},
}
],
[ # when connect_via_ssh explicitly set
{:connect_via_ssh => true},
- {:uri => 'qemu+ssh://localhost/system?no_verify=1'},
+ {:uri => %r{qemu\+ssh://localhost/(system|session)\?no_verify=1}},
{
- :env => {'LIBVIRT_DEFAULT_URI' => 'qemu://session'},
+ :env => {'LIBVIRT_DEFAULT_URI' => 'qemu:///custom'},
}
],
[ # when username explicitly set without ssh
{:username => 'my_user' },
- {:uri => 'qemu:///system', :username => 'my_user'},
+ {:uri => %r{qemu:///(system|session)}, :username => 'my_user'},
{
- :env => {'LIBVIRT_DEFAULT_URI' => 'qemu://session'},
+ :env => {'LIBVIRT_DEFAULT_URI' => 'qemu:///custom'},
}
],
[ # when username explicitly set with host but without ssh
{:username => 'my_user', :host => 'remote'},
- {:uri => 'qemu://remote/system', :username => 'my_user'},
+ {:uri => %r{qemu://remote/(system|session)}, :username => 'my_user'},
{
- :env => {'LIBVIRT_DEFAULT_URI' => 'qemu://session'},
+ :env => {'LIBVIRT_DEFAULT_URI' => 'qemu:///custom'},
}
],
[ # when password explicitly set
{:password => 'some_password'},
- {:uri => 'qemu:///system', :password => 'some_password'},
+ {:uri => %r{qemu:///(system|session)}, :password => 'some_password'},
{
- :env => {'LIBVIRT_DEFAULT_URI' => 'qemu://session'},
+ :env => {'LIBVIRT_DEFAULT_URI' => 'qemu:///custom'},
}
],
# driver settings
[ # set to kvm only
{:driver => 'kvm'},
- {:uri => "qemu:///system"},
+ {:uri => %r{qemu:///(system|session)}},
],
[ # set to qemu only
{:driver => 'qemu'},
- {:uri => "qemu:///system"},
+ {:uri => %r{qemu:///(system|session)}},
],
[ # set to qemu with session enabled
{:driver => 'qemu', :qemu_use_session => true},
@@ -241,29 +241,29 @@
# connect_via_ssh settings
[ # enabled
{:connect_via_ssh => true},
- {:uri => "qemu+ssh://localhost/system?no_verify=1"},
+ {:uri => %r{qemu\+ssh://localhost/(system|session)\?no_verify=1}},
],
[ # enabled with user
{:connect_via_ssh => true, :username => 'my_user'},
- {:uri => "qemu+ssh://my_user@localhost/system?no_verify=1"},
+ {:uri => %r{qemu\+ssh://my_user@localhost/(system|session)\?no_verify=1}},
],
[ # enabled with host
{:connect_via_ssh => true, :host => 'remote_server'},
- {:uri => "qemu+ssh://remote_server/system?no_verify=1"},
+ {:uri => %r{qemu\+ssh://remote_server/(system|session)\?no_verify=1}},
],
# id_ssh_key_file behaviour
[ # set should take given value
{:connect_via_ssh => true, :id_ssh_key_file => '/path/to/keyfile'},
- {:uri => 'qemu+ssh://localhost/system?no_verify=1&keyfile=/path/to/keyfile', :connect_via_ssh => true},
+ {:uri => %r{qemu\+ssh://localhost/(system|session)\?no_verify=1&keyfile=/path/to/keyfile}, :connect_via_ssh => true},
],
[ # set should infer use of ssh
{:id_ssh_key_file => '/path/to/keyfile'},
- {:uri => 'qemu+ssh://localhost/system?no_verify=1&keyfile=/path/to/keyfile', :connect_via_ssh => true},
+ {:uri => %r{qemu\+ssh://localhost/(system|session)\?no_verify=1&keyfile=/path/to/keyfile}, :connect_via_ssh => true},
],
[ # connect_via_ssh should enable default but ignore due to not existing
{:connect_via_ssh => true},
- {:uri => 'qemu+ssh://localhost/system?no_verify=1', :id_ssh_key_file => nil},
+ {:uri => %r{qemu\+ssh://localhost/(system|session)\?no_verify=1}, :id_ssh_key_file => nil},
{
:setup => ProcWithBinding.new {
expect(File).to receive(:file?).with("/home/tests/.ssh/id_rsa").and_return(false)
@@ -272,7 +272,7 @@
],
[ # connect_via_ssh should enable default and include due to existing
{:connect_via_ssh => true},
- {:uri => 'qemu+ssh://localhost/system?no_verify=1&keyfile=/home/tests/.ssh/id_rsa', :id_ssh_key_file => '/home/tests/.ssh/id_rsa'},
+ {:uri => %r{qemu\+ssh://localhost/(system|session)\?no_verify=1&keyfile=/home/tests/\.ssh/id_rsa}, :id_ssh_key_file => '/home/tests/.ssh/id_rsa'},
{
:setup => ProcWithBinding.new {
expect(File).to receive(:file?).with("/home/tests/.ssh/id_rsa").and_return(true)
@@ -283,7 +283,7 @@
# socket behaviour
[ # set
{:socket => '/var/run/libvirt/libvirt-sock'},
- {:uri => "qemu:///system?socket=/var/run/libvirt/libvirt-sock"},
+ {:uri => %r{qemu:///(system|session)\?socket=/var/run/libvirt/libvirt-sock}},
],
].each do |inputs, outputs, options|
opts = {}
@@ -317,7 +317,9 @@
hash["#{name.to_s[1..-1]}".to_sym] =subject.instance_variable_get(name)
end
end
- expect(got).to eq(outputs)
+
+ outputs.transform_values! { |v| v.is_a?(Regexp) ? a_string_matching(v) : v }
+ expect(got).to match(outputs)
end
end
From d3bcbe0837e9fd9a77ced1bc51009df4b84ca62e Mon Sep 17 00:00:00 2001
From: Darragh Bailey <daragh.bailey@gmail.com>
Date: Sat, 11 Dec 2021 14:42:00 +0000
Subject: [PATCH 2/2] remain compatible with older vagrant/rubies
---
spec/unit/config_spec.rb | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/spec/unit/config_spec.rb b/spec/unit/config_spec.rb
index 36ab7c09..4be26a4b 100644
--- a/spec/unit/config_spec.rb
+++ b/spec/unit/config_spec.rb
@@ -318,8 +318,7 @@
end
end
- outputs.transform_values! { |v| v.is_a?(Regexp) ? a_string_matching(v) : v }
- expect(got).to match(outputs)
+ expect(got).to match(outputs.inject({}) { |h, (k, v)| h[k] = v.is_a?(Regexp) ? a_string_matching(v) : v; h })
end
end

View File

@ -1,24 +1,28 @@
%global vagrant_plugin_name vagrant-libvirt
%global vagrant_spec_commit b6b56c8b81351ee38e1dd58900591da566aab98c
%global vagrant_spec_commit 03d88fe2467716b072951c2b55d78223130851a6
Name: %{vagrant_plugin_name}
Version: 0.4.1
Release: 3%{?dist}
Version: 0.7.0
Release: 1%{?dist}
Summary: libvirt provider for Vagrant
License: MIT
URL: https://github.com/vagrant-libvirt/vagrant-libvirt
Source0: https://rubygems.org/gems/%{vagrant_plugin_name}-%{version}.gem
# The library has no official release yet. But since it is just test
# dependency, it should be fine to include the source right here.
# wget https://github.com/mitchellh/vagrant-spec/archive/b6b56c8b81351ee38e1dd58900591da566aab98c/vagrant-spec-b6b56c8b81351ee38e1dd58900591da566aab98c.tar.gz
# wget https://github.com/mitchellh/vagrant-spec/archive/03d88fe2467716b072951c2b55d78223130851a6/vagrant-spec-03d88fe2467716b072951c2b55d78223130851a6.tar.gz
Source2: https://github.com/mitchellh/vagrant-spec/archive/%{vagrant_spec_commit}/vagrant-spec-%{vagrant_spec_commit}.tar.gz
# Allow the connection.client.libversion call
# https://github.com/vagrant-libvirt/vagrant-libvirt/pull/1416
Patch0: vagrant-libvirt-0.7.0-Allow-the-connection.client.libversion-call.patch
# Reduce patching for distro default session use
# https://github.com/vagrant-libvirt/vagrant-libvirt/pull/1424
Patch1: vagrant-libvirt-0.7.0-Reduce-patching-for-distro-default-session-use.patch
# Enable QEMU Session by default
# https://github.com/vagrant-libvirt/vagrant-libvirt/pull/969
Patch0: vagrant-libvirt-0.0.45-enable-qemu-session-by-default.patch
# Fix forward_ports with ruby 3.0
# https://github.com/vagrant-libvirt/vagrant-libvirt/pull/1242
Patch1: vagrant-libvirt-0.4.1-Fix-forward_ports-with-ruby-3.0.patch
Patch100: vagrant-libvirt-0.0.45-enable-qemu-session-by-default.patch
Requires: ruby(release)
Requires: ruby(rubygems)
@ -37,6 +41,7 @@ BuildRequires: rubygem(fog-libvirt)
BuildRequires: rubygem(thor)
BuildRequires: rubygem(rexml)
BuildRequires: rubygems-devel
BuildRequires: %{_bindir}/ps
BuildArch: noarch
Provides: vagrant(%{vagrant_plugin_name}) = %{version}
@ -55,12 +60,9 @@ Documentation for %{name}.
%prep
%setup -q -n %{vagrant_plugin_name}-%{version} -b 2
# Rexml needs to be required since Ruby 3.0.
# https://github.com/vagrant-libvirt/vagrant-libvirt/pull/1277
%gemspec_add_dep -g rexml -s ../%{vagrant_plugin_name}-%{version}.gemspec
%patch0 -p1
%patch1 -p1
%patch100 -p1
%build
gem build ../%{vagrant_plugin_name}-%{version}.gemspec
@ -105,8 +107,8 @@ sed -i '/rspec/ s/~>/>=/' %{vagrant_plugin_name}.gemspec
# Disable test that needs libvirt socket:
# > Failed to connect socket to '/var/run/libvirt/libvirt-sock-ro':
# https://github.com/vagrant-libvirt/vagrant-libvirt/issues/1255
sed -i "/^\s*it 'should abort after hitting limit' do$/,/^\s*end$/ s/^/#/g" \
./spec/unit/action/wait_till_up_spec.rb
#sed -i "/^\s*it 'should abort after hitting limit' do$/,/^\s*end$/ s/^/#/g" \
# ./spec/unit/action/wait_till_up_spec.rb
# Suppress deprecation warnings
GEM_PATH=%{vagrant_plugin_dir}:`ruby -e "print Gem.path.join(':')"` \
@ -129,6 +131,10 @@ popd
%{vagrant_plugin_instdir}/spec
%changelog
* Tue Sep 14 2021 Pavel Valena <pvalena@redhat.com> - 0.7.0-1
- Update to vagrant-libvirt 0.7.0.
Resolves: rhbz#1963360
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild