Compare commits
4 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7be51b97b7 | ||
|
|
ca7c714b5e | ||
|
|
f7bbc773ba | ||
|
|
6246a308d5 |
6 changed files with 190 additions and 10 deletions
|
|
@ -1,4 +1,7 @@
|
|||
/* Allow users in vagrant group to manage libvirt without authentication */
|
||||
/*
|
||||
* 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")
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ index 83005c1..c513c6f 100644
|
|||
s.add_development_dependency(%q<rspec-mocks>, ["~> 2.12.1"])
|
||||
- s.add_runtime_dependency(%q<fog>, ["~> 1.15"])
|
||||
- s.add_runtime_dependency(%q<ruby-libvirt>, ["~> 0.4"])
|
||||
+ s.add_runtime_dependency(%q<fog>, [">= 1.23"])
|
||||
+ s.add_runtime_dependency(%q<fog>, [">= 1.22"])
|
||||
+ s.add_runtime_dependency(%q<ruby-libvirt>, [">= 0.4.0"], ["< 0.6.0"])
|
||||
s.add_runtime_dependency(%q<nokogiri>, ["~> 1.6.0"])
|
||||
s.add_development_dependency(%q<rake>, [">= 0"])
|
||||
|
|
@ -18,7 +18,7 @@ index 83005c1..c513c6f 100644
|
|||
s.add_dependency(%q<rspec-mocks>, ["~> 2.12.1"])
|
||||
- s.add_dependency(%q<fog>, ["~> 1.15"])
|
||||
- s.add_dependency(%q<ruby-libvirt>, ["~> 0.4"])
|
||||
+ s.add_dependency(%q<fog>, [">= 1.23"])
|
||||
+ s.add_dependency(%q<fog>, [">= 1.22"])
|
||||
+ s.add_dependency(%q<ruby-libvirt>, [">= 0.4.0"], ["< 0.6.0"])
|
||||
s.add_dependency(%q<nokogiri>, ["~> 1.6.0"])
|
||||
s.add_dependency(%q<rake>, [">= 0"])
|
||||
|
|
@ -29,7 +29,7 @@ index 83005c1..c513c6f 100644
|
|||
s.add_dependency(%q<rspec-mocks>, ["~> 2.12.1"])
|
||||
- s.add_dependency(%q<fog>, ["~> 1.15"])
|
||||
- s.add_dependency(%q<ruby-libvirt>, ["~> 0.4"])
|
||||
+ s.add_dependency(%q<fog>, [">= 1.23"])
|
||||
+ s.add_dependency(%q<fog>, [">= 1.22"])
|
||||
+ s.add_dependency(%q<ruby-libvirt>, [">= 0.4.0"], ["< 0.6.0"])
|
||||
s.add_dependency(%q<nokogiri>, ["~> 1.6.0"])
|
||||
s.add_dependency(%q<rake>, [">= 0"])
|
||||
|
|
|
|||
44
vagrant-libvirt-fix-dhcp-lease-parsing.patch
Normal file
44
vagrant-libvirt-fix-dhcp-lease-parsing.patch
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
From 6fb57de11e316cfac44c175b7f5ac23c637e1413 Mon Sep 17 00:00:00 2001
|
||||
From: Dan Williams <dcbw@redhat.com>
|
||||
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
|
||||
}
|
||||
37
vagrant-libvirt-fix-halting.patch
Normal file
37
vagrant-libvirt-fix-halting.patch
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
From cc8aadc9de397441b7e2a10eecc76feb6143b4c7 Mon Sep 17 00:00:00 2001
|
||||
From: Josef Stribny <jstribny@redhat.com>
|
||||
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
|
||||
|
||||
69
vagrant-libvirt-match-interface-by-mac.patch
Normal file
69
vagrant-libvirt-match-interface-by-mac.patch
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
From ee7afab369dc7e80128ff35a2ff11f6eab23d368 Mon Sep 17 00:00:00 2001
|
||||
From: Dan Williams <dcbw@redhat.com>
|
||||
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,
|
||||
- #:mac => ...,
|
||||
+ :mac_address => options[:mac],
|
||||
}
|
||||
|
||||
if options[:ip]
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Name: %{vagrant_plugin_name}
|
||||
Version: 0.0.24
|
||||
Release: 2%{?dist}
|
||||
Release: 5%{?dist}
|
||||
Summary: libvirt provider for Vagrant
|
||||
Group: Development/Languages
|
||||
License: MIT
|
||||
|
|
@ -14,12 +14,21 @@ Patch0: vagrant-libvirt-fix-dependencies.patch
|
|||
# Shebang in Rakefile doesn't make sense.
|
||||
# https://github.com/pradels/vagrant-libvirt/pull/295
|
||||
Patch1: vagrant-libvirt-Rakefile.patch
|
||||
# Wait for libvirt to shutdown the domain
|
||||
# https://github.com/pradels/vagrant-libvirt/pull/347
|
||||
Patch2: vagrant-libvirt-fix-halting.patch
|
||||
# Fix parsing leases when 'vagrant halt; vagrant up' is called
|
||||
# https://github.com/pradels/vagrant-libvirt/pull/356
|
||||
Patch3: 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
|
||||
Patch4: vagrant-libvirt-match-interface-by-mac.patch
|
||||
Requires(pre): shadow-utils
|
||||
Requires(posttrans): vagrant
|
||||
Requires(preun): vagrant
|
||||
Requires: ruby(release)
|
||||
Requires: ruby(rubygems)
|
||||
Requires: rubygem(fog) => 1.23
|
||||
Requires: rubygem(fog) => 1.22
|
||||
Requires: rubygem(fog) < 2
|
||||
Requires: rubygem(ruby-libvirt)
|
||||
#Requires: rubygem(ruby-libvirt) => 0.5.0
|
||||
|
|
@ -61,6 +70,9 @@ 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}.gemspec
|
||||
|
|
@ -72,15 +84,17 @@ 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}%{_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
|
||||
pushd .%{vagrant_plugin_instdir}
|
||||
sed -i '/:git/ s|:git.*$|:path => "%{vagrant_dir}"|' Gemfile
|
||||
sed -i '/rspec/ s|\[\".*\"]|["~> 2.0"]|' vagrant-libvirt.gemspec
|
||||
|
||||
bundle exec rspec2 spec
|
||||
bundle exec rspec spec
|
||||
popd
|
||||
|
||||
%pre
|
||||
|
|
@ -104,7 +118,7 @@ getent group vagrant >/dev/null || groupadd -r vagrant
|
|||
%{vagrant_plugin_spec}
|
||||
# polkit
|
||||
# TODO: Disabled for now, since this might have security implications.
|
||||
%exclude %{_datadir}/polkit-1/rules.d/10-vagrant-libvirt.rules
|
||||
#%exclude %{_datadir}/polkit-1/rules.d/10-vagrant-libvirt.rules
|
||||
|
||||
%files doc
|
||||
%doc %{vagrant_plugin_docdir}
|
||||
|
|
@ -117,6 +131,19 @@ getent group vagrant >/dev/null || groupadd -r vagrant
|
|||
|
||||
|
||||
%changelog
|
||||
* Fri Jul 10 2015 Dan Williams <dcbw@redhat.com> - 0.0.24-5
|
||||
- Fix: parsing of DHCP leases when vagrant up/halt have been used
|
||||
- Fix: pass MAC addresses to vagrant to configure interfaces correctly
|
||||
|
||||
* Tue Apr 21 2015 Josef Stribny <jstribny@redhat.com> - 0.0.24-4
|
||||
- Fix: Wait for libvirt to shutdown the domain
|
||||
|
||||
* Wed Jan 28 2015 Michael Adam <madam@redhat.com> - 0.0.24-3
|
||||
- Ship the polkit rules file as example in the docs package.
|
||||
|
||||
* Wed Jan 28 2015 Michael Adam <madam@redhat.com> - 0.0.24-2
|
||||
- Adapt dependencies for fedora 21.
|
||||
|
||||
* Wed Jan 28 2015 Vít Ondruch <vondruch@redhat.com> - 0.0.24-2
|
||||
- Do not ship polkit rules for now, since this might have security implications.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue