From d21060073e838d2528508c94f6758cb14092cd60 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 29 Jul 2020 13:31:21 +0000 Subject: [PATCH 01/31] - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- vagrant-libvirt.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vagrant-libvirt.spec b/vagrant-libvirt.spec index 544b799..9ec194a 100644 --- a/vagrant-libvirt.spec +++ b/vagrant-libvirt.spec @@ -4,7 +4,7 @@ Name: %{vagrant_plugin_name} Version: 0.0.45 -Release: 4%{?dist} +Release: 5%{?dist} Summary: libvirt provider for Vagrant License: MIT URL: https://github.com/vagrant-libvirt/vagrant-libvirt @@ -132,6 +132,9 @@ popd %{vagrant_plugin_instdir}/vagrant-libvirt.gemspec %changelog +* Wed Jul 29 2020 Fedora Release Engineering - 0.0.45-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + * Fri Jan 31 2020 Fedora Release Engineering - 0.0.45-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild From 3992e36a99971b8ac725617941a9246c3fe789c1 Mon Sep 17 00:00:00 2001 From: Pavel Valena Date: Fri, 15 May 2020 18:38:30 +0200 Subject: [PATCH 02/31] Update to vagrant-libvirt 0.1.2. also enhance spec readability. Resolves: rhbz#1833807 --- ...g-of-virt-sysprep-behaviour-on-packa.patch | 78 ------------------- ...ain-environment-variable-value-in-pa.patch | 27 ------- sources | 4 +- ....0.45-enable-qemu-session-by-default.patch | 8 +- vagrant-libvirt.spec | 48 +++++------- 5 files changed, 26 insertions(+), 139 deletions(-) delete mode 100644 0001-Allow-customizing-of-virt-sysprep-behaviour-on-packa.patch delete mode 100644 0002-Use-fetch-to-obtain-environment-variable-value-in-pa.patch diff --git a/0001-Allow-customizing-of-virt-sysprep-behaviour-on-packa.patch b/0001-Allow-customizing-of-virt-sysprep-behaviour-on-packa.patch deleted file mode 100644 index 3d1a121..0000000 --- a/0001-Allow-customizing-of-virt-sysprep-behaviour-on-packa.patch +++ /dev/null @@ -1,78 +0,0 @@ -From 112958974d97dd58af9ee06d157461ebb53f81ae Mon Sep 17 00:00:00 2001 -From: "Zak B. Elep" -Date: Wed, 27 Feb 2019 20:32:37 +0800 -Subject: [PATCH 1/3] Allow customizing of virt-sysprep behaviour on package - (#955) - -Support `vagrant package` of e.g. bento-derived boxes that require SSH -hostkeys already set (as in the case of bento/debian-7 and above,) as -well as leave existing LVM UUIDs untouched (e.g. in bento/ubuntu-18.04.) - -Instead of hard-coding sysprep operations, use an environment variable -to set these instead. - -Use the Chef bento use case as an example for customizing sysprep -operations. ---- - README.md | 23 ++++++++++++++++++++ - lib/vagrant-libvirt/action/package_domain.rb | 3 ++- - 2 files changed, 25 insertions(+), 1 deletion(-) - -diff --git a/README.md b/README.md -index 0a49240..9f08be7 100644 ---- a/README.md -+++ b/README.md -@@ -51,6 +51,7 @@ can help a lot :-) - - [Customized Graphics](#customized-graphics) - - [Box Format](#box-format) - - [Create Box](#create-box) -+- [Package Box from VM](#package-box-from-vm) - - [Development](#development) - - [Contributing](#contributing) - -@@ -1398,6 +1399,28 @@ $ cd packer-qemu-templates - $ packer build ubuntu-14.04-server-amd64-vagrant.json - ``` - -+## Package Box from VM -+ -+vagrant-libvirt has native support for [`vagrant -+package`](https://www.vagrantup.com/docs/cli/package.html) via -+libguestfs [virt-sysprep](http://libguestfs.org/virt-sysprep.1.html). -+virt-sysprep operations can be customized via the -+`VAGRANT_LIBVIRT_VIRT_SYSPREP_OPERATIONS` environment variable; see the -+[upstream -+documentation](http://libguestfs.org/virt-sysprep.1.html#operations) for -+further details especially on default sysprep operations enabled for -+your system. -+ -+For example, on Chef [bento](https://github.com/chef/bento) VMs that -+require SSH hostkeys already set (e.g. bento/debian-7) as well as leave -+existing LVM UUIDs untouched (e.g. bento/ubuntu-18.04), these can be -+packaged into vagrant-libvirt boxes like so: -+ -+```shell -+$ export VAGRANT_LIBVIRT_VIRT_SYSPREP_OPERATIONS="defaults,-ssh-userdir,-ssh-hostkeys,-lvm-uuids" -+$ vagrant package -+``` -+ - ## Development - - To work on the `vagrant-libvirt` plugin, clone this repository out, and use -diff --git a/lib/vagrant-libvirt/action/package_domain.rb b/lib/vagrant-libvirt/action/package_domain.rb -index 94d3199..78b1261 100644 ---- a/lib/vagrant-libvirt/action/package_domain.rb -+++ b/lib/vagrant-libvirt/action/package_domain.rb -@@ -38,7 +38,8 @@ module VagrantPlugins - `qemu-img rebase -p -b "" #{@tmp_img}` - # remove hw association with interface - # working for centos with lvs default disks -- `virt-sysprep --no-logfile --operations defaults,-ssh-userdir -a #{@tmp_img}` -+ operations = ENV.get('VAGRANT_LIBVIRT_VIRT_SYSPREP_OPERATIONS', 'defaults,-ssh-userdir') -+ `virt-sysprep --no-logfile --operations #{operations} -a #{@tmp_img}` - # add any user provided file - extra = '' - @tmp_include = @tmp_dir + '/_include' --- -2.21.0 - diff --git a/0002-Use-fetch-to-obtain-environment-variable-value-in-pa.patch b/0002-Use-fetch-to-obtain-environment-variable-value-in-pa.patch deleted file mode 100644 index b2bf5d5..0000000 --- a/0002-Use-fetch-to-obtain-environment-variable-value-in-pa.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 1226f69a2d77aa67bda877bfc601ef38ce7eb1d2 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Tadej=20Jane=C5=BE?= -Date: Tue, 13 Aug 2019 13:06:19 +0200 -Subject: [PATCH 2/3] Use fetch to obtain environment variable value in - package_domain (#1035) - -ENV is a Ruby Hash which doesn't have a get method but the fetch method. ---- - lib/vagrant-libvirt/action/package_domain.rb | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/lib/vagrant-libvirt/action/package_domain.rb b/lib/vagrant-libvirt/action/package_domain.rb -index 78b1261..705676b 100644 ---- a/lib/vagrant-libvirt/action/package_domain.rb -+++ b/lib/vagrant-libvirt/action/package_domain.rb -@@ -38,7 +38,7 @@ module VagrantPlugins - `qemu-img rebase -p -b "" #{@tmp_img}` - # remove hw association with interface - # working for centos with lvs default disks -- operations = ENV.get('VAGRANT_LIBVIRT_VIRT_SYSPREP_OPERATIONS', 'defaults,-ssh-userdir') -+ operations = ENV.fetch('VAGRANT_LIBVIRT_VIRT_SYSPREP_OPERATIONS', 'defaults,-ssh-userdir') - `virt-sysprep --no-logfile --operations #{operations} -a #{@tmp_img}` - # add any user provided file - extra = '' --- -2.21.0 - diff --git a/sources b/sources index a741854..4124c7f 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (vagrant-libvirt-0.0.45.gem) = 502f0d3576835ee9686c3605166410e15e68449c5cea1fbe6f88e70b945dcc45b92063d5b3678db289734de8ca4f7966cee25347a1c76b41e35bced9930d0016 -SHA512 (vagrant-spec-94a9d31ba18b4130b14da12a2f7b4001c3d2ff12.tar.gz) = b95eefa52c21e1020f3f889fc5a72476a3ffb76f780b0254af85bbbc55465c05081f7c18303caa67843bc959326cbf253b57609faa8187fd89188a2488bfe922 +SHA512 (vagrant-libvirt-0.1.2.gem) = 14f37085f1aa24d697a3574eec31bba64df832331dadda9ceb2e7b6a2373b9ab5c30edf9a15482a39c087b97d0a6e0130f6f8ff3aff75cd5d41036ba0fb8c6a6 +SHA512 (vagrant-spec-148cb63d6d06a767dfaa6bcc7eecc3fb2137112e.tar.gz) = 030d3fea94f019cc2f532996515d8215e13ec90b91702a05e49526617dec8fe4f74e441a92b8328bbe94de0e346845e9282227e99b0ac4bffb174650abc66136 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 b0e5490..a84c093 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 @@ -9,11 +9,11 @@ sets default for `@qemu_use_session` to true. 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vagrant-libvirt/config.rb b/lib/vagrant-libvirt/config.rb -index 2aa1bce..1bc8411 100644 +index b8c3f37..928c40d 100644 --- a/lib/vagrant-libvirt/config.rb +++ b/lib/vagrant-libvirt/config.rb -@@ -651,7 +651,7 @@ def finalize! - @management_network_pci_slot = nil if @management_network_pci_slot == UNSET_VALUE +@@ -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 - @qemu_use_session = false if @qemu_use_session == UNSET_VALUE @@ -21,3 +21,5 @@ index 2aa1bce..1bc8411 100644 # generate a URI if none is supplied @uri = _generate_uri if @uri == UNSET_VALUE +-- +2.25.0 diff --git a/vagrant-libvirt.spec b/vagrant-libvirt.spec index 9ec194a..0e33beb 100644 --- a/vagrant-libvirt.spec +++ b/vagrant-libvirt.spec @@ -1,27 +1,21 @@ %global vagrant_plugin_name vagrant-libvirt -%global vagrant_spec_commit 94a9d31ba18b4130b14da12a2f7b4001c3d2ff12 +%global vagrant_spec_commit 148cb63d6d06a767dfaa6bcc7eecc3fb2137112e Name: %{vagrant_plugin_name} -Version: 0.0.45 -Release: 5%{?dist} +Version: 0.1.2 +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/9bba7e1228379c0a249a06ce76ba8ea7d276afb/vagrant-spec-f1a18fd3e5387328ca83e016e48373aadb67112a.tar.gz +# wget https://github.com/mitchellh/vagrant-spec/archive/148cb63d6d06a767dfaa6bcc7eecc3fb2137112e/vagrant-spec-148cb63d6d06a767dfaa6bcc7eecc3fb2137112e.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 -# Allow customizing of virt-sysprep behaviour on package. -# Backport of https://github.com/vagrant-libvirt/vagrant-libvirt/commit/deb36bef8b6c0b696ea0045563fb5cc0e4895f73. -Patch1: 0001-Allow-customizing-of-virt-sysprep-behaviour-on-packa.patch -# Use fetch to obtain environment variable value in package_domain. -# Backport of https://github.com/vagrant-libvirt/vagrant-libvirt/commit/f8eae9984d7f9f0bcc83fa3082592968487c0fb2. -Patch2: 0002-Use-fetch-to-obtain-environment-variable-value-in-pa.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 @@ -60,14 +54,8 @@ Documentation for %{name}. %setup -q -n %{vagrant_plugin_name}-%{version} -b 2 %patch0 -p1 -%patch1 -p1 -%patch2 -p1 %patch3 -p1 -# Relax fog-core dependency to work with recently rebased one -%gemspec_remove_dep -s ../%{vagrant_plugin_name}-%{version}.gemspec -g fog-core '~> 1.43.0' -%gemspec_add_dep -s ../%{vagrant_plugin_name}-%{version}.gemspec -g fog-core '>= 1.43.0' - %build gem build ../%{vagrant_plugin_name}-%{version}.gemspec %vagrant_plugin_install @@ -85,8 +73,8 @@ 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 '~> 0.6.0' -%gemspec_add_dep -s vagrant-spec.gemspec -g childprocess '>= 0.5.0' +%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 @@ -98,18 +86,21 @@ cp ../%{vagrant_plugin_name}-%{version}.gemspec .%{vagrant_plugin_instdir}/%{vag pushd .%{vagrant_plugin_instdir} # Create dummy Gemfile and load dependencies via gemspec file -echo "gem 'vagrant'" > Gemfile -echo "gem 'rdoc'" >> Gemfile -echo "gem 'vagrant-spec', :path => '%{_builddir}/vagrant-spec-%{vagrant_spec_commit}'" >> Gemfile -echo "gemspec" >> Gemfile - +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 # Relax developement rspec dependency sed -i '/rspec/ s/~>/>=/' %{vagrant_plugin_name}.gemspec -GEM_PATH=%{vagrant_plugin_dir}:`ruby -e "print Gem.path.join(':')"` bundle exec rspec spec +# Suppress deprecation warnings +GEM_PATH=%{vagrant_plugin_dir}:`ruby -e "print Gem.path.join(':')"` \ +bundle exec rspec spec popd %files @@ -118,20 +109,19 @@ popd %license %{vagrant_plugin_instdir}/LICENSE %{vagrant_plugin_libdir} %{vagrant_plugin_instdir}/locales -%{vagrant_plugin_instdir}/tools %exclude %{vagrant_plugin_cache} %{vagrant_plugin_spec} %files doc %doc %{vagrant_plugin_docdir} -%doc %{vagrant_plugin_instdir}/example_box -%{vagrant_plugin_instdir}/Gemfile %doc %{vagrant_plugin_instdir}/README.md -%{vagrant_plugin_instdir}/Rakefile %{vagrant_plugin_instdir}/spec -%{vagrant_plugin_instdir}/vagrant-libvirt.gemspec %changelog +* Fri May 15 2020 Pavel Valena - 0.1.2-1 +- Update to vagrant-libvirt 0.1.2. + Resolves: rhbz#1833807 + * Wed Jul 29 2020 Fedora Release Engineering - 0.0.45-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild From dcfc1c123cab2946c692e3950f762fe173ff36ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Tue, 18 Aug 2020 17:12:39 +0200 Subject: [PATCH 03/31] Keep the changelog dates ordered. This makes RPM happy and corresponds to the day of build instead of day of opening PR. --- vagrant-libvirt.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vagrant-libvirt.spec b/vagrant-libvirt.spec index 0e33beb..6badf0f 100644 --- a/vagrant-libvirt.spec +++ b/vagrant-libvirt.spec @@ -118,7 +118,7 @@ popd %{vagrant_plugin_instdir}/spec %changelog -* Fri May 15 2020 Pavel Valena - 0.1.2-1 +* Thu Aug 06 2020 Pavel Valena - 0.1.2-1 - Update to vagrant-libvirt 0.1.2. Resolves: rhbz#1833807 From fa18e9210824fcb38960978656048ec1a650d7f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Wed, 19 Aug 2020 12:27:52 +0200 Subject: [PATCH 04/31] Drop dependency on Erubis. --- ...l-TemplateRenderer-instead-of-Erubis.patch | 47 +++++++++++++++++++ vagrant-libvirt.spec | 9 +++- 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 rubygem-vagrant-libvirt-0.1.2-Use-Vagrant-Util-TemplateRenderer-instead-of-Erubis.patch 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 new file mode 100644 index 0000000..5fce516 --- /dev/null +++ b/rubygem-vagrant-libvirt-0.1.2-Use-Vagrant-Util-TemplateRenderer-instead-of-Erubis.patch @@ -0,0 +1,47 @@ +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/vagrant-libvirt.spec b/vagrant-libvirt.spec index 6badf0f..6bbf932 100644 --- a/vagrant-libvirt.spec +++ b/vagrant-libvirt.spec @@ -4,7 +4,7 @@ Name: %{vagrant_plugin_name} Version: 0.1.2 -Release: 1%{?dist} +Release: 2%{?dist} Summary: libvirt provider for Vagrant License: MIT URL: https://github.com/vagrant-libvirt/vagrant-libvirt @@ -19,6 +19,9 @@ 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) @@ -55,6 +58,7 @@ Documentation for %{name}. %patch0 -p1 %patch3 -p1 +%patch4 -p1 %build gem build ../%{vagrant_plugin_name}-%{version}.gemspec @@ -118,6 +122,9 @@ popd %{vagrant_plugin_instdir}/spec %changelog +* Tue Aug 18 2020 Vít Ondruch - 0.1.2-2 +- Drop dependency on Erubis. + * Thu Aug 06 2020 Pavel Valena - 0.1.2-1 - Update to vagrant-libvirt 0.1.2. Resolves: rhbz#1833807 From b7aa5f3f9638c20e5d69cb6d287100bdb448b6bd Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 27 Jan 2021 22:52:51 +0000 Subject: [PATCH 05/31] - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- vagrant-libvirt.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vagrant-libvirt.spec b/vagrant-libvirt.spec index 6bbf932..2d65b62 100644 --- a/vagrant-libvirt.spec +++ b/vagrant-libvirt.spec @@ -4,7 +4,7 @@ Name: %{vagrant_plugin_name} Version: 0.1.2 -Release: 2%{?dist} +Release: 3%{?dist} Summary: libvirt provider for Vagrant License: MIT URL: https://github.com/vagrant-libvirt/vagrant-libvirt @@ -122,6 +122,9 @@ popd %{vagrant_plugin_instdir}/spec %changelog +* Wed Jan 27 2021 Fedora Release Engineering - 0.1.2-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + * Tue Aug 18 2020 Vít Ondruch - 0.1.2-2 - Drop dependency on Erubis. From b9cb3a99c3ce24dbba38af0e4b5c057c65b389a8 Mon Sep 17 00:00:00 2001 From: Pavel Valena Date: Wed, 21 Oct 2020 03:37:38 +0200 Subject: [PATCH 06/31] 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 --- .gitignore | 2 +- ...-domain-before-packaging-it-as-a-box.patch | 40 ---- ...l-TemplateRenderer-instead-of-Erubis.patch | 47 ---- sources | 4 +- ....0.45-enable-qemu-session-by-default.patch | 217 ++++++++++++++++-- vagrant-libvirt.spec | 43 ++-- 6 files changed, 232 insertions(+), 121 deletions(-) delete mode 100644 0003-Halt-a-domain-before-packaging-it-as-a-box.patch delete mode 100644 rubygem-vagrant-libvirt-0.1.2-Use-Vagrant-Util-TemplateRenderer-instead-of-Erubis.patch 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 -- @qemu_use_session = false if @qemu_use_session == UNSET_VALUE -+ @qemu_use_session = true if @qemu_use_session == UNSET_VALUE +- context 'connection => qemu:///system' do ++ context 'connection => qemu:///session' do + context 'default pool' do + let(:test_file) { 'default_system_storage_pool.xml' } - # generate a URI if none is supplied - @uri = _generate_uri if @uri == UNSET_VALUE +@@ -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"}, + } + ], + + # 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.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 From e48f6aaf6843637a31fedc303c900c4d7cda0a9c Mon Sep 17 00:00:00 2001 From: Pavel Valena Date: Wed, 12 May 2021 23:47:54 +0200 Subject: [PATCH 07/31] Add missing patch and .gitignore entry. --- .gitignore | 1 + ...Set-qemu-session-as-default-in-tests.patch | 193 ++++++++++++++++++ 2 files changed, 194 insertions(+) create mode 100644 vagrant-libvirt-0.4.1-Set-qemu-session-as-default-in-tests.patch diff --git a/.gitignore b/.gitignore index f49aa13..b790ec9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /vagrant-spec-*.txz /vagrant-libvirt-*.gem +/vagrant-spec-*.tar.gz diff --git a/vagrant-libvirt-0.4.1-Set-qemu-session-as-default-in-tests.patch b/vagrant-libvirt-0.4.1-Set-qemu-session-as-default-in-tests.patch new file mode 100644 index 0000000..9e3cfba --- /dev/null +++ b/vagrant-libvirt-0.4.1-Set-qemu-session-as-default-in-tests.patch @@ -0,0 +1,193 @@ +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"}, + } + ], + + # 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 + From f1d5617da77a99734dbb10296298166254b997bd Mon Sep 17 00:00:00 2001 From: Pavel Valena Date: Fri, 14 May 2021 18:46:26 +0200 Subject: [PATCH 08/31] Remove patch added by mistake, it's content is already included in vagrant-libvirt-0.0.45-enable-qemu-session-by-default.patch --- ...Set-qemu-session-as-default-in-tests.patch | 193 ------------------ 1 file changed, 193 deletions(-) delete mode 100644 vagrant-libvirt-0.4.1-Set-qemu-session-as-default-in-tests.patch diff --git a/vagrant-libvirt-0.4.1-Set-qemu-session-as-default-in-tests.patch b/vagrant-libvirt-0.4.1-Set-qemu-session-as-default-in-tests.patch deleted file mode 100644 index 9e3cfba..0000000 --- a/vagrant-libvirt-0.4.1-Set-qemu-session-as-default-in-tests.patch +++ /dev/null @@ -1,193 +0,0 @@ -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"}, - } - ], - - # 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 - From 169b5c9438525273bd25ec40b3d1175074a5a7bc Mon Sep 17 00:00:00 2001 From: Pavel Valena Date: Mon, 17 May 2021 14:55:33 +0200 Subject: [PATCH 09/31] Fix forward_ports with ruby 3.0. Resolves: rhbz#1947885 --- ....4.1-Fix-forward_ports-with-ruby-3.0.patch | 27 +++++++++++++++++++ vagrant-libvirt.spec | 10 ++++++- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 vagrant-libvirt-0.4.1-Fix-forward_ports-with-ruby-3.0.patch diff --git a/vagrant-libvirt-0.4.1-Fix-forward_ports-with-ruby-3.0.patch b/vagrant-libvirt-0.4.1-Fix-forward_ports-with-ruby-3.0.patch new file mode 100644 index 0000000..036dd81 --- /dev/null +++ b/vagrant-libvirt-0.4.1-Fix-forward_ports-with-ruby-3.0.patch @@ -0,0 +1,27 @@ +From 28d475ca292b289dd9a8bab7180670e4acfe5b6d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= +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' diff --git a/vagrant-libvirt.spec b/vagrant-libvirt.spec index 1db3374..b0ddb57 100644 --- a/vagrant-libvirt.spec +++ b/vagrant-libvirt.spec @@ -4,7 +4,7 @@ Name: %{vagrant_plugin_name} Version: 0.4.1 -Release: 1%{?dist} +Release: 2%{?dist} Summary: libvirt provider for Vagrant License: MIT URL: https://github.com/vagrant-libvirt/vagrant-libvirt @@ -16,6 +16,9 @@ Source2: https://github.com/mitchellh/vagrant-spec/archive/%{vagrant_spec_commit # 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 Requires: ruby(release) Requires: ruby(rubygems) @@ -57,6 +60,7 @@ Documentation for %{name}. %gemspec_add_dep -g rexml -s ../%{vagrant_plugin_name}-%{version}.gemspec %patch0 -p1 +%patch1 -p1 %build gem build ../%{vagrant_plugin_name}-%{version}.gemspec @@ -125,6 +129,10 @@ popd %{vagrant_plugin_instdir}/spec %changelog +* Mon May 17 2021 Pavel Valena - 0.4.1-2 +- Fix forward_ports with ruby 3.0. + Resolves: rhbz#1947885 + * Fri Apr 16 2021 Pavel Valena - 0.4.1-1 - Update to vagrant-libvirt 0.4.1. Resolves: rhbz#1884945 From 9fa7fba36403613cd7f1fb887ea80758f6e26de9 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 23 Jul 2021 20:16:27 +0000 Subject: [PATCH 10/31] - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- vagrant-libvirt.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vagrant-libvirt.spec b/vagrant-libvirt.spec index b0ddb57..a48e568 100644 --- a/vagrant-libvirt.spec +++ b/vagrant-libvirt.spec @@ -4,7 +4,7 @@ Name: %{vagrant_plugin_name} Version: 0.4.1 -Release: 2%{?dist} +Release: 3%{?dist} Summary: libvirt provider for Vagrant License: MIT URL: https://github.com/vagrant-libvirt/vagrant-libvirt @@ -129,6 +129,9 @@ popd %{vagrant_plugin_instdir}/spec %changelog +* Fri Jul 23 2021 Fedora Release Engineering - 0.4.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + * Mon May 17 2021 Pavel Valena - 0.4.1-2 - Fix forward_ports with ruby 3.0. Resolves: rhbz#1947885 From eb118f573ceacb2417eaaced3139e77c69f263b5 Mon Sep 17 00:00:00 2001 From: Pavel Valena Date: Tue, 14 Sep 2021 15:21:56 +0200 Subject: [PATCH 11/31] 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 --- .gitignore | 1 - sources | 4 +- ....0.45-enable-qemu-session-by-default.patch | 195 ++---------- ....4.1-Fix-forward_ports-with-ruby-3.0.patch | 27 -- ...he-connection.client.libversion-call.patch | 31 ++ ...ching-for-distro-default-session-use.patch | 278 ++++++++++++++++++ vagrant-libvirt.spec | 34 ++- 7 files changed, 352 insertions(+), 218 deletions(-) delete mode 100644 vagrant-libvirt-0.4.1-Fix-forward_ports-with-ruby-3.0.patch create mode 100644 vagrant-libvirt-0.7.0-Allow-the-connection.client.libversion-call.patch create mode 100644 vagrant-libvirt-0.7.0-Reduce-patching-for-distro-default-session-use.patch diff --git a/.gitignore b/.gitignore index b790ec9..b81481f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ -/vagrant-spec-*.txz /vagrant-libvirt-*.gem /vagrant-spec-*.tar.gz diff --git a/sources b/sources index de5f93f..cfb8385 100644 --- a/sources +++ b/sources @@ -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 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 db2815b..9d33caf 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 @@ -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 -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 diff --git a/vagrant-libvirt-0.4.1-Fix-forward_ports-with-ruby-3.0.patch b/vagrant-libvirt-0.4.1-Fix-forward_ports-with-ruby-3.0.patch deleted file mode 100644 index 036dd81..0000000 --- a/vagrant-libvirt-0.4.1-Fix-forward_ports-with-ruby-3.0.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 28d475ca292b289dd9a8bab7180670e4acfe5b6d Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= -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' diff --git a/vagrant-libvirt-0.7.0-Allow-the-connection.client.libversion-call.patch b/vagrant-libvirt-0.7.0-Allow-the-connection.client.libversion-call.patch new file mode 100644 index 0000000..3370ac4 --- /dev/null +++ b/vagrant-libvirt-0.7.0-Allow-the-connection.client.libversion-call.patch @@ -0,0 +1,31 @@ +From a3d8ecf5cf987e456d0a8398788f4c2b145ea7f4 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= +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) diff --git a/vagrant-libvirt-0.7.0-Reduce-patching-for-distro-default-session-use.patch b/vagrant-libvirt-0.7.0-Reduce-patching-for-distro-default-session-use.patch new file mode 100644 index 0000000..955c7a0 --- /dev/null +++ b/vagrant-libvirt-0.7.0-Reduce-patching-for-distro-default-session-use.patch @@ -0,0 +1,278 @@ +From 3a465ab12ae806788b0d94dff1eee8c67677ad1c Mon Sep 17 00:00:00 2001 +From: Darragh Bailey +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 +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 + diff --git a/vagrant-libvirt.spec b/vagrant-libvirt.spec index a48e568..ddf39f7 100644 --- a/vagrant-libvirt.spec +++ b/vagrant-libvirt.spec @@ -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 - 0.7.0-1 +- Update to vagrant-libvirt 0.7.0. + Resolves: rhbz#1963360 + * Fri Jul 23 2021 Fedora Release Engineering - 0.4.1-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild From 54aad82274febec084401983d3e9d35954800f5b Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 22 Jan 2022 03:45:38 +0000 Subject: [PATCH 12/31] - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- vagrant-libvirt.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vagrant-libvirt.spec b/vagrant-libvirt.spec index ddf39f7..8d49c72 100644 --- a/vagrant-libvirt.spec +++ b/vagrant-libvirt.spec @@ -4,7 +4,7 @@ Name: %{vagrant_plugin_name} Version: 0.7.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: libvirt provider for Vagrant License: MIT URL: https://github.com/vagrant-libvirt/vagrant-libvirt @@ -131,6 +131,9 @@ popd %{vagrant_plugin_instdir}/spec %changelog +* Sat Jan 22 2022 Fedora Release Engineering - 0.7.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + * Tue Sep 14 2021 Pavel Valena - 0.7.0-1 - Update to vagrant-libvirt 0.7.0. Resolves: rhbz#1963360 From 2c12f9fd865a49fb3da9e3f5f652708a2a255725 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Mon, 11 Apr 2022 14:53:38 +0200 Subject: [PATCH 13/31] Add `BR: rubygem(rake)` to fix FTBFS. This used to be pulled in via `rubygem(rspec-core)`, but it is not anymore: https://src.fedoraproject.org/rpms/rubygem-rspec-core/c/15e3de8d5ccf32c7199d9f39e45d536fa6159a48 --- vagrant-libvirt.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vagrant-libvirt.spec b/vagrant-libvirt.spec index 8d49c72..a9f6846 100644 --- a/vagrant-libvirt.spec +++ b/vagrant-libvirt.spec @@ -4,7 +4,7 @@ Name: %{vagrant_plugin_name} Version: 0.7.0 -Release: 2%{?dist} +Release: 3%{?dist} Summary: libvirt provider for Vagrant License: MIT URL: https://github.com/vagrant-libvirt/vagrant-libvirt @@ -40,6 +40,7 @@ BuildRequires: rubygem(rspec) BuildRequires: rubygem(fog-libvirt) BuildRequires: rubygem(thor) BuildRequires: rubygem(rexml) +BuildRequires: rubygem(rake) BuildRequires: rubygems-devel BuildRequires: %{_bindir}/ps BuildArch: noarch @@ -131,6 +132,9 @@ popd %{vagrant_plugin_instdir}/spec %changelog +* Mon Apr 11 2022 Vít Ondruch - 0.7.0-3 +- Add `BR: rubygem(rake)` to fix FTBFS. + * Sat Jan 22 2022 Fedora Release Engineering - 0.7.0-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild From 42b0ffa0947fe56e72dd48dff2650e3488375ce5 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 23 Jul 2022 11:39:03 +0000 Subject: [PATCH 14/31] Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- vagrant-libvirt.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vagrant-libvirt.spec b/vagrant-libvirt.spec index a9f6846..54f9ec3 100644 --- a/vagrant-libvirt.spec +++ b/vagrant-libvirt.spec @@ -4,7 +4,7 @@ Name: %{vagrant_plugin_name} Version: 0.7.0 -Release: 3%{?dist} +Release: 4%{?dist} Summary: libvirt provider for Vagrant License: MIT URL: https://github.com/vagrant-libvirt/vagrant-libvirt @@ -132,6 +132,9 @@ popd %{vagrant_plugin_instdir}/spec %changelog +* Sat Jul 23 2022 Fedora Release Engineering - 0.7.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + * Mon Apr 11 2022 Vít Ondruch - 0.7.0-3 - Add `BR: rubygem(rake)` to fix FTBFS. From 03b9c0ef9ab7b4e99444b0c40f98244d84c09a05 Mon Sep 17 00:00:00 2001 From: Mamoru TASAKA Date: Fri, 20 Jan 2023 14:23:54 +0900 Subject: [PATCH 15/31] Backport upstream fix for ruby3.2 compatibility (File.exists? removal, URI#parse host name result change) --- ...-pr1709-ruby32-File_exists-URL-parse.patch | 111 ++++++++++++++++++ vagrant-libvirt.spec | 13 +- 2 files changed, 123 insertions(+), 1 deletion(-) create mode 100644 vagrant-libvirt-pr1709-ruby32-File_exists-URL-parse.patch diff --git a/vagrant-libvirt-pr1709-ruby32-File_exists-URL-parse.patch b/vagrant-libvirt-pr1709-ruby32-File_exists-URL-parse.patch new file mode 100644 index 0000000..79e2c38 --- /dev/null +++ b/vagrant-libvirt-pr1709-ruby32-File_exists-URL-parse.patch @@ -0,0 +1,111 @@ +From 517bf7792a4f2d9f7d6062efeec9089e78c5458e Mon Sep 17 00:00:00 2001 +From: Mamoru TASAKA +Date: Thu, 19 Jan 2023 16:39:17 +0900 +Subject: [PATCH 1/2] Replace File.exists? with File.exist? + +File.exists? is deprecated since ruby2.1 and is removed with ruby3.2. +Replace with File.exist? . +--- + spec/support/libvirt_acceptance_context.rb | 2 +- + spec/support/matchers/have_file_content.rb | 2 +- + spec/unit/action/clean_machine_folder_spec.rb | 6 +++--- + 3 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/spec/support/matchers/have_file_content.rb b/spec/support/matchers/have_file_content.rb +index 9970f6b8d..20215180a 100644 +--- a/spec/support/matchers/have_file_content.rb ++++ b/spec/support/matchers/have_file_content.rb +@@ -45,7 +45,7 @@ + # end + RSpec::Matchers.define :have_file_content do |expected| + match do |actual| +- next false unless File.exists?(actual) ++ next false unless File.exist?(actual) + + @actual = File.read(actual).chomp + @expected = if expected.is_a? String +diff --git a/spec/unit/action/clean_machine_folder_spec.rb b/spec/unit/action/clean_machine_folder_spec.rb +index faad98cde..b8ed8acc6 100644 +--- a/spec/unit/action/clean_machine_folder_spec.rb ++++ b/spec/unit/action/clean_machine_folder_spec.rb +@@ -20,7 +20,7 @@ + + expect(subject.call(env)).to be_nil + +- expect(File.exists?(machine.data_dir)).to eq(true) ++ expect(File.exist?(machine.data_dir)).to eq(true) + expect(Dir.entries(machine.data_dir)).to match_array([".", ".."]) + end + end +@@ -38,7 +38,7 @@ + + expect(subject.call(env)).to be_nil + +- expect(File.exists?(machine.data_dir)).to eq(true) ++ expect(File.exist?(machine.data_dir)).to eq(true) + expect(Dir.entries(machine.data_dir)).to match_array([".", ".."]) + end + end +@@ -51,7 +51,7 @@ + + expect(subject.call(env)).to be_nil + +- expect(File.exists?(machine.data_dir)).to eq(true) ++ expect(File.exist?(machine.data_dir)).to eq(true) + expect(Dir.entries(machine.data_dir)).to match_array([".", ".."]) + end + end + +From 578d3ae4296a78c8b276ff2bc5471fa045a61736 Mon Sep 17 00:00:00 2001 +From: Mamoru TASAKA +Date: Thu, 19 Jan 2023 17:07:39 +0900 +Subject: [PATCH 2/2] Set empty host when nil on finalize_from_uri + +With ruby3.2, URI.parse now sets empty host instead of nil via: +https://github.com/ruby/ruby/commit/dd5118f8524c425894d4716b787837ad7380bb0d + +Adjust test case so, also with ruby <= 3.1, forcely set empty string for host +when nil to make finalize_from_uri behavior consistent between different +host ruby versions. +--- + lib/vagrant-libvirt/config.rb | 4 ++-- + spec/unit/config_spec.rb | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/lib/vagrant-libvirt/config.rb b/lib/vagrant-libvirt/config.rb +index 471d40dce..dfaef6167 100644 +--- a/lib/vagrant-libvirt/config.rb ++++ b/lib/vagrant-libvirt/config.rb +@@ -1304,8 +1304,8 @@ def finalize_from_uri + end + end + +- # Extract host values from uri if provided, otherwise nil +- @host = uri.host ++ # Extract host values from uri if provided, otherwise set empty string ++ @host = uri.host || "" + @port = uri.port + # only override username if there is a value provided + @username = nil if @username == UNSET_VALUE +diff --git a/spec/unit/config_spec.rb b/spec/unit/config_spec.rb +index 951b3ce58..f43de4df9 100644 +--- a/spec/unit/config_spec.rb ++++ b/spec/unit/config_spec.rb +@@ -86,7 +86,7 @@ + ], + [ # connect explicit to unix socket + {:uri => "qemu+unix:///system"}, +- {:uri => "qemu+unix:///system", :connect_via_ssh => false, :host => nil, :username => nil}, ++ {:uri => "qemu+unix:///system", :connect_via_ssh => false, :host => "", :username => nil}, + ], + [ # via libssh2 should enable ssh as well + {:uri => "qemu+libssh2://user@remote/system?known_hosts=/home/user/.ssh/known_hosts"}, +@@ -139,7 +139,7 @@ + ], + [ # with session and using ssh infer connect by ssh and ignore host as not provided + {}, +- {:uri => "qemu+ssh:///session", :qemu_use_session => true, :connect_via_ssh => true, :host => nil}, ++ {:uri => "qemu+ssh:///session", :qemu_use_session => true, :connect_via_ssh => true, :host => ""}, + { + :env => {'LIBVIRT_DEFAULT_URI' => "qemu+ssh:///session"}, + } diff --git a/vagrant-libvirt.spec b/vagrant-libvirt.spec index 54f9ec3..a723df5 100644 --- a/vagrant-libvirt.spec +++ b/vagrant-libvirt.spec @@ -4,7 +4,7 @@ Name: %{vagrant_plugin_name} Version: 0.7.0 -Release: 4%{?dist} +Release: 5%{?dist} Summary: libvirt provider for Vagrant License: MIT URL: https://github.com/vagrant-libvirt/vagrant-libvirt @@ -20,6 +20,12 @@ Patch0: vagrant-libvirt-0.7.0-Allow-the-connection.client.libversion-call.patch # https://github.com/vagrant-libvirt/vagrant-libvirt/pull/1424 Patch1: vagrant-libvirt-0.7.0-Reduce-patching-for-distro-default-session-use.patch +# https://github.com/vagrant-libvirt/vagrant-libvirt/pull/1709 +# ruby3.2 fix wrt File.exits? removal and URI.split host result change +# A bit modified: spec/support/libvirt_acceptance_context.rb does not exist +# with 0.7.0 yet +Patch2: vagrant-libvirt-pr1709-ruby32-File_exists-URL-parse.patch + # Enable QEMU Session by default # https://github.com/vagrant-libvirt/vagrant-libvirt/pull/969 Patch100: vagrant-libvirt-0.0.45-enable-qemu-session-by-default.patch @@ -63,6 +69,7 @@ Documentation for %{name}. %patch0 -p1 %patch1 -p1 +%patch2 -p1 %patch100 -p1 %build @@ -132,6 +139,10 @@ popd %{vagrant_plugin_instdir}/spec %changelog +* Fri Jan 20 2023 Mamoru TASAKA - 0.7.0-5 +- Backport upstream fix for ruby3.2 compatibility + (File.exists? removal, URI#parse host name result change) + * Sat Jul 23 2022 Fedora Release Engineering - 0.7.0-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild From 5aa17a63e1c1a7c21fb017cc18193801917737ea Mon Sep 17 00:00:00 2001 From: Bart Kus Date: Sun, 29 Jan 2023 14:48:05 -0800 Subject: [PATCH 16/31] Update to vagrant-libvirt 0.11.2 Should resolve rhbz#2075223 --- sources | 4 +- ....0.45-enable-qemu-session-by-default.patch | 24 +- ...he-connection.client.libversion-call.patch | 31 -- ...ching-for-distro-default-session-use.patch | 278 ------------------ ...-pr1709-ruby32-File_exists-URL-parse.patch | 2 +- vagrant-libvirt.spec | 66 +++-- 6 files changed, 50 insertions(+), 355 deletions(-) delete mode 100644 vagrant-libvirt-0.7.0-Allow-the-connection.client.libversion-call.patch delete mode 100644 vagrant-libvirt-0.7.0-Reduce-patching-for-distro-default-session-use.patch diff --git a/sources b/sources index cfb8385..28d90dc 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (vagrant-libvirt-0.7.0.gem) = d501ce2b65c6df3cc0ac6a831374fb64c7227a930269999592b8ca10f91e2c866aacd9c952c138c442d99d645f39d381f1cbfe21f6c039ad9cd04eb08d494446 -SHA512 (vagrant-spec-03d88fe2467716b072951c2b55d78223130851a6.tar.gz) = 3b062cbec04f98355f939c2bf27d35ddcd2bbe0a0734677832d4a656320b44c64b6284e0877dd55e496055e2b969755e1bdc78225010f75ddaafe8f8c8f78a66 +SHA512 (vagrant-libvirt-0.11.2.gem) = f66be1c8301ad4a9e731cf65c2ea3181f3c5e4c1d252411465060ab8ddabc294beab40e214fa8c9c5a7aa1e116030f60cea2e337121d95123c724ec6e529bfbc +SHA512 (vagrant-spec-259c55e204674f2b006700c6d351d04250d13b04.tar.gz) = 7938a6f8091b7dd76266e63d2cb653820e55a262091be0aaae2f5515321fa4d50301f547ab925771208b8616c7fc819cb642b3b9d444cd7a722ba712538cf68f 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 9d33caf..64ef8bd 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 @@ -33,18 +33,18 @@ Subject: [PATCH] Fix tests. 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 342debf..cb51cf5 100644 ---- a/spec/unit/action/create_domain_spec.rb -+++ b/spec/unit/action/create_domain_spec.rb -@@ -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/action/create_domain_spec.rb b/spec/unit/action/create_domain_spec.rb +#index 342debf..cb51cf5 100644 +#--- a/spec/unit/action/create_domain_spec.rb +#+++ b/spec/unit/action/create_domain_spec.rb +#@@ -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 6f82da1..bd74999 100644 diff --git a/vagrant-libvirt-0.7.0-Allow-the-connection.client.libversion-call.patch b/vagrant-libvirt-0.7.0-Allow-the-connection.client.libversion-call.patch deleted file mode 100644 index 3370ac4..0000000 --- a/vagrant-libvirt-0.7.0-Allow-the-connection.client.libversion-call.patch +++ /dev/null @@ -1,31 +0,0 @@ -From a3d8ecf5cf987e456d0a8398788f4c2b145ea7f4 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= -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) diff --git a/vagrant-libvirt-0.7.0-Reduce-patching-for-distro-default-session-use.patch b/vagrant-libvirt-0.7.0-Reduce-patching-for-distro-default-session-use.patch deleted file mode 100644 index 955c7a0..0000000 --- a/vagrant-libvirt-0.7.0-Reduce-patching-for-distro-default-session-use.patch +++ /dev/null @@ -1,278 +0,0 @@ -From 3a465ab12ae806788b0d94dff1eee8c67677ad1c Mon Sep 17 00:00:00 2001 -From: Darragh Bailey -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 -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 - diff --git a/vagrant-libvirt-pr1709-ruby32-File_exists-URL-parse.patch b/vagrant-libvirt-pr1709-ruby32-File_exists-URL-parse.patch index 79e2c38..cbaad23 100644 --- a/vagrant-libvirt-pr1709-ruby32-File_exists-URL-parse.patch +++ b/vagrant-libvirt-pr1709-ruby32-File_exists-URL-parse.patch @@ -76,7 +76,7 @@ diff --git a/lib/vagrant-libvirt/config.rb b/lib/vagrant-libvirt/config.rb index 471d40dce..dfaef6167 100644 --- a/lib/vagrant-libvirt/config.rb +++ b/lib/vagrant-libvirt/config.rb -@@ -1304,8 +1304,8 @@ def finalize_from_uri +@@ -1320,8 +1320,8 @@ def finalize_from_uri end end diff --git a/vagrant-libvirt.spec b/vagrant-libvirt.spec index a723df5..6648e1a 100644 --- a/vagrant-libvirt.spec +++ b/vagrant-libvirt.spec @@ -1,10 +1,10 @@ %global vagrant_plugin_name vagrant-libvirt -%global vagrant_spec_commit 03d88fe2467716b072951c2b55d78223130851a6 +%global vagrant_spec_commit 259c55e204674f2b006700c6d351d04250d13b04 Name: %{vagrant_plugin_name} -Version: 0.7.0 -Release: 5%{?dist} +Version: 0.11.2 +Release: 1%{?dist} Summary: libvirt provider for Vagrant License: MIT URL: https://github.com/vagrant-libvirt/vagrant-libvirt @@ -12,41 +12,44 @@ 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/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 +Source1: https://github.com/mitchellh/vagrant-spec/archive/%{vagrant_spec_commit}/vagrant-spec-%{vagrant_spec_commit}.tar.gz # https://github.com/vagrant-libvirt/vagrant-libvirt/pull/1709 # ruby3.2 fix wrt File.exits? removal and URI.split host result change # A bit modified: spec/support/libvirt_acceptance_context.rb does not exist # with 0.7.0 yet -Patch2: vagrant-libvirt-pr1709-ruby32-File_exists-URL-parse.patch +Patch0: vagrant-libvirt-pr1709-ruby32-File_exists-URL-parse.patch # Enable QEMU Session by default # https://github.com/vagrant-libvirt/vagrant-libvirt/pull/969 +# NOTE: This breaks some tests, which are therefore disabled below. Patch100: vagrant-libvirt-0.0.45-enable-qemu-session-by-default.patch Requires: ruby(release) Requires: ruby(rubygems) -Requires: rubygem(fog-libvirt) >= 0.3.0 +Requires: rubygem(diffy) +Requires: rubygem(fog-core) >= 2 +Requires: rubygem(fog-libvirt) >= 0.6.0 Requires: rubygem(nokogiri) >= 1.6 Requires: rubygem(rexml) +Requires: rubygem(xml-simple) # Vagrant changed packaging scriptlets in version 1.9.1. Requires: vagrant >= 1.9.1 # Required by "vagrant package" command (rhbz#1292217). Recommends: %{_bindir}/virt-sysprep BuildRequires: vagrant >= 1.9.1 BuildRequires: rubygem(bundler) -BuildRequires: rubygem(rdoc) -BuildRequires: rubygem(rspec) +BuildRequires: rubygem(diffy) BuildRequires: rubygem(fog-libvirt) -BuildRequires: rubygem(thor) -BuildRequires: rubygem(rexml) BuildRequires: rubygem(rake) +BuildRequires: rubygem(rdoc) +BuildRequires: rubygem(rexml) +BuildRequires: rubygem(rspec) >= 3.10 +BuildRequires: rubygem(rspec-core) >= 3.5 +BuildRequires: rubygem(rspec-expectations) >= 3.5 +BuildRequires: rubygem(rspec-mocks) >= 3.5 +BuildRequires: rubygem(thor) +BuildRequires: rubygem(xml-simple) BuildRequires: rubygems-devel BuildRequires: %{_bindir}/ps BuildArch: noarch @@ -65,11 +68,9 @@ BuildArch: noarch Documentation for %{name}. %prep -%setup -q -n %{vagrant_plugin_name}-%{version} -b 2 +%setup -q -n %{vagrant_plugin_name}-%{version} -b 1 %patch0 -p1 -%patch1 -p1 -%patch2 -p1 %patch100 -p1 %build @@ -82,12 +83,12 @@ cp -a .%{vagrant_plugin_dir}/* \ %{buildroot}%{vagrant_plugin_dir}/ %check -# Edit gemspec of vagrant-spec +## Edit gemspec of vagrant-spec pushd ../vagrant-spec-%{vagrant_spec_commit} # Remove the git reference, which is useless in our case. -sed -i '/git/ s/^/#/' vagrant-spec.gemspec +sed -i '/git / s/^/#/' vagrant-spec.gemspec -# Relax the dependencies, since Fedora ships with newer versions. +## Relax the dependencies, since Fedora ships with newer versions. sed -i '/thor/ s/~>/>=/' vagrant-spec.gemspec sed -i '/rspec/ s/~>/>=/' vagrant-spec.gemspec popd @@ -104,19 +105,19 @@ gem 'rexml' gem 'vagrant-spec', :path => '%{_builddir}/vagrant-spec-%{vagrant_spec_commit}' gemspec EOG -# We don't care about code coverage. -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 + +## We don't care about code coverage, but editing such large chunks of source +## code is error-prone (2nd sed unbalances begin/end blocks), so leave it alone +## and take the build time penalty to save maintainer time. +#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 +# Disable tests that use synced_folders, as they're not supported under qemu:///session +sed -i "s/describe '#validate' do/xdescribe '#validate' do/" spec/unit/config_spec.rb # Suppress deprecation warnings GEM_PATH=%{vagrant_plugin_dir}:`ruby -e "print Gem.path.join(':')"` \ @@ -139,6 +140,9 @@ popd %{vagrant_plugin_instdir}/spec %changelog +* Sun Jan 29 2023 Bart Kus - 0.11.2-1 +- Update to vagrant-libvirt 0.11.2. + * Fri Jan 20 2023 Mamoru TASAKA - 0.7.0-5 - Backport upstream fix for ruby3.2 compatibility (File.exists? removal, URI#parse host name result change) From 34906f3e485b70aa3a254fb8a963e9d8294c9724 Mon Sep 17 00:00:00 2001 From: Jarek Prokop Date: Fri, 10 Feb 2023 17:41:03 +0100 Subject: [PATCH 17/31] Fix test suite for vagrant-libvirt 0.11.2 with qemu session as default. Adjust Requires and BuildRequires for spec. Delete sed commands relating to SimpleCov and test suite disabling, they are no longer required. --- ...ock-object-to-receive-synced_folders.patch | 28 ++++++++++++++ vagrant-libvirt.spec | 37 +++++++++---------- 2 files changed, 45 insertions(+), 20 deletions(-) create mode 100644 vagrant-libvirt-0.11.2-Allow-a-mock-object-to-receive-synced_folders.patch diff --git a/vagrant-libvirt-0.11.2-Allow-a-mock-object-to-receive-synced_folders.patch b/vagrant-libvirt-0.11.2-Allow-a-mock-object-to-receive-synced_folders.patch new file mode 100644 index 0000000..41976a2 --- /dev/null +++ b/vagrant-libvirt-0.11.2-Allow-a-mock-object-to-receive-synced_folders.patch @@ -0,0 +1,28 @@ +From f87d4330953effdea41355d2daedb6b9659f39d3 Mon Sep 17 00:00:00 2001 +From: Jarek Prokop +Date: Fri, 10 Feb 2023 16:24:07 +0100 +Subject: [PATCH] Allow a mock object to receive synced_folders when using qemu + session. + +When using qemu session, there is another code path +regarding 9p and virtiofs that wasn't considered. +--- + spec/unit/config_spec.rb | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/spec/unit/config_spec.rb b/spec/unit/config_spec.rb +index d205214..e606b89 100644 +--- a/spec/unit/config_spec.rb ++++ b/spec/unit/config_spec.rb +@@ -770,6 +770,8 @@ describe VagrantPlugins::ProviderLibvirt::Config do + let (:vm) { double('vm') } + before do + machine.config.instance_variable_get("@keys")[:vm] = vm ++ ++ allow(vm).to receive(:synced_folders).and_return({}) + end + + it 'is valid with valid mac' do +-- +2.39.1 + diff --git a/vagrant-libvirt.spec b/vagrant-libvirt.spec index 6648e1a..bce5657 100644 --- a/vagrant-libvirt.spec +++ b/vagrant-libvirt.spec @@ -19,16 +19,18 @@ Source1: https://github.com/mitchellh/vagrant-spec/archive/%{vagrant_spec_commit # A bit modified: spec/support/libvirt_acceptance_context.rb does not exist # with 0.7.0 yet Patch0: vagrant-libvirt-pr1709-ruby32-File_exists-URL-parse.patch +# Allow a mock object to receive synced_folders in config validation spec. +# We do not care about synced folder check when testing MAC configuration. +# https://github.com/vagrant-libvirt/vagrant-libvirt/pull/1721 +Patch1: vagrant-libvirt-0.11.2-Allow-a-mock-object-to-receive-synced_folders.patch # Enable QEMU Session by default # https://github.com/vagrant-libvirt/vagrant-libvirt/pull/969 -# NOTE: This breaks some tests, which are therefore disabled below. Patch100: vagrant-libvirt-0.0.45-enable-qemu-session-by-default.patch Requires: ruby(release) Requires: ruby(rubygems) Requires: rubygem(diffy) -Requires: rubygem(fog-core) >= 2 Requires: rubygem(fog-libvirt) >= 0.6.0 Requires: rubygem(nokogiri) >= 1.6 Requires: rubygem(rexml) @@ -44,10 +46,7 @@ BuildRequires: rubygem(fog-libvirt) BuildRequires: rubygem(rake) BuildRequires: rubygem(rdoc) BuildRequires: rubygem(rexml) -BuildRequires: rubygem(rspec) >= 3.10 -BuildRequires: rubygem(rspec-core) >= 3.5 -BuildRequires: rubygem(rspec-expectations) >= 3.5 -BuildRequires: rubygem(rspec-mocks) >= 3.5 +BuildRequires: rubygem(rspec) BuildRequires: rubygem(thor) BuildRequires: rubygem(xml-simple) BuildRequires: rubygems-devel @@ -71,6 +70,7 @@ Documentation for %{name}. %setup -q -n %{vagrant_plugin_name}-%{version} -b 1 %patch0 -p1 +%patch1 -p1 %patch100 -p1 %build @@ -83,12 +83,12 @@ cp -a .%{vagrant_plugin_dir}/* \ %{buildroot}%{vagrant_plugin_dir}/ %check -## Edit gemspec of vagrant-spec +# Edit gemspec of vagrant-spec 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 dependencies, since Fedora ships with newer versions. +# Relax the dependencies, since Fedora ships with newer versions. sed -i '/thor/ s/~>/>=/' vagrant-spec.gemspec sed -i '/rspec/ s/~>/>=/' vagrant-spec.gemspec popd @@ -106,21 +106,18 @@ gem 'vagrant-spec', :path => '%{_builddir}/vagrant-spec-%{vagrant_spec_commit}' gemspec EOG -## We don't care about code coverage, but editing such large chunks of source -## code is error-prone (2nd sed unbalances begin/end blocks), so leave it alone -## and take the build time penalty to save maintainer time. -#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 tests that use synced_folders, as they're not supported under qemu:///session -sed -i "s/describe '#validate' do/xdescribe '#validate' do/" spec/unit/config_spec.rb +# Unless rsync binary is present, vagrant-libvirt +# decides to use other methods of folder sync in tests, +# breaking set expectations for the test environment. +# https://github.com/vagrant-libvirt/vagrant-libvirt/issues/1415#issuecomment-985272836 +# Luckily, it just needs `rsync` in $PATH for tests to pass. +tmpdir=$(mktemp -d) +touch "${tmpdir}/rsync" +chmod +x "${tmpdir}/rsync" # Suppress deprecation warnings GEM_PATH=%{vagrant_plugin_dir}:`ruby -e "print Gem.path.join(':')"` \ +PATH="$PATH:${tmpdir}" \ bundle exec rspec spec popd From bf304e3ff9099e897b6e421cfb2cb058c357d9a7 Mon Sep 17 00:00:00 2001 From: Jarek Prokop Date: Fri, 10 Feb 2023 17:56:19 +0100 Subject: [PATCH 18/31] Update enable-qemu-session-by-default patch for vagrant-libvirt 0.11.2 --- ....0.45-enable-qemu-session-by-default.patch | 63 ------------------- ....11.2-enable-qemu-session-by-default.patch | 53 ++++++++++++++++ vagrant-libvirt.spec | 2 +- 3 files changed, 54 insertions(+), 64 deletions(-) delete mode 100644 vagrant-libvirt-0.0.45-enable-qemu-session-by-default.patch create mode 100644 vagrant-libvirt-0.11.2-enable-qemu-session-by-default.patch 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 deleted file mode 100644 index 64ef8bd..0000000 --- a/vagrant-libvirt-0.0.45-enable-qemu-session-by-default.patch +++ /dev/null @@ -1,63 +0,0 @@ -From aeeda2b48749eec6ca6158b57928cfc1e94767ca Mon Sep 17 00:00:00 2001 -From: Pavel Valena -Date: Wed, 21 Oct 2020 04:18:08 +0200 -Subject: [PATCH] Enable QEMU Session by default - -sets default for `@qemu_use_session` to true. ---- - -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 -@@ -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. -- # 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 b68bf05606da6449966a53a2ea6abe261a03a731 Mon Sep 17 00:00:00 2001 -From: Pavel Valena -Date: Mon, 13 Dec 2021 12:06:21 +0100 -Subject: [PATCH] Fix tests. - ---- - 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 342debf..cb51cf5 100644 -#--- a/spec/unit/action/create_domain_spec.rb -#+++ b/spec/unit/action/create_domain_spec.rb -#@@ -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 6f82da1..bd74999 100644 ---- a/spec/unit/config_spec.rb -+++ b/spec/unit/config_spec.rb -@@ -74,7 +74,7 @@ describe VagrantPlugins::ProviderLibvirt::Config do - # settings - [ # all default - {}, -- {:uri => "qemu:///system"}, -+ {:uri => "qemu:///session"}, - ], - - # explicit uri settings --- -2.33.1 diff --git a/vagrant-libvirt-0.11.2-enable-qemu-session-by-default.patch b/vagrant-libvirt-0.11.2-enable-qemu-session-by-default.patch new file mode 100644 index 0000000..19bd4fc --- /dev/null +++ b/vagrant-libvirt-0.11.2-enable-qemu-session-by-default.patch @@ -0,0 +1,53 @@ +From 799acbebe6a506c85c93f384610e646d801bea1a Mon Sep 17 00:00:00 2001 +From: Jarek Prokop +Date: Fri, 10 Feb 2023 17:43:18 +0100 +Subject: [PATCH 1/2] Enable QEMU Session by default + +Default `@qemu_use_session` to true. +--- + lib/vagrant-libvirt/config.rb | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/lib/vagrant-libvirt/config.rb b/lib/vagrant-libvirt/config.rb +index d4763be..0bbdef0 100644 +--- a/lib/vagrant-libvirt/config.rb ++++ b/lib/vagrant-libvirt/config.rb +@@ -931,9 +931,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 b695838c24e5669c58ef5984dc26f31277c7dd10 Mon Sep 17 00:00:00 2001 +From: Jarek Prokop +Date: Fri, 10 Feb 2023 17:43:55 +0100 +Subject: [PATCH 2/2] Use qemu:///session instead of qemu:///system in test + suite. + +--- + spec/unit/config_spec.rb | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/spec/unit/config_spec.rb b/spec/unit/config_spec.rb +index d205214..fce7521 100644 +--- a/spec/unit/config_spec.rb ++++ b/spec/unit/config_spec.rb +@@ -72,7 +72,7 @@ describe VagrantPlugins::ProviderLibvirt::Config do + # settings + [ # all default + {}, +- {:uri => "qemu:///system"}, ++ {:uri => "qemu:///session"}, + ], + + # explicit uri settings +-- +2.39.1 + diff --git a/vagrant-libvirt.spec b/vagrant-libvirt.spec index bce5657..d82a064 100644 --- a/vagrant-libvirt.spec +++ b/vagrant-libvirt.spec @@ -26,7 +26,7 @@ Patch1: vagrant-libvirt-0.11.2-Allow-a-mock-object-to-receive-synced_folders.pat # Enable QEMU Session by default # https://github.com/vagrant-libvirt/vagrant-libvirt/pull/969 -Patch100: vagrant-libvirt-0.0.45-enable-qemu-session-by-default.patch +Patch100: vagrant-libvirt-0.11.2-enable-qemu-session-by-default.patch Requires: ruby(release) Requires: ruby(rubygems) From ef122aab9c8a9f5f43faaa7a1457851b8e2d77ea Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 22 Jul 2023 17:23:20 +0000 Subject: [PATCH 19/31] Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- vagrant-libvirt.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vagrant-libvirt.spec b/vagrant-libvirt.spec index d82a064..9254d31 100644 --- a/vagrant-libvirt.spec +++ b/vagrant-libvirt.spec @@ -4,7 +4,7 @@ Name: %{vagrant_plugin_name} Version: 0.11.2 -Release: 1%{?dist} +Release: 2%{?dist} Summary: libvirt provider for Vagrant License: MIT URL: https://github.com/vagrant-libvirt/vagrant-libvirt @@ -137,6 +137,9 @@ popd %{vagrant_plugin_instdir}/spec %changelog +* Sat Jul 22 2023 Fedora Release Engineering - 0.11.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + * Sun Jan 29 2023 Bart Kus - 0.11.2-1 - Update to vagrant-libvirt 0.11.2. From 552ae8048545f5ad40098565c54af9b8986be639 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 27 Jan 2024 07:26:24 +0000 Subject: [PATCH 20/31] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild --- vagrant-libvirt.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vagrant-libvirt.spec b/vagrant-libvirt.spec index 9254d31..76d219a 100644 --- a/vagrant-libvirt.spec +++ b/vagrant-libvirt.spec @@ -4,7 +4,7 @@ Name: %{vagrant_plugin_name} Version: 0.11.2 -Release: 2%{?dist} +Release: 3%{?dist} Summary: libvirt provider for Vagrant License: MIT URL: https://github.com/vagrant-libvirt/vagrant-libvirt @@ -137,6 +137,9 @@ popd %{vagrant_plugin_instdir}/spec %changelog +* Sat Jan 27 2024 Fedora Release Engineering - 0.11.2-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Sat Jul 22 2023 Fedora Release Engineering - 0.11.2-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild From 60b9204d8cb0af8febf159765b377beadb41c655 Mon Sep 17 00:00:00 2001 From: Software Management Team Date: Thu, 30 May 2024 12:47:07 +0200 Subject: [PATCH 21/31] Eliminate use of obsolete %patchN syntax (#2283636) --- vagrant-libvirt.spec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vagrant-libvirt.spec b/vagrant-libvirt.spec index 76d219a..b622ed8 100644 --- a/vagrant-libvirt.spec +++ b/vagrant-libvirt.spec @@ -69,9 +69,9 @@ Documentation for %{name}. %prep %setup -q -n %{vagrant_plugin_name}-%{version} -b 1 -%patch0 -p1 -%patch1 -p1 -%patch100 -p1 +%patch 0 -p1 +%patch 1 -p1 +%patch 100 -p1 %build gem build ../%{vagrant_plugin_name}-%{version}.gemspec From 951074288558f2e9ff2642ab9175db351e7de075 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 20 Jul 2024 08:32:08 +0000 Subject: [PATCH 22/31] Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild --- vagrant-libvirt.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vagrant-libvirt.spec b/vagrant-libvirt.spec index b622ed8..6c01810 100644 --- a/vagrant-libvirt.spec +++ b/vagrant-libvirt.spec @@ -4,7 +4,7 @@ Name: %{vagrant_plugin_name} Version: 0.11.2 -Release: 3%{?dist} +Release: 4%{?dist} Summary: libvirt provider for Vagrant License: MIT URL: https://github.com/vagrant-libvirt/vagrant-libvirt @@ -137,6 +137,9 @@ popd %{vagrant_plugin_instdir}/spec %changelog +* Sat Jul 20 2024 Fedora Release Engineering - 0.11.2-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + * Sat Jan 27 2024 Fedora Release Engineering - 0.11.2-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild From 6ba3e60764b76d6a35b88e1d36f08fdd853a60b2 Mon Sep 17 00:00:00 2001 From: Mamoru TASAKA Date: Sun, 29 Dec 2024 21:25:40 +0900 Subject: [PATCH 23/31] Add some gem dependency on testsuite for ruby3.4 Support REXML 3.3.2 output behavior change --- ...t-pr1837-testsuite-support-rexml-332.patch | 81 +++++++++++++++++++ vagrant-libvirt.spec | 13 ++- 2 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 vagrant-libvirt-pr1837-testsuite-support-rexml-332.patch diff --git a/vagrant-libvirt-pr1837-testsuite-support-rexml-332.patch b/vagrant-libvirt-pr1837-testsuite-support-rexml-332.patch new file mode 100644 index 0000000..62c6a1d --- /dev/null +++ b/vagrant-libvirt-pr1837-testsuite-support-rexml-332.patch @@ -0,0 +1,81 @@ +From fcafe97cee012e4c3ae1996bb78f8d88a1077dcb Mon Sep 17 00:00:00 2001 +From: Mamoru TASAKA +Date: Sun, 29 Dec 2024 18:41:57 +0900 +Subject: [PATCH] TEST: Support REXML 3.3.2 output change + +With https://github.com/ruby/rexml/pull/167 +REXML::Document.write may chomp output string compared to before. +This change affects VagrantPlugins::ProviderLibvirt::Action::StartDomain#call +internal behavior. + +Modify rspec testsuite to support this REXML behavior change. + +Closes #1836 . +--- + spec/unit/action/start_domain_spec.rb | 18 ++++++++++++------ + 1 file changed, 12 insertions(+), 6 deletions(-) + +diff --git a/spec/unit/action/start_domain_spec.rb b/spec/unit/action/start_domain_spec.rb +index 330612beb..af9999cf9 100644 +--- a/spec/unit/action/start_domain_spec.rb ++++ b/spec/unit/action/start_domain_spec.rb +@@ -509,7 +509,8 @@ + + it 'should add the nvram element' do + expect(ui).to_not receive(:warn) +- expect(connection).to receive(:define_domain).with(updated_domain_xml).and_return(libvirt_domain) ++ arg_domain_xml = REXML::VERSION >= "3.3.2" ? updated_domain_xml.chomp : updated_domain_xml ++ expect(connection).to receive(:define_domain).with(arg_domain_xml).and_return(libvirt_domain) + expect(libvirt_domain).to receive(:xml_desc).and_return(domain_xml, updated_domain_xml) + expect(libvirt_domain).to receive(:autostart=) + expect(domain).to receive(:start) +@@ -530,7 +531,8 @@ + + it 'should keep the XML element' do + expect(ui).to_not receive(:warn) +- expect(connection).to receive(:define_domain).with(updated_domain_xml).and_return(libvirt_domain) ++ arg_domain_xml = REXML::VERSION >= "3.3.2" ? updated_domain_xml.chomp : updated_domain_xml ++ expect(connection).to receive(:define_domain).with(arg_domain_xml).and_return(libvirt_domain) + expect(libvirt_domain).to receive(:xml_desc).and_return(domain_xml, updated_domain_xml) + expect(libvirt_domain).to receive(:autostart=) + expect(domain).to receive(:start) +@@ -544,7 +546,8 @@ + + it 'should delete the XML element' do + expect(ui).to_not receive(:warn) +- expect(connection).to receive(:define_domain).with(updated_domain_xml).and_return(libvirt_domain) ++ arg_domain_xml = REXML::VERSION >= "3.3.2" ? updated_domain_xml.chomp : updated_domain_xml ++ expect(connection).to receive(:define_domain).with(arg_domain_xml).and_return(libvirt_domain) + expect(libvirt_domain).to receive(:xml_desc).and_return(domain_xml, updated_domain_xml) + expect(libvirt_domain).to receive(:autostart=) + expect(domain).to receive(:start) +@@ -569,7 +572,8 @@ + it 'should modify the domain tpm_path' do + expect(ui).to_not receive(:warn) + expect(logger).to receive(:debug).with('tpm config changed') +- expect(connection).to receive(:define_domain).with(updated_domain_xml).and_return(libvirt_domain) ++ arg_domain_xml = REXML::VERSION >= "3.3.2" ? updated_domain_xml.chomp : updated_domain_xml ++ expect(connection).to receive(:define_domain).with(arg_domain_xml).and_return(libvirt_domain) + expect(libvirt_domain).to receive(:xml_desc).and_return(domain_xml, updated_domain_xml) + expect(libvirt_domain).to receive(:autostart=) + expect(domain).to receive(:start) +@@ -591,7 +595,8 @@ + it 'should modify the domain tpm_path' do + expect(ui).to_not receive(:warn) + expect(logger).to receive(:debug).with('tpm config changed') +- expect(connection).to receive(:define_domain).with(updated_domain_xml).and_return(libvirt_domain) ++ arg_domain_xml = REXML::VERSION >= "3.3.2" ? updated_domain_xml.chomp : updated_domain_xml ++ expect(connection).to receive(:define_domain).with(arg_domain_xml).and_return(libvirt_domain) + expect(libvirt_domain).to receive(:xml_desc).and_return(domain_xml, updated_domain_xml) + expect(libvirt_domain).to receive(:autostart=) + expect(domain).to receive(:start) +@@ -654,7 +659,8 @@ + it 'should modify the domain' do + expect(ui).to_not receive(:warn) + expect(logger).to receive(:debug).with('tpm config changed') +- expect(connection).to receive(:define_domain).with(updated_domain_xml).and_return(libvirt_domain) ++ arg_domain_xml = REXML::VERSION >= "3.3.2" ? updated_domain_xml.chomp : updated_domain_xml ++ expect(connection).to receive(:define_domain).with(arg_domain_xml).and_return(libvirt_domain) + expect(libvirt_domain).to receive(:xml_desc).and_return(domain_xml, updated_domain_xml) + expect(libvirt_domain).to receive(:autostart=) + expect(domain).to receive(:start) diff --git a/vagrant-libvirt.spec b/vagrant-libvirt.spec index 6c01810..f9f7106 100644 --- a/vagrant-libvirt.spec +++ b/vagrant-libvirt.spec @@ -4,7 +4,7 @@ Name: %{vagrant_plugin_name} Version: 0.11.2 -Release: 4%{?dist} +Release: 5%{?dist} Summary: libvirt provider for Vagrant License: MIT URL: https://github.com/vagrant-libvirt/vagrant-libvirt @@ -23,6 +23,9 @@ Patch0: vagrant-libvirt-pr1709-ruby32-File_exists-URL-parse.patch # We do not care about synced folder check when testing MAC configuration. # https://github.com/vagrant-libvirt/vagrant-libvirt/pull/1721 Patch1: vagrant-libvirt-0.11.2-Allow-a-mock-object-to-receive-synced_folders.patch +# https://github.com/vagrant-libvirt/vagrant-libvirt/pull/1837 +# related to https://github.com/ruby/rexml/pull/167 +Patch2: vagrant-libvirt-pr1837-testsuite-support-rexml-332.patch # Enable QEMU Session by default # https://github.com/vagrant-libvirt/vagrant-libvirt/pull/969 @@ -71,6 +74,7 @@ Documentation for %{name}. %patch 0 -p1 %patch 1 -p1 +%patch 2 -p1 %patch 100 -p1 %build @@ -100,6 +104,9 @@ pushd .%{vagrant_plugin_instdir} # Create dummy Gemfile and load dependencies via gemspec file cat > Gemfile < '%{_builddir}/vagrant-spec-%{vagrant_spec_commit}' @@ -137,6 +144,10 @@ popd %{vagrant_plugin_instdir}/spec %changelog +* Sun Dec 29 2024 Mamoru TASAKA - 0.11.2-5 +- Add some gem dependency on testsuite for ruby3.4 +- Support REXML 3.3.2 output behavior change + * Sat Jul 20 2024 Fedora Release Engineering - 0.11.2-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild From 417965d1a19cad4de90c41770d19c997e6b38b80 Mon Sep 17 00:00:00 2001 From: Jarek Prokop Date: Tue, 7 Jan 2025 18:51:30 +0100 Subject: [PATCH 24/31] Stop warning being emitted due to setting unsupported option in fog-libvirt. `vagrant up` and `vagrant ssh` emits: ~~~ [fog][WARNING] Unrecognized arguments: libvirt_ip_command ~~~ on CLI. The option is no longer supported by fog-libvirt. See discussion on https://github.com/vagrant-libvirt/vagrant-libvirt/issues/1831 Main function seem to have been for libvirt < 1.2.8. EL7.9 includes libvirt 4.5.0, so this should be compatible even for older systems. https://github.com/fog/fog-libvirt/commit/97450dd --- ...ve-config-unsupported-by-fog-libvirt.patch | 31 +++++++++++++++++++ vagrant-libvirt.spec | 8 +++++ 2 files changed, 39 insertions(+) create mode 100644 vagrant-libvirt-0.12.2-Remove-config-unsupported-by-fog-libvirt.patch diff --git a/vagrant-libvirt-0.12.2-Remove-config-unsupported-by-fog-libvirt.patch b/vagrant-libvirt-0.12.2-Remove-config-unsupported-by-fog-libvirt.patch new file mode 100644 index 0000000..2d40e76 --- /dev/null +++ b/vagrant-libvirt-0.12.2-Remove-config-unsupported-by-fog-libvirt.patch @@ -0,0 +1,31 @@ +From 5bb08ec8150ee3ceca74c772f4c72b49b61f988f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Janek=20Ziele=C5=BAnicki?= +Date: Mon, 18 Nov 2024 19:16:07 +0100 +Subject: [PATCH 1/2] Remove config unsupported by fog-libvirt + +fog-libvirt dropped support for libvirt < 1.2.8 in version v0.13.0 +This config is no longer supported nor needed +--- + lib/vagrant-libvirt/driver.rb | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/lib/vagrant-libvirt/driver.rb b/lib/vagrant-libvirt/driver.rb +index 73f0f7a45..90e0e6118 100644 +--- a/lib/vagrant-libvirt/driver.rb ++++ b/lib/vagrant-libvirt/driver.rb +@@ -32,14 +32,9 @@ def connection + config = @machine.provider_config + uri = config.uri + +- # Setup command for retrieving IP address for newly created machine +- # with some MAC address. Get it from dnsmasq leases table +- ip_command = %q( awk "/$mac/ {print \$1}" /proc/net/arp ) +- + conn_attr = { + provider: 'libvirt', + libvirt_uri: uri, +- libvirt_ip_command: ip_command, + } + conn_attr[:libvirt_username] = config.username if config.username + conn_attr[:libvirt_password] = config.password if config.password + diff --git a/vagrant-libvirt.spec b/vagrant-libvirt.spec index f9f7106..3bd02ee 100644 --- a/vagrant-libvirt.spec +++ b/vagrant-libvirt.spec @@ -26,6 +26,10 @@ Patch1: vagrant-libvirt-0.11.2-Allow-a-mock-object-to-receive-synced_folders.pat # https://github.com/vagrant-libvirt/vagrant-libvirt/pull/1837 # related to https://github.com/ruby/rexml/pull/167 Patch2: vagrant-libvirt-pr1837-testsuite-support-rexml-332.patch +# Get rid of a warning generated due to usage of option +# no longer supported by fog-libvirt +# https://github.com/vagrant-libvirt/vagrant-libvirt/pull/1835 +Patch3: vagrant-libvirt-0.12.2-Remove-config-unsupported-by-fog-libvirt.patch # Enable QEMU Session by default # https://github.com/vagrant-libvirt/vagrant-libvirt/pull/969 @@ -75,6 +79,7 @@ Documentation for %{name}. %patch 0 -p1 %patch 1 -p1 %patch 2 -p1 +%patch 3 -p1 %patch 100 -p1 %build @@ -144,6 +149,9 @@ popd %{vagrant_plugin_instdir}/spec %changelog +* Tue Jan 07 2025 Jarek Prokop - 0.11.2-5 +- Stop warning being emitted due to setting unsupported option in fog-libvirt. + * Sun Dec 29 2024 Mamoru TASAKA - 0.11.2-5 - Add some gem dependency on testsuite for ruby3.4 - Support REXML 3.3.2 output behavior change From 92d5b6f6f80e714f56857c2182b7e8259e2deb20 Mon Sep 17 00:00:00 2001 From: Jarek Prokop Date: Tue, 7 Jan 2025 18:58:17 +0100 Subject: [PATCH 25/31] Adjust REXML spec patch to correct line offsets for vagrant 0.11.2. --- ...-libvirt-pr1837-testsuite-support-rexml-332.patch | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/vagrant-libvirt-pr1837-testsuite-support-rexml-332.patch b/vagrant-libvirt-pr1837-testsuite-support-rexml-332.patch index 62c6a1d..dbffb41 100644 --- a/vagrant-libvirt-pr1837-testsuite-support-rexml-332.patch +++ b/vagrant-libvirt-pr1837-testsuite-support-rexml-332.patch @@ -19,7 +19,7 @@ diff --git a/spec/unit/action/start_domain_spec.rb b/spec/unit/action/start_doma index 330612beb..af9999cf9 100644 --- a/spec/unit/action/start_domain_spec.rb +++ b/spec/unit/action/start_domain_spec.rb -@@ -509,7 +509,8 @@ +@@ -364,7 +364,8 @@ it 'should add the nvram element' do expect(ui).to_not receive(:warn) @@ -29,7 +29,7 @@ index 330612beb..af9999cf9 100644 expect(libvirt_domain).to receive(:xml_desc).and_return(domain_xml, updated_domain_xml) expect(libvirt_domain).to receive(:autostart=) expect(domain).to receive(:start) -@@ -530,7 +531,8 @@ +@@ -385,7 +385,8 @@ it 'should keep the XML element' do expect(ui).to_not receive(:warn) @@ -39,7 +39,7 @@ index 330612beb..af9999cf9 100644 expect(libvirt_domain).to receive(:xml_desc).and_return(domain_xml, updated_domain_xml) expect(libvirt_domain).to receive(:autostart=) expect(domain).to receive(:start) -@@ -544,7 +546,8 @@ +@@ -399,7 +399,8 @@ it 'should delete the XML element' do expect(ui).to_not receive(:warn) @@ -49,7 +49,7 @@ index 330612beb..af9999cf9 100644 expect(libvirt_domain).to receive(:xml_desc).and_return(domain_xml, updated_domain_xml) expect(libvirt_domain).to receive(:autostart=) expect(domain).to receive(:start) -@@ -569,7 +572,8 @@ +@@ -424,7 +424,8 @@ it 'should modify the domain tpm_path' do expect(ui).to_not receive(:warn) expect(logger).to receive(:debug).with('tpm config changed') @@ -59,7 +59,7 @@ index 330612beb..af9999cf9 100644 expect(libvirt_domain).to receive(:xml_desc).and_return(domain_xml, updated_domain_xml) expect(libvirt_domain).to receive(:autostart=) expect(domain).to receive(:start) -@@ -591,7 +595,8 @@ +@@ -446,7 +446,8 @@ it 'should modify the domain tpm_path' do expect(ui).to_not receive(:warn) expect(logger).to receive(:debug).with('tpm config changed') @@ -69,7 +69,7 @@ index 330612beb..af9999cf9 100644 expect(libvirt_domain).to receive(:xml_desc).and_return(domain_xml, updated_domain_xml) expect(libvirt_domain).to receive(:autostart=) expect(domain).to receive(:start) -@@ -654,7 +659,8 @@ +@@ -509,7 +509,8 @@ it 'should modify the domain' do expect(ui).to_not receive(:warn) expect(logger).to receive(:debug).with('tpm config changed') From 37311015fc1d2c8bc6a7bbbc72fc4be802061e79 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sun, 19 Jan 2025 14:04:14 +0000 Subject: [PATCH 26/31] Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild --- vagrant-libvirt.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vagrant-libvirt.spec b/vagrant-libvirt.spec index 3bd02ee..fdffe87 100644 --- a/vagrant-libvirt.spec +++ b/vagrant-libvirt.spec @@ -4,7 +4,7 @@ Name: %{vagrant_plugin_name} Version: 0.11.2 -Release: 5%{?dist} +Release: 6%{?dist} Summary: libvirt provider for Vagrant License: MIT URL: https://github.com/vagrant-libvirt/vagrant-libvirt @@ -149,6 +149,9 @@ popd %{vagrant_plugin_instdir}/spec %changelog +* Sun Jan 19 2025 Fedora Release Engineering - 0.11.2-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + * Tue Jan 07 2025 Jarek Prokop - 0.11.2-5 - Stop warning being emitted due to setting unsupported option in fog-libvirt. From e3ab63ff28c93659e9b97755adaad94192f39a96 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 25 Jul 2025 19:56:32 +0000 Subject: [PATCH 27/31] Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild --- vagrant-libvirt.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vagrant-libvirt.spec b/vagrant-libvirt.spec index fdffe87..24ccf6b 100644 --- a/vagrant-libvirt.spec +++ b/vagrant-libvirt.spec @@ -4,7 +4,7 @@ Name: %{vagrant_plugin_name} Version: 0.11.2 -Release: 6%{?dist} +Release: 7%{?dist} Summary: libvirt provider for Vagrant License: MIT URL: https://github.com/vagrant-libvirt/vagrant-libvirt @@ -149,6 +149,9 @@ popd %{vagrant_plugin_instdir}/spec %changelog +* Fri Jul 25 2025 Fedora Release Engineering - 0.11.2-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild + * Sun Jan 19 2025 Fedora Release Engineering - 0.11.2-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild From 63912842917d30ea913c525f2b29ca940b881e7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Mon, 3 Nov 2025 11:56:10 +0100 Subject: [PATCH 28/31] Fix compatibility with REXML 3.4.2+ --- ...0.12.2-Fix-REXML-3-4-2-compatibility.patch | 116 ++++++++++++++++++ vagrant-libvirt.spec | 9 +- 2 files changed, 124 insertions(+), 1 deletion(-) create mode 100644 vagrant-libvirt-0.12.2-Fix-REXML-3-4-2-compatibility.patch diff --git a/vagrant-libvirt-0.12.2-Fix-REXML-3-4-2-compatibility.patch b/vagrant-libvirt-0.12.2-Fix-REXML-3-4-2-compatibility.patch new file mode 100644 index 0000000..feed62b --- /dev/null +++ b/vagrant-libvirt-0.12.2-Fix-REXML-3-4-2-compatibility.patch @@ -0,0 +1,116 @@ +From ec4daf33cf6135f9a29c48a61dd8a6e8b9bf0dc1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?V=C3=ADt=20Ondruch?= +Date: Fri, 31 Oct 2025 17:35:48 +0100 +Subject: [PATCH] Fix REXML 3.4.2+ compatibility + +REXML 3.4.2+ deprecated accepting array as an element in `XPath.match` +[[1]]. This led to test errors such as: + +~~~ + 3) VagrantPlugins::ProviderLibvirt::Action::ResolveDiskSettings#call when vm box is in use when box metadata is not available when multiple volumes in domain config should populate domain volumes with devices + Failure/Error: + expect(env[:domain_volumes]).to match( + [ + hash_including( + device: 'vda', + absolute_path: '/var/lib/libvirt/images/vagrant-test_default.img' + ), + hash_including( + device: 'vdb', + absolute_path: '/var/lib/libvirt/images/vagrant-test_default_1.img' + ), + expected [{absolute_path: "/var/lib/libvirt/images/vagrant-test_default.img", bus: "virtio", cache: "default", device: "vda", name: "vagrant-test_default.img"}] to match [#, #, #] + Diff: + @@ -1,4 +1,6 @@ + -[hash_including(device: "vda", absolute_path: "/var/lib/libvirt/images/vagrant-test_default.img"), + - hash_including(device: "vdb", absolute_path: "/var/lib/libvirt/images/vagrant-test_default_1.img"), + - hash_including(device: "vdc", absolute_path: "/var/lib/libvirt/images/vagrant-test_default_2.img")] + +[{absolute_path: "/var/lib/libvirt/images/vagrant-test_default.img", + + bus: "virtio", + + cache: "default", + + device: "vda", + + name: "vagrant-test_default.img"}] + # ./spec/unit/action/resolve_disk_settings_spec.rb:200:in 'block (6 levels) in ' + # ./spec/support/unit_context.rb:51:in 'block (3 levels) in ' + # ./spec/support/unit_context.rb:43:in 'block (2 levels) in ' + # ./spec/support/unit_context.rb:51:in 'block (3 levels) in ' + # ./spec/support/unit_context.rb:43:in 'block (2 levels) in ' +~~~ + +This changes the logic in a way, that XPath is matching against whole +XML document, instead of array of XML elements. + +[1]: https://github.com/ruby/rexml/pull/252 +--- + lib/vagrant-libvirt/action/destroy_domain.rb | 10 ++++++---- + lib/vagrant-libvirt/action/resolve_disk_settings.rb | 9 +++++---- + 2 files changed, 11 insertions(+), 8 deletions(-) + +diff --git a/lib/vagrant-libvirt/action/destroy_domain.rb b/lib/vagrant-libvirt/action/destroy_domain.rb +index 4d6cc6ee8..fba6aee6d 100644 +--- a/lib/vagrant-libvirt/action/destroy_domain.rb ++++ b/lib/vagrant-libvirt/action/destroy_domain.rb +@@ -59,7 +59,7 @@ def call(env) + domain_xml = libvirt_domain.xml_desc(1) + xml_descr = REXML::Document.new(domain_xml) + disks_xml = REXML::XPath.match(xml_descr, '/domain/devices/disk[@device="disk"]') +- have_aliases = !(REXML::XPath.match(disks_xml, './alias[@name="ua-box-volume-0"]').first).nil? ++ have_aliases = !REXML::XPath.match(xml_descr, '/domain/devices/disk[@device="disk"]/alias[@name="ua-box-volume-0"]').first.nil? + if !have_aliases + env[:ui].warn(I18n.t('vagrant_libvirt.domain_xml.obsolete_method')) + end +@@ -73,7 +73,9 @@ def call(env) + # the additional storage devices are. + detected_box_volumes = 0 + if have_aliases +- REXML::XPath.match(disks_xml, './alias[contains(@name, "ua-box-volume-")]').each do |box_disk| ++ REXML::XPath.match(xml_descr, ++ '/domain/devices/disk[@device="disk"]/alias[contains(@name, "ua-box-volume-")]' ++ ).each do |box_disk| + diskname = box_disk.parent.elements['source'].attributes['file'].rpartition('/').last + detected_box_volumes += 1 + +@@ -130,13 +132,13 @@ def call(env) + # look for exact match using aliases which will be used + # for subsequent domain creations + if have_aliases +- domain_disk = REXML::XPath.match(disks_xml, './alias[@name="ua-disk-volume-' + index.to_s + '"]').first ++ domain_disk = REXML::XPath.match(xml_descr, '/domain/devices/disk[@device="disk"]/alias[@name="ua-disk-volume-' + index.to_s + '"]').first + domain_disk = domain_disk.parent if !domain_disk.nil? + else + # otherwise fallback to find the disk by device if specified by user + # and finally index counting with offset and hope the match is correct + if !disk[:device].nil? +- domain_disk = REXML::XPath.match(disks_xml, './target[@dev="' + disk[:device] + '"]').first ++ domain_disk = REXML::XPath.match(xml_descr, '/domain/devices/disk[@device="disk"]/target[@dev="' + disk[:device] + '"]').first + domain_disk = domain_disk.parent if !domain_disk.nil? + else + domain_disk = disks_xml[offset + index] +diff --git a/lib/vagrant-libvirt/action/resolve_disk_settings.rb b/lib/vagrant-libvirt/action/resolve_disk_settings.rb +index f1a3f6755..add3e1021 100644 +--- a/lib/vagrant-libvirt/action/resolve_disk_settings.rb ++++ b/lib/vagrant-libvirt/action/resolve_disk_settings.rb +@@ -50,18 +50,19 @@ def call(env) + domain_xml = libvirt_domain.xml_desc(1) + xml_descr = REXML::Document.new(domain_xml) + domain_name = xml_descr.elements['domain'].elements['name'].text +- disks_xml = REXML::XPath.match(xml_descr, '/domain/devices/disk[@device="disk"]') +- have_aliases = !REXML::XPath.match(disks_xml, './alias[@name="ua-box-volume-0"]').first.nil? ++ have_aliases = !REXML::XPath.match(xml_descr, '/domain/devices/disk[@device="disk"]/alias[@name="ua-box-volume-0"]').first.nil? + env[:ui].warn(I18n.t('vagrant_libvirt.domain_xml.obsolete_method')) unless have_aliases + + if have_aliases +- REXML::XPath.match(disks_xml, +- './alias[contains(@name, "ua-box-volume-")]').each_with_index do |alias_xml, idx| ++ REXML::XPath.match(xml_descr, ++ '/domain/devices/disk[@device="disk"]/alias[contains(@name, "ua-box-volume-")]' ++ ).each_with_index do |alias_xml, idx| + domain_volumes.push(volume_from_xml(alias_xml.parent, domain_name, idx)) + end + else + # fallback to try and infer which boxes are box images, as they are listed first + # as soon as there is no match, can exit ++ disks_xml = REXML::XPath.match(xml_descr, '/domain/devices/disk[@device="disk"]') + disks_xml.each_with_index do |box_disk_xml, idx| + diskname = box_disk_xml.elements['source'].attributes['file'].rpartition('/').last + diff --git a/vagrant-libvirt.spec b/vagrant-libvirt.spec index 24ccf6b..f858028 100644 --- a/vagrant-libvirt.spec +++ b/vagrant-libvirt.spec @@ -4,7 +4,7 @@ Name: %{vagrant_plugin_name} Version: 0.11.2 -Release: 7%{?dist} +Release: 8%{?dist} Summary: libvirt provider for Vagrant License: MIT URL: https://github.com/vagrant-libvirt/vagrant-libvirt @@ -30,6 +30,9 @@ Patch2: vagrant-libvirt-pr1837-testsuite-support-rexml-332.patch # no longer supported by fog-libvirt # https://github.com/vagrant-libvirt/vagrant-libvirt/pull/1835 Patch3: vagrant-libvirt-0.12.2-Remove-config-unsupported-by-fog-libvirt.patch +# Fix compatibility with REXML 3.4.2+ +# https://github.com/vagrant-libvirt/vagrant-libvirt/pull/1861 +Patch4: vagrant-libvirt-0.12.2-Fix-REXML-3-4-2-compatibility.patch # Enable QEMU Session by default # https://github.com/vagrant-libvirt/vagrant-libvirt/pull/969 @@ -80,6 +83,7 @@ Documentation for %{name}. %patch 1 -p1 %patch 2 -p1 %patch 3 -p1 +%patch 4 -p1 %patch 100 -p1 %build @@ -149,6 +153,9 @@ popd %{vagrant_plugin_instdir}/spec %changelog +* Mon Nov 03 2025 Vít Ondruch - 0.11.2-8 +- Fix compatibility with REXML 3.4.2+ + * Fri Jul 25 2025 Fedora Release Engineering - 0.11.2-7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild From 217c27305070ec6020e7123d425bd8e50b10e028 Mon Sep 17 00:00:00 2001 From: Jarek Prokop Date: Tue, 16 Dec 2025 12:28:31 +0100 Subject: [PATCH 29/31] Fix Ruby 4.0 compatibility by replacing CGI with URI equivalent. Ruby 4.0 removed CGI gem from bundled gems, with the exception of CGI #escape and #unescape methods from the C extension Instead of adding CGI as a dependency, replace it with URI equivalent and some data massaging to keep existing behavior. --- ...eplace-CGI.parse-with-URI-equivalent.patch | 41 +++++++++++++++++++ vagrant-libvirt.spec | 9 +++- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 vagrant-libvirt-0.12.2-Replace-CGI.parse-with-URI-equivalent.patch diff --git a/vagrant-libvirt-0.12.2-Replace-CGI.parse-with-URI-equivalent.patch b/vagrant-libvirt-0.12.2-Replace-CGI.parse-with-URI-equivalent.patch new file mode 100644 index 0000000..1e041d2 --- /dev/null +++ b/vagrant-libvirt-0.12.2-Replace-CGI.parse-with-URI-equivalent.patch @@ -0,0 +1,41 @@ +From dfb9fd59bd6eca13f4e22e5038247473f9cd108d Mon Sep 17 00:00:00 2001 +From: Jarek Prokop +Date: Tue, 16 Dec 2025 12:18:01 +0100 +Subject: [PATCH] Replace CGI.parse with URI equivalent. + +For Ruby 4.0 compatibility, where CGI is no longer a part +of the upstream Ruby distribution. + +Replace the CGI.parse with URI.decode_www_form and some filtering +on top so that the replacement keeps existing behavior. +--- + lib/vagrant-libvirt/config.rb | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/lib/vagrant-libvirt/config.rb b/lib/vagrant-libvirt/config.rb +index cdee174..96261ca 100644 +--- a/lib/vagrant-libvirt/config.rb ++++ b/lib/vagrant-libvirt/config.rb +@@ -1,6 +1,6 @@ + # frozen_string_literal: true + +-require 'cgi' ++require 'uri' + + require 'vagrant' + require 'vagrant/action/builtin/mixin_synced_folders' +@@ -1335,8 +1335,12 @@ module VagrantPlugins + @username = nil if @username == UNSET_VALUE + @username = uri.user if uri.user + if uri.query +- params = CGI.parse(uri.query) +- @id_ssh_key_file = params['keyfile'].first if params.has_key?('keyfile') ++ params = URI ++ .decode_www_form(uri.query) ++ .select { |k, v| k == 'keyfile' } ++ .map { |_,v| v } ++ .first ++ @id_ssh_key_file = params if params + end + + finalize_id_ssh_key_file diff --git a/vagrant-libvirt.spec b/vagrant-libvirt.spec index f858028..30c1472 100644 --- a/vagrant-libvirt.spec +++ b/vagrant-libvirt.spec @@ -4,7 +4,7 @@ Name: %{vagrant_plugin_name} Version: 0.11.2 -Release: 8%{?dist} +Release: 9%{?dist} Summary: libvirt provider for Vagrant License: MIT URL: https://github.com/vagrant-libvirt/vagrant-libvirt @@ -33,6 +33,9 @@ Patch3: vagrant-libvirt-0.12.2-Remove-config-unsupported-by-fog-libvirt.patch # Fix compatibility with REXML 3.4.2+ # https://github.com/vagrant-libvirt/vagrant-libvirt/pull/1861 Patch4: vagrant-libvirt-0.12.2-Fix-REXML-3-4-2-compatibility.patch +# Replace CGI, removed from Ruby 4.0 bundled gems with URI. +# https://github.com/vagrant-libvirt/vagrant-libvirt/pull/1866 +Patch5: vagrant-libvirt-0.12.2-Replace-CGI.parse-with-URI-equivalent.patch # Enable QEMU Session by default # https://github.com/vagrant-libvirt/vagrant-libvirt/pull/969 @@ -84,6 +87,7 @@ Documentation for %{name}. %patch 2 -p1 %patch 3 -p1 %patch 4 -p1 +%patch 5 -p1 %patch 100 -p1 %build @@ -153,6 +157,9 @@ popd %{vagrant_plugin_instdir}/spec %changelog +* Tue Dec 16 2025 Jarek Prokop - 0.11.2-9 +- Fix Ruby 4.0 compatibility by replacing CGI with URI equivalent. + * Mon Nov 03 2025 Vít Ondruch - 0.11.2-8 - Fix compatibility with REXML 3.4.2+ From 53115c344528e532a623aefcb82b3704bed8ac9c Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 17 Jan 2026 19:45:51 +0000 Subject: [PATCH 30/31] Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild --- vagrant-libvirt.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vagrant-libvirt.spec b/vagrant-libvirt.spec index 30c1472..3b831e4 100644 --- a/vagrant-libvirt.spec +++ b/vagrant-libvirt.spec @@ -4,7 +4,7 @@ Name: %{vagrant_plugin_name} Version: 0.11.2 -Release: 9%{?dist} +Release: 10%{?dist} Summary: libvirt provider for Vagrant License: MIT URL: https://github.com/vagrant-libvirt/vagrant-libvirt @@ -157,6 +157,9 @@ popd %{vagrant_plugin_instdir}/spec %changelog +* Sat Jan 17 2026 Fedora Release Engineering - 0.11.2-10 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild + * Tue Dec 16 2025 Jarek Prokop - 0.11.2-9 - Fix Ruby 4.0 compatibility by replacing CGI with URI equivalent. From 139e99ed196aa16f8095bd6a70cb555e1eea093d Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 17 Jul 2026 08:20:36 +0000 Subject: [PATCH 31/31] Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild --- vagrant-libvirt.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vagrant-libvirt.spec b/vagrant-libvirt.spec index 3b831e4..ad18051 100644 --- a/vagrant-libvirt.spec +++ b/vagrant-libvirt.spec @@ -4,7 +4,7 @@ Name: %{vagrant_plugin_name} Version: 0.11.2 -Release: 10%{?dist} +Release: 11%{?dist} Summary: libvirt provider for Vagrant License: MIT URL: https://github.com/vagrant-libvirt/vagrant-libvirt @@ -157,6 +157,9 @@ popd %{vagrant_plugin_instdir}/spec %changelog +* Fri Jul 17 2026 Fedora Release Engineering - 0.11.2-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild + * Sat Jan 17 2026 Fedora Release Engineering - 0.11.2-10 - Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild