From b9cb3a99c3ce24dbba38af0e4b5c057c65b389a8 Mon Sep 17 00:00:00 2001 From: Pavel Valena Date: May 12 2021 21:00:41 +0000 Subject: Update to vagrant-libvirt 0.4.1 also add dependency on rexml https://github.com/vagrant-libvirt/vagrant-libvirt/pull/1277 Resolves: rhbz#1884945 Resolves: rhbz#1945740 --- diff --git a/.gitignore b/.gitignore index a708826..f49aa13 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -/vagrant-spec-*.tar.gz +/vagrant-spec-*.txz /vagrant-libvirt-*.gem diff --git a/0003-Halt-a-domain-before-packaging-it-as-a-box.patch b/0003-Halt-a-domain-before-packaging-it-as-a-box.patch deleted file mode 100644 index a930f5c..0000000 --- a/0003-Halt-a-domain-before-packaging-it-as-a-box.patch +++ /dev/null @@ -1,40 +0,0 @@ -From ca04bac73760bad69edf14882e89bffac4213349 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Timoth=C3=A9e=20Ravier?= -Date: Tue, 23 Jul 2019 08:46:07 +0200 -Subject: [PATCH 3/3] Halt a domain before packaging it as a box -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Ensure that we do not try to package a currently running domain (which -will lead to hard to debug and strange issues, and is generally not a -good idea). This may happen when creating boxes with Packer. - -Signed-off-by: Timothée Ravier ---- - lib/vagrant-libvirt/action.rb | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/lib/vagrant-libvirt/action.rb b/lib/vagrant-libvirt/action.rb -index 146d339..18b2e7e 100644 ---- a/lib/vagrant-libvirt/action.rb -+++ b/lib/vagrant-libvirt/action.rb -@@ -161,10 +161,14 @@ module VagrantPlugins - end - end - -- # not implemented and looks like not require -+ # Create/package a new Vagrant Box from the current Domain. -+ # This action requires access to the Domain disk image files and will use -+ # virt-sysprep (from libguestfs project) to clean the image, removing -+ # host SSH keys, etc. - def self.action_package - Vagrant::Action::Builder.new.tap do |b| - b.use ConfigValidate -+ b.use action_halt - b.use PackageDomain - end - end --- -2.21.0 - diff --git a/rubygem-vagrant-libvirt-0.1.2-Use-Vagrant-Util-TemplateRenderer-instead-of-Erubis.patch b/rubygem-vagrant-libvirt-0.1.2-Use-Vagrant-Util-TemplateRenderer-instead-of-Erubis.patch deleted file mode 100644 index 5fce516..0000000 --- a/rubygem-vagrant-libvirt-0.1.2-Use-Vagrant-Util-TemplateRenderer-instead-of-Erubis.patch +++ /dev/null @@ -1,47 +0,0 @@ -From e9ae6ae6d3dab6cb3aa563d4668b0ae332e34eaf Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?V=C3=ADt=20Ondruch?= -Date: Tue, 18 Aug 2020 17:49:47 +0200 -Subject: [PATCH] Use Vagrant::Util::TemplateRenderer instead of Erubis. - -Erubis is dead upstream, therefore it is good idea to avoid its usage. - -Also, this allows to drop explicit dependency on Erubis, which is not -specified anywhere and may cause issues when Vagrant changes its -renderer. - -Fixes #1142. ---- - lib/vagrant-libvirt/util/erb_template.rb | 13 ++++++------- - 1 file changed, 6 insertions(+), 7 deletions(-) - -diff --git a/lib/vagrant-libvirt/util/erb_template.rb b/lib/vagrant-libvirt/util/erb_template.rb -index 3bee45ce..3fda7556 100644 ---- a/lib/vagrant-libvirt/util/erb_template.rb -+++ b/lib/vagrant-libvirt/util/erb_template.rb -@@ -1,20 +1,19 @@ --require 'erubis' -- - module VagrantPlugins - module ProviderLibvirt - module Util - module ErbTemplate - # TODO: remove and use nokogiri builder -- # TODO: might be a chance to use vagrant template system according to https://github.com/mitchellh/vagrant/issues/3231 - def to_xml(template_name = nil, data = binding) - erb = template_name || self.class.to_s.split('::').last.downcase -- path = File.join(File.dirname(__FILE__), '..', 'templates', -- "#{erb}.xml.erb") -- template = File.read(path) -+ path = File.join(File.dirname(__FILE__), '..', 'templates') -+ template = "#{erb}.xml" - - # TODO: according to erubis documentation, we should rather use evaluate and forget about - # binding since the template may then change variables values -- Erubis::Eruby.new(template, trim: true).result(data) -+ Vagrant::Util::TemplateRenderer.render_with(:render, template, template_root: path) do |renderer| -+ iv = data.eval ("instance_variables.collect {|i| [i, instance_variable_get(i.to_sym)]}") -+ iv.each {|k, v| renderer.instance_variable_set(k, v)} -+ end - end - end - end diff --git a/sources b/sources index 4124c7f..de5f93f 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (vagrant-libvirt-0.1.2.gem) = 14f37085f1aa24d697a3574eec31bba64df832331dadda9ceb2e7b6a2373b9ab5c30edf9a15482a39c087b97d0a6e0130f6f8ff3aff75cd5d41036ba0fb8c6a6 -SHA512 (vagrant-spec-148cb63d6d06a767dfaa6bcc7eecc3fb2137112e.tar.gz) = 030d3fea94f019cc2f532996515d8215e13ec90b91702a05e49526617dec8fe4f74e441a92b8328bbe94de0e346845e9282227e99b0ac4bffb174650abc66136 +SHA512 (vagrant-libvirt-0.4.1.gem) = d81196eaa891e429a4ac539b8a0c7074855274627ba1cee54ceafc09969ff604cd208723a1b97d343644a15dbd86b046b579159a3d01c893379ab3e77cb7a237 +SHA512 (vagrant-spec-b6b56c8b81351ee38e1dd58900591da566aab98c.tar.gz) = 7df1fa329190114b69356de8917cccdfe34a06ffab888268144cd6ddf6c44a5c29435e6137dc6b179b99dbd9e71f8d76e127ac504b60629288b200f9bef46516 diff --git a/vagrant-libvirt-0.0.45-enable-qemu-session-by-default.patch b/vagrant-libvirt-0.0.45-enable-qemu-session-by-default.patch index a84c093..db2815b 100644 --- a/vagrant-libvirt-0.0.45-enable-qemu-session-by-default.patch +++ b/vagrant-libvirt-0.0.45-enable-qemu-session-by-default.patch @@ -1,25 +1,216 @@ -From a6d5d4df918b040a0a1906b26abf20fc3bab1690 Mon Sep 17 00:00:00 2001 +From aeeda2b48749eec6ca6158b57928cfc1e94767ca Mon Sep 17 00:00:00 2001 From: Pavel Valena -Date: Wed, 6 Feb 2019 13:29:01 +0100 +Date: Wed, 21 Oct 2020 04:18:08 +0200 Subject: [PATCH] Enable QEMU Session by default sets default for `@qemu_use_session` to true. --- - lib/vagrant-libvirt/config.rb | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vagrant-libvirt/config.rb b/lib/vagrant-libvirt/config.rb -index b8c3f37..928c40d 100644 +index 4861a4d..71bb909 100644 --- a/lib/vagrant-libvirt/config.rb +++ b/lib/vagrant-libvirt/config.rb -@@ -691,7 +691,7 @@ module VagrantPlugins - @management_network_domain = nil if @management_network_domain == UNSET_VALUE - @system_uri = 'qemu:///system' if @system_uri == UNSET_VALUE +@@ -762,9 +762,9 @@ module VagrantPlugins + @socket = nil if @socket == UNSET_VALUE + + # If uri isn't set then let's build one from various sources. +- # Default to passing false for qemu_use_session if it's not set. ++ # Default to passing true for qemu_use_session if it's not set. + if @uri == UNSET_VALUE +- @uri = _generate_uri(@qemu_use_session == UNSET_VALUE ? false : @qemu_use_session) ++ @uri = _generate_uri(@qemu_use_session == UNSET_VALUE ? true : @qemu_use_session) + end + + finalize_from_uri +From 30e4f77d16dc7237ba1947c84d37cfd5a39e5071 Mon Sep 17 00:00:00 2001 +From: Pavel Valena +Date: Wed, 21 Apr 2021 15:47:07 +0200 +Subject: [PATCH] Set qemu://session as default in tests. + +--- + unit/action/create_domain_spec.rb | 3 +- + unit/config_spec.rb | 48 +++++++++++++++---------------- + 2 files changed, 26 insertions(+), 25 deletions(-) + +diff --git a/spec/unit/action/create_domain_spec.rb b/spec/unit/action/create_domain_spec.rb +index d85d676..3934390 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 +diff --git a/spec/unit/config_spec.rb b/spec/unit/config_spec.rb +index e0e53ea..79fe77c 100644 +--- a/spec/unit/config_spec.rb ++++ b/spec/unit/config_spec.rb +@@ -72,13 +72,13 @@ describe VagrantPlugins::ProviderLibvirt::Config do + # settings + [ # all default + {}, +- {:uri => "qemu:///system"}, ++ {:uri => "qemu:///session"}, + ], + + # 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"}, + } + ], -- @qemu_use_session = false if @qemu_use_session == UNSET_VALUE -+ @qemu_use_session = true if @qemu_use_session == UNSET_VALUE + # 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"}, + ], - # generate a URI if none is supplied - @uri = _generate_uri if @uri == UNSET_VALUE + # 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.25.0 +2.30.0 diff --git a/vagrant-libvirt.spec b/vagrant-libvirt.spec index 2d65b62..1db3374 100644 --- a/vagrant-libvirt.spec +++ b/vagrant-libvirt.spec @@ -1,32 +1,27 @@ %global vagrant_plugin_name vagrant-libvirt -%global vagrant_spec_commit 148cb63d6d06a767dfaa6bcc7eecc3fb2137112e +%global vagrant_spec_commit b6b56c8b81351ee38e1dd58900591da566aab98c Name: %{vagrant_plugin_name} -Version: 0.1.2 -Release: 3%{?dist} +Version: 0.4.1 +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/148cb63d6d06a767dfaa6bcc7eecc3fb2137112e/vagrant-spec-148cb63d6d06a767dfaa6bcc7eecc3fb2137112e.tar.gz +# wget https://github.com/mitchellh/vagrant-spec/archive/b6b56c8b81351ee38e1dd58900591da566aab98c/vagrant-spec-b6b56c8b81351ee38e1dd58900591da566aab98c.tar.gz Source2: https://github.com/mitchellh/vagrant-spec/archive/%{vagrant_spec_commit}/vagrant-spec-%{vagrant_spec_commit}.tar.gz # 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 -# Halt a domain before packaging it as a box to avoid hard to debug issues. -# https://github.com/vagrant-libvirt/vagrant-libvirt/pull/1034. -Patch3: 0003-Halt-a-domain-before-packaging-it-as-a-box.patch -# Drop dependency on Erubis. -# https://github.com/vagrant-libvirt/vagrant-libvirt/pull/1144 -Patch4: rubygem-vagrant-libvirt-0.1.2-Use-Vagrant-Util-TemplateRenderer-instead-of-Erubis.patch Requires: ruby(release) Requires: ruby(rubygems) Requires: rubygem(fog-libvirt) >= 0.3.0 Requires: rubygem(nokogiri) >= 1.6 +Requires: rubygem(rexml) # Vagrant changed packaging scriptlets in version 1.9.1. Requires: vagrant >= 1.9.1 # Required by "vagrant package" command (rhbz#1292217). @@ -37,6 +32,7 @@ BuildRequires: rubygem(rdoc) BuildRequires: rubygem(rspec) BuildRequires: rubygem(fog-libvirt) BuildRequires: rubygem(thor) +BuildRequires: rubygem(rexml) BuildRequires: rubygems-devel BuildArch: noarch Provides: vagrant(%{vagrant_plugin_name}) = %{version} @@ -56,9 +52,11 @@ 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 -%patch3 -p1 -%patch4 -p1 %build gem build ../%{vagrant_plugin_name}-%{version}.gemspec @@ -75,11 +73,6 @@ pushd ../vagrant-spec-%{vagrant_spec_commit} # Remove the git reference, which is useless in our case. sed -i '/git/ s/^/#/' vagrant-spec.gemspec -# Relax the Childprocess dependency, since Fedora currently ships with different version -# https://src.fedoraproject.org/rpms/rubygem-childprocess/pull-request/1 -%gemspec_remove_dep -s vagrant-spec.gemspec -g childprocess '~> 3.0.0' -%gemspec_add_dep -s vagrant-spec.gemspec -g childprocess '>= 0.6.0' - # Relax the dependencies, since Fedora ships with newer versions. sed -i '/thor/ s/~>/>=/' vagrant-spec.gemspec sed -i '/rspec/ s/~>/>=/' vagrant-spec.gemspec @@ -93,18 +86,28 @@ pushd .%{vagrant_plugin_instdir} cat > Gemfile < '%{_builddir}/vagrant-spec-%{vagrant_spec_commit}' gemspec EOG # We don't care about code coverage. -sed -i '/[cC]overalls/ s/^/#/' spec/spec_helper.rb +sed -i '/require .simplecov./ s/^/#/' spec/spec_helper.rb +sed -i '/SimpleCov/,/^end/ s/^/#/' spec/spec_helper.rb +sed -i '/simplecov/ s/^/#/' %{vagrant_plugin_name}.gemspec # Relax developement rspec dependency 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 + # Suppress deprecation warnings GEM_PATH=%{vagrant_plugin_dir}:`ruby -e "print Gem.path.join(':')"` \ bundle exec rspec spec + popd %files @@ -122,6 +125,10 @@ popd %{vagrant_plugin_instdir}/spec %changelog +* Fri Apr 16 2021 Pavel Valena - 0.4.1-1 +- Update to vagrant-libvirt 0.4.1. + Resolves: rhbz#1884945 + * Wed Jan 27 2021 Fedora Release Engineering - 0.1.2-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild