diff --git a/.gitignore b/.gitignore index b81481f..431f986 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ -/vagrant-libvirt-*.gem -/vagrant-spec-*.tar.gz +/vagrant-libvirt-0.0.24.gem +/vagrant-libvirt-0.0.25.gem +/vagrant-libvirt-0.0.26.gem diff --git a/10-vagrant-libvirt.rules b/10-vagrant-libvirt.rules new file mode 100644 index 0000000..0e2f77d --- /dev/null +++ b/10-vagrant-libvirt.rules @@ -0,0 +1,11 @@ +/* + * Allow users in vagrant group to manage libvirt without authentication. + * Copy this file to /usr/share/polkit-1/rules.d/ to activate. + */ +polkit.addRule(function(action, subject) { + if ((action.id == "org.libvirt.unix.manage" + || action.id == "org.libvirt.unix.monitor") + && subject.isInGroup("vagrant")) { + return polkit.Result.YES; + } +}); diff --git a/sources b/sources index 28d90dc..cfeab69 100644 --- a/sources +++ b/sources @@ -1,2 +1 @@ -SHA512 (vagrant-libvirt-0.11.2.gem) = f66be1c8301ad4a9e731cf65c2ea3181f3c5e4c1d252411465060ab8ddabc294beab40e214fa8c9c5a7aa1e116030f60cea2e337121d95123c724ec6e529bfbc -SHA512 (vagrant-spec-259c55e204674f2b006700c6d351d04250d13b04.tar.gz) = 7938a6f8091b7dd76266e63d2cb653820e55a262091be0aaae2f5515321fa4d50301f547ab925771208b8616c7fc819cb642b3b9d444cd7a722ba712538cf68f +011bd6709c3d80a50951347877da94e6 vagrant-libvirt-0.0.26.gem 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 deleted file mode 100644 index 41976a2..0000000 --- a/vagrant-libvirt-0.11.2-Allow-a-mock-object-to-receive-synced_folders.patch +++ /dev/null @@ -1,28 +0,0 @@ -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-0.11.2-enable-qemu-session-by-default.patch b/vagrant-libvirt-0.11.2-enable-qemu-session-by-default.patch deleted file mode 100644 index 19bd4fc..0000000 --- a/vagrant-libvirt-0.11.2-enable-qemu-session-by-default.patch +++ /dev/null @@ -1,53 +0,0 @@ -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-0.12.2-Fix-REXML-3-4-2-compatibility.patch b/vagrant-libvirt-0.12.2-Fix-REXML-3-4-2-compatibility.patch deleted file mode 100644 index feed62b..0000000 --- a/vagrant-libvirt-0.12.2-Fix-REXML-3-4-2-compatibility.patch +++ /dev/null @@ -1,116 +0,0 @@ -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-0.12.2-Remove-config-unsupported-by-fog-libvirt.patch b/vagrant-libvirt-0.12.2-Remove-config-unsupported-by-fog-libvirt.patch deleted file mode 100644 index 2d40e76..0000000 --- a/vagrant-libvirt-0.12.2-Remove-config-unsupported-by-fog-libvirt.patch +++ /dev/null @@ -1,31 +0,0 @@ -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-0.12.2-Replace-CGI.parse-with-URI-equivalent.patch b/vagrant-libvirt-0.12.2-Replace-CGI.parse-with-URI-equivalent.patch deleted file mode 100644 index 1e041d2..0000000 --- a/vagrant-libvirt-0.12.2-Replace-CGI.parse-with-URI-equivalent.patch +++ /dev/null @@ -1,41 +0,0 @@ -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-fix-dependencies.patch b/vagrant-libvirt-fix-dependencies.patch new file mode 100644 index 0000000..7ad4da1 --- /dev/null +++ b/vagrant-libvirt-fix-dependencies.patch @@ -0,0 +1,40 @@ +diff --git a/vagrant-libvirt.gemspec b/vagrant-libvirt.gemspec +index 83005c1..c513c6f 100644 +--- a/vagrant-libvirt.gemspec ++++ b/vagrant-libvirt.gemspec +@@ -25,27 +25,27 @@ Gem::Specification.new do |s| + s.add_development_dependency(%q, ["~> 2.12.2"]) + s.add_development_dependency(%q, ["~> 2.12.1"]) + s.add_development_dependency(%q, ["~> 2.12.1"]) +- s.add_runtime_dependency(%q, ["~> 1.15"]) +- s.add_runtime_dependency(%q, ["~> 0.4"]) ++ s.add_runtime_dependency(%q, [">= 1.23"]) ++ s.add_runtime_dependency(%q, [">= 0.4.0"], ["< 0.6.0"]) + s.add_runtime_dependency(%q, ["~> 1.6.0"]) + s.add_development_dependency(%q, [">= 0"]) + else + s.add_dependency(%q, ["~> 2.12.2"]) + s.add_dependency(%q, ["~> 2.12.1"]) + s.add_dependency(%q, ["~> 2.12.1"]) +- s.add_dependency(%q, ["~> 1.15"]) +- s.add_dependency(%q, ["~> 0.4"]) ++ s.add_dependency(%q, [">= 1.23"]) ++ s.add_dependency(%q, [">= 0.4.0"], ["< 0.6.0"]) + s.add_dependency(%q, ["~> 1.6.0"]) + s.add_dependency(%q, [">= 0"]) + end + else + s.add_dependency(%q, ["~> 2.12.2"]) + s.add_dependency(%q, ["~> 2.12.1"]) + s.add_dependency(%q, ["~> 2.12.1"]) +- s.add_dependency(%q, ["~> 1.15"]) +- s.add_dependency(%q, ["~> 0.4"]) ++ s.add_dependency(%q, [">= 1.23"]) ++ s.add_dependency(%q, [">= 0.4.0"], ["< 0.6.0"]) + s.add_dependency(%q, ["~> 1.6.0"]) + s.add_dependency(%q, [">= 0"]) + end + end + +-- +1.9.3 diff --git a/vagrant-libvirt-fix-dhcp-lease-parsing.patch b/vagrant-libvirt-fix-dhcp-lease-parsing.patch new file mode 100644 index 0000000..65e4cb1 --- /dev/null +++ b/vagrant-libvirt-fix-dhcp-lease-parsing.patch @@ -0,0 +1,44 @@ +From 6fb57de11e316cfac44c175b7f5ac23c637e1413 Mon Sep 17 00:00:00 2001 +From: Dan Williams +Date: Fri, 1 May 2015 09:42:44 -0500 +Subject: [PATCH] Fix retrieving VM IP address if there are multiple leases for + the same VM + +If DHCP is used as the addressing mode of the VM it may receive various IP +addresses over time. Thus dnsmasq can report all these addresses for a single +machine, which gives us: + +addresses {:public=>["192.168.121.180\n192.168.121.184\n192.168.121.183\n192.168.121.182"], + :private=>["192.168.121.180\n192.168.121.184\n192.168.121.183\n192.168.121.182"]} + +This causes the most problems when NFS is used as the shared folder mechanism, +as the IP addresses pile up and a malformed /etc/exports is written. This in +turn causes sequences of vagrant halt / vagrant up to receive read-only NFS +exports due to the bad format: + + # VAGRANT-BEGIN: 1000 d943c68a-330b-4cb8-8711-53506a6c176e + "/home/user/folder" 192.168.121.52 + 192.168.121.51(rw,no_subtree_check,all_squash,anonuid=1000,anongid=1000,fsid=3414715164) + # VAGRANT-END: 1000 d943c68a-330b-4cb8-8711-53506a6c176e + +It appears that Vagrant expects that the value returned by read_ssh_info is +just a single IP address, so pick the first IP address reported by dnsmasq. +--- + lib/vagrant-libvirt/action/read_ssh_info.rb | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/lib/vagrant-libvirt/action/read_ssh_info.rb b/lib/vagrant-libvirt/action/read_ssh_info.rb +index 01e32a7..0bee747 100644 +--- a/lib/vagrant-libvirt/action/read_ssh_info.rb ++++ b/lib/vagrant-libvirt/action/read_ssh_info.rb +@@ -34,7 +34,9 @@ def read_ssh_info(libvirt, machine) + ip_address = nil + domain.wait_for(2) { + addresses.each_pair do |type, ip| +- ip_address = ip[0] if ip[0] != nil ++ # Multiple leases are separated with a newline, return only ++ # the most recent address ++ ip_address = ip[0].split("\n").first if ip[0] != nil + end + ip_address != nil + } diff --git a/vagrant-libvirt-fix-halting.patch b/vagrant-libvirt-fix-halting.patch new file mode 100644 index 0000000..94719f5 --- /dev/null +++ b/vagrant-libvirt-fix-halting.patch @@ -0,0 +1,37 @@ +From cc8aadc9de397441b7e2a10eecc76feb6143b4c7 Mon Sep 17 00:00:00 2001 +From: Josef Stribny +Date: Tue, 21 Apr 2015 09:04:53 +0200 +Subject: [PATCH] Wait for libvirt to shutdown the domain + +Fixes #293 +--- + lib/vagrant-libvirt/action/read_state.rb | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/lib/vagrant-libvirt/action/read_state.rb b/lib/vagrant-libvirt/action/read_state.rb +index ad552a1..1848de4 100644 +--- a/lib/vagrant-libvirt/action/read_state.rb ++++ b/lib/vagrant-libvirt/action/read_state.rb +@@ -27,10 +27,17 @@ module VagrantPlugins + end + # Find the machine + begin ++ # Wait for libvirt to shutdown the domain ++ while libvirt.servers.get(machine.id).state.to_sym == :'shutting-down' do ++ @logger.info('Waiting on the machine to shut down...') ++ sleep 1 ++ end ++ + server = libvirt.servers.get(machine.id) +- if server.nil? || [:'shutting-down', :terminated].include?(server.state.to_sym) ++ ++ if server.nil? || server.state.to_sym == :terminated + # The machine can't be found +- @logger.info('Machine shutting down or terminated, assuming it got destroyed.') ++ @logger.info('Machine terminated, assuming it got destroyed.') + machine.id = nil + return :not_created + end +-- +2.1.0 + diff --git a/vagrant-libvirt-handle-private-networks-with-type-dhcp.patch b/vagrant-libvirt-handle-private-networks-with-type-dhcp.patch new file mode 100644 index 0000000..b82b1f2 --- /dev/null +++ b/vagrant-libvirt-handle-private-networks-with-type-dhcp.patch @@ -0,0 +1,70 @@ +From 6c2bd8d897056b50f838dd85ad37d7de8a7821e5 Mon Sep 17 00:00:00 2001 +From: Pavel Valena +Date: Tue, 19 Jan 2016 14:29:30 +0100 +Subject: [PATCH] Handle private networks with type DHCP Resolves rhbz#1299829 + +--- + lib/vagrant-libvirt/action/create_networks.rb | 40 +++++++++++++++++++++++++++ + 1 file changed, 40 insertions(+) + +diff --git a/lib/vagrant-libvirt/action/create_networks.rb b/lib/vagrant-libvirt/action/create_networks.rb +index 7ef4643..9ffe191 100644 +--- a/lib/vagrant-libvirt/action/create_networks.rb ++++ b/lib/vagrant-libvirt/action/create_networks.rb +@@ -61,6 +61,8 @@ module VagrantPlugins + + if @options[:ip] + handle_ip_option(env) ++ elsif @options[:type].to_s == 'dhcp' ++ handle_dhcp_private_network(env) + # in vagrant 1.2.3 and later it is not possible to take this branch + # because cannot have name without ip + # https://github.com/mitchellh/vagrant/commit/cf2f6da4dbcb4f57c9cdb3b94dcd0bba62c5f5fd +@@ -218,6 +220,44 @@ module VagrantPlugins + end + end + ++ def handle_dhcp_private_network(env) ++ net_address = '172.28.128.0' ++ network = lookup_network_by_ip(net_address) ++ @interface_network = network if network ++ ++ # Do we need to create new network? ++ unless @interface_network[:created] ++ @interface_network[:name] = 'vagrant-private-dhcp' ++ @interface_network[:network_address] = net_address ++ ++ # Set IP address of network (actually bridge). It will be used as ++ # gateway address for machines connected to this network. ++ @interface_network[:ip_address] = get_host_ip_addr(net_address) ++ ++ # Generate a unique name for network bridge. ++ @interface_network[:bridge_name] = generate_bridge_name ++ ++ # Create a private network. ++ create_private_network(env) ++ end ++ end ++ ++ # Return provided address or first address of network otherwise ++ def get_host_ip_addr(network) ++ @options[:host_ip] ? IPAddr.new(@options[:host_ip]) : IPAddr.new(network).s$ ++ end ++ ++ # Return the first available virbr interface name ++ def generate_bridge_name ++ @logger.debug "generating name for bridge" ++ count = 0 ++ while lookup_bridge_by_name(bridge_name = "virbr#{count}") ++ count += 1 ++ end ++ @logger.debug "found available bridge name #{bridge_name}" ++ bridge_name ++ end ++ + def create_private_network(env) + @network_name = @interface_network[:name] + @network_bridge_name = @interface_network[:bridge_name] +-- +2.5.0 + diff --git a/vagrant-libvirt-match-interface-by-mac.patch b/vagrant-libvirt-match-interface-by-mac.patch new file mode 100644 index 0000000..699b852 --- /dev/null +++ b/vagrant-libvirt-match-interface-by-mac.patch @@ -0,0 +1,69 @@ +From ee7afab369dc7e80128ff35a2ff11f6eab23d368 Mon Sep 17 00:00:00 2001 +From: Dan Williams +Date: Tue, 30 Jun 2015 16:24:30 -0500 +Subject: [PATCH] Read MAC address from libvirt and pass up to Vagrant + +Configuring networks based solely on slot numbers doesn't work very +well, since there's no way to guarantee that the interface Vagrant +finds is the same one that vagrant-libvirt created at that index. + +For example, Vagrant's Fedora configure_networks action does this: + + machine.communicate.sudo("ls /sys/class/net | grep -v lo") do |_, result| + interface_names = result.split("\n") + end + + interface_names = networks.map do |network| + "#{interface_names[network[:interface]]}" + end + +which means that if your image has 'docker' pre-installed, then +interface_names[0] = "docker0" and hilarity ensues, with the first +non-management network being assigned to the vagrant-libvirt +management interface. + +Since interface names are very unreliable (they can be renamed by +udev at will or when hardware changes) the only way to ensure that +the interface vagrant-libvirt attaches to the domain maps to the +correct one inside the VM is by MAC address. Pull the MAC address +out of the libvirt config once the interface has been attached and +pass that up to Vagrant so we have a chance of doing the right thing. +--- + lib/vagrant-libvirt/action/create_network_interfaces.rb | 17 ++++++++++++++++- + 1 file changed, 16 insertions(+), 1 deletion(-) + +diff --git a/lib/vagrant-libvirt/action/create_network_interfaces.rb b/lib/vagrant-libvirt/action/create_network_interfaces.rb +index 35886ad..cbe7562 100644 +--- a/lib/vagrant-libvirt/action/create_network_interfaces.rb ++++ b/lib/vagrant-libvirt/action/create_network_interfaces.rb +@@ -96,6 +96,21 @@ def call(env) + raise Errors::AttachDeviceError, + :error_message => e.message + end ++ ++ # Re-read the network configuration and grab the MAC address ++ if !@mac ++ xml = Nokogiri::XML(domain.xml_desc) ++ if iface_configuration[:iface_type] == :public_network ++ if @type == 'direct' ++ @mac = xml.xpath("/domain/devices/interface[source[@dev='#{@device}']]/mac/@address") ++ else ++ @mac = xml.xpath("/domain/devices/interface[source[@bridge='#{@device}']]/mac/@address") ++ end ++ else ++ @mac = xml.xpath("/domain/devices/interface[source[@network='#{@network_name}']]/mac/@address") ++ end ++ iface_configuration[:mac] = @mac.to_s ++ end + end + + # Continue the middleware chain. +@@ -116,7 +131,7 @@ def call(env) + network = { + :interface => slot_number, + :use_dhcp_assigned_default_route => options[:use_dhcp_assigned_default_route], +- #:mac => ..., ++ :mac_address => options[:mac], + } + + if options[:ip] diff --git a/vagrant-libvirt-pr1709-ruby32-File_exists-URL-parse.patch b/vagrant-libvirt-pr1709-ruby32-File_exists-URL-parse.patch deleted file mode 100644 index cbaad23..0000000 --- a/vagrant-libvirt-pr1709-ruby32-File_exists-URL-parse.patch +++ /dev/null @@ -1,111 +0,0 @@ -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 -@@ -1320,8 +1320,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-pr1837-testsuite-support-rexml-332.patch b/vagrant-libvirt-pr1837-testsuite-support-rexml-332.patch deleted file mode 100644 index dbffb41..0000000 --- a/vagrant-libvirt-pr1837-testsuite-support-rexml-332.patch +++ /dev/null @@ -1,81 +0,0 @@ -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 -@@ -364,7 +364,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) -@@ -385,7 +385,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) -@@ -399,7 +399,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) -@@ -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') -- 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) -@@ -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') -- 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) -@@ -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') -- 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 ad18051..17a67ef 100644 --- a/vagrant-libvirt.spec +++ b/vagrant-libvirt.spec @@ -1,78 +1,59 @@ %global vagrant_plugin_name vagrant-libvirt -%global vagrant_spec_commit 259c55e204674f2b006700c6d351d04250d13b04 - Name: %{vagrant_plugin_name} -Version: 0.11.2 -Release: 11%{?dist} +Version: 0.0.26 +Release: 4%{?dist} Summary: libvirt provider for Vagrant +Group: Development/Languages License: MIT -URL: https://github.com/vagrant-libvirt/vagrant-libvirt +URL: https://github.com/pradels/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/03d88fe2467716b072951c2b55d78223130851a6/vagrant-spec-03d88fe2467716b072951c2b55d78223130851a6.tar.gz -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 -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 -# 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 -# 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 -Patch100: vagrant-libvirt-0.11.2-enable-qemu-session-by-default.patch - +Source1: 10-vagrant-libvirt.rules +# Adjust Vagrant's dependencies. +Patch0: vagrant-libvirt-fix-dependencies.patch +# Wait for libvirt to shutdown the domain +# https://github.com/pradels/vagrant-libvirt/pull/347 +Patch1: vagrant-libvirt-fix-halting.patch +# Fix parsing leases when 'vagrant halt; vagrant up' is called +# https://github.com/pradels/vagrant-libvirt/pull/356 +Patch2: vagrant-libvirt-fix-dhcp-lease-parsing.patch +# Pass MAC addresses up to vagrant to ensure interfaces are configured correctly +# https://github.com/pradels/vagrant-libvirt/pull/408 +Patch3: vagrant-libvirt-match-interface-by-mac.patch +# Handle private networks with type DHCP +# Resolves rhbz#1299829 +Patch4: vagrant-libvirt-handle-private-networks-with-type-dhcp.patch +Requires(pre): shadow-utils +Requires(posttrans): vagrant +Requires(preun): vagrant Requires: ruby(release) Requires: ruby(rubygems) -Requires: rubygem(diffy) -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(diffy) -BuildRequires: rubygem(fog-libvirt) -BuildRequires: rubygem(rake) -BuildRequires: rubygem(rdoc) -BuildRequires: rubygem(rexml) -BuildRequires: rubygem(rspec) -BuildRequires: rubygem(thor) -BuildRequires: rubygem(xml-simple) -BuildRequires: rubygems-devel -BuildRequires: %{_bindir}/ps +Requires: rubygem(fog) => 1.23 +Requires: rubygem(fog) < 2 +Requires: rubygem(ruby-libvirt) +#Requires: rubygem(ruby-libvirt) => 0.5.0 +#Requires: rubygem(ruby-libvirt) < 0.6 +Requires: rubygem(nokogiri) => 1.6.0 +Requires: rubygem(nokogiri) < 1.7 +Requires: rubygem(multi_json) +Requires: libvirt +# vagrant-libvirt supports only kvm and qemu for now. +# https://github.com/pradels/vagrant-libvirt#provider-options +Requires: polkit +Requires: vagrant +BuildRequires: vagrant +BuildRequires: rubygem(rspec) < 3 +BuildRequires: rubygem(fog) +BuildRequires: rubygem(ruby-libvirt) BuildArch: noarch Provides: vagrant(%{vagrant_plugin_name}) = %{version} %description libvirt provider for Vagrant. - %package doc Summary: Documentation for %{name} +Group: Documentation Requires: %{name} = %{version}-%{release} BuildArch: noarch @@ -80,18 +61,20 @@ BuildArch: noarch Documentation for %{name}. %prep -%setup -q -n %{vagrant_plugin_name}-%{version} -b 1 +gem unpack %{SOURCE0} -%patch 0 -p1 -%patch 1 -p1 -%patch 2 -p1 -%patch 3 -p1 -%patch 4 -p1 -%patch 5 -p1 -%patch 100 -p1 +%setup -q -D -T -n %{vagrant_plugin_name}-%{version} + +gem spec %{SOURCE0} -l --ruby > %{vagrant_plugin_name}.gemspec + +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 %build -gem build ../%{vagrant_plugin_name}-%{version}.gemspec +gem build %{vagrant_plugin_name}.gemspec %vagrant_plugin_install %install @@ -99,235 +82,65 @@ mkdir -p %{buildroot}%{vagrant_plugin_dir} cp -a .%{vagrant_plugin_dir}/* \ %{buildroot}%{vagrant_plugin_dir}/ +# polkit rule for vagrant group. +#mkdir -p %{buildroot}%{_datadir}/polkit-1/rules.d +#install -m 0644 %{SOURCE1} %{buildroot}%{_datadir}/polkit-1/rules.d/ +mkdir -p %{buildroot}%{vagrant_plugin_docdir}/polkit +install -m 0644 %{SOURCE1} %{buildroot}%{vagrant_plugin_docdir}/polkit + %check -# 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. -sed -i '/thor/ s/~>/>=/' vagrant-spec.gemspec -sed -i '/rspec/ s/~>/>=/' vagrant-spec.gemspec -popd - -# Use actual gemspec for tests -cp ../%{vagrant_plugin_name}-%{version}.gemspec .%{vagrant_plugin_instdir}/%{vagrant_plugin_name}.gemspec - pushd .%{vagrant_plugin_instdir} -# Create dummy Gemfile and load dependencies via gemspec file -cat > Gemfile < '%{_builddir}/vagrant-spec-%{vagrant_spec_commit}' -gemspec -EOG - -# 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 +sed -i '/:git/ s|:git.*$|:path => "%{vagrant_dir}"|' Gemfile +sed -i '/pry/d' Gemfile +sed -i '10igem "rspec", "~> 2.0"' Gemfile +sed -i '/rspec/ s|\[\".*\"]|["~> 2.0"]|' vagrant-libvirt.gemspec +bundle exec rspec2 spec popd +%pre +getent group vagrant >/dev/null || groupadd -r vagrant + +%posttrans +%vagrant_plugin_register %{vagrant_plugin_name} + +%preun +%vagrant_plugin_unregister %{vagrant_plugin_name} + %files %dir %{vagrant_plugin_instdir} -%exclude %{vagrant_plugin_instdir}/.* %license %{vagrant_plugin_instdir}/LICENSE +%doc %{vagrant_plugin_instdir}/README.md %{vagrant_plugin_libdir} %{vagrant_plugin_instdir}/locales +%{vagrant_plugin_instdir}/tools %exclude %{vagrant_plugin_cache} +%exclude %{vagrant_plugin_instdir}/.gitignore %{vagrant_plugin_spec} +# polkit +# TODO: Disabled for now, since this might have security implications. +#%exclude %{_datadir}/polkit-1/rules.d/10-vagrant-libvirt.rules %files doc %doc %{vagrant_plugin_docdir} -%doc %{vagrant_plugin_instdir}/README.md +%doc %{vagrant_plugin_instdir}/example_box +%doc %{vagrant_plugin_instdir}/CHANGELOG.md +%{vagrant_plugin_instdir}/Rakefile +%{vagrant_plugin_instdir}/Gemfile +%{vagrant_plugin_instdir}/vagrant-libvirt.gemspec %{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 +* Tue Jan 19 2016 Pavel Valena - 0.0.26-4 +- Fix: Handle private networks with type DHCP (rhbz#1299829) +- Add rspec dependency to Gemfile +- Remove unnecessary libvirt-daemon-kvm from Reqires -* 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. - -* 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 - -* 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. - -* 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 - -* 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 - -* 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) - -* 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. - -* 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 - -* 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 - -* 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 - -* 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 - -* 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 - -* Sun Sep 08 2019 Tadej Janež - 0.0.45-3 -- Backport/Add useful features and fixes from upstream: - - Allow customizing of virt-sysprep behaviour on package. - - Use fetch to obtain environment variable value in package_domain. - - Halt a domain before packaging it as a box to avoid hard to debug issues. - -* Sat Jul 27 2019 Fedora Release Engineering - 0.0.45-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild - -* Thu Feb 14 2019 Pavel Valena - 0.0.45-1 -- Update to vagrant-libvirt 0.0.45. -- Enable QEMU Session by default - -* Sun Feb 03 2019 Fedora Release Engineering - 0.0.43-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild - -* Fri Nov 02 2018 Pavel Valena - 0.0.43-2 -- Relax fog-core dependency to work with recently rebased one. - -* Mon Oct 01 2018 pvalena - 0.0.43-1 -- Update to vagrant-libvirt 0.0.43. - -* Sat Jul 14 2018 Fedora Release Engineering - 0.0.40-5 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild - -* Fri Feb 09 2018 Fedora Release Engineering - 0.0.40-4 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild - -* Fri Dec 08 2017 Pavel Valena - 0.0.40-3 -- Fix invalid XML creation on custom domain name (rhbz#1518899). - -* Thu Jul 27 2017 Fedora Release Engineering - 0.0.40-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild - -* Mon Jun 19 2017 Vít Ondruch - 0.0.40-1 -- Update to vagrant-libvirt 0.0.40. - -* Fri Feb 24 2017 Vít Ondruch - 0.0.37-4 -- Fix Vagrant error when network is specified (rhbz#1426565). - -* Mon Feb 13 2017 Vít Ondruch - 0.0.37-3 -- Fix compatiblity with Vagrant 1.9.1. - -* Mon Feb 06 2017 Vít Ondruch - 0.0.37-2 -- Use file dependency rather then package dependency. - -* Wed Feb 01 2017 Vít Ondruch - 0.0.37-1 -- Update to vagrant-libvirt 0.0.37. -- Recommends libguestfs required by "vagrant package" (rhbz#1292217). - -* Thu Jan 05 2017 Vít Ondruch - 0.0.36-2 -- Fix compatibility with latest Bundler (rhbz#1409381). - -* Sun Jan 1 2017 Mamoru TASAKA - 0.0.36-2 -- Relax nokogiri dependency - -* Mon Oct 10 2016 Vít Ondruch - 0.0.36-1 -- Update to vagrant-libvirt 0.0.36. - -* Tue Oct 04 2016 Vít Ondruch - 0.0.35-1 -- Update to vagrant-libvirt 0.0.35. - -* Wed Aug 03 2016 Vít Ondruch - 0.0.33-1 -- Update to vagrant-libvirt 0.0.33. -- Drop the polkit rules. Use libvirt group instead. - -* Fri Feb 05 2016 Fedora Release Engineering - 0.0.32-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild - -* Wed Oct 14 2015 Josef Stribny - 0.0.32-1 -- Update to 0.0.32 - -* Mon Oct 05 2015 Josef Stribny - 0.0.31-1 -- Update to 0.0.31 - -* Mon Sep 14 2015 Josef Stribny - 0.0.30-5 -- Drop the rest of libvirt deps, they should be pulled via ruby-libvirt - -* Mon Sep 14 2015 Josef Stribny - 0.0.30-4 -- Drop unnecessary explicit libvirt require - -* Fri Jul 10 2015 Dan Williams - 0.0.30-3 +* Fri Jul 10 2015 Dan Williams - 0.0.26-3 +- Fix: parsing of DHCP leases when vagrant up/halt have been used - Fix: pass MAC addresses to vagrant to configure interfaces correctly -* Fri Jun 19 2015 Fedora Release Engineering - 0.0.30-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild - -* Mon Jun 08 2015 Michael Adam - 0.0.30-1 -- Update to 0.0.30 (#1220194) - * Tue Apr 21 2015 Josef Stribny - 0.0.26-2 - Fix: Wait for libvirt to shutdown the domain