Compare commits
4 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
40c6796bc1 | ||
|
|
c6b571110f | ||
|
|
41c8aaaddc | ||
| 73655f718b |
5 changed files with 261 additions and 5 deletions
4
sources
4
sources
|
|
@ -1,2 +1,2 @@
|
|||
e3cef8185260f8413e52e65876b36968 vagrant-libvirt-0.0.35.gem
|
||||
556b3f66ce845aa18557c609639f3349 vagrant-spec-9bba7e1228379c0a249a06ce76ba8ea7d276afbe.tar.gz
|
||||
SHA512 (vagrant-libvirt-0.0.35.gem) = a7b87d8f82723760c544852dbcaa2e4ef7bf15194eaf84922f6bc4e15167467c2dc627395adabf74ecacb9b43e03a80296382d0bfacd2106f4885c8cf4d69d17
|
||||
SHA512 (vagrant-spec-9bba7e1228379c0a249a06ce76ba8ea7d276afbe.tar.gz) = eda90b5e05c04c7c690bf4579931a0aa2a418ca6f3f1f9b0c18770e4d09fcea2f081f817604ed73c84cb33c437674e315b0ecbdfa7dc24ca94713bb179cb3544
|
||||
|
|
|
|||
90
vagrant-libvirt-0.0.36-Add-disk-property-shareable.patch
Normal file
90
vagrant-libvirt-0.0.36-Add-disk-property-shareable.patch
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
From d78d8969098bbe466d8381a90914a799bb563485 Mon Sep 17 00:00:00 2001
|
||||
From: Erik van Pienbroek <epienbro@fedoraproject.org>
|
||||
Date: Wed, 7 Sep 2016 17:57:08 +0200
|
||||
Subject: [PATCH] Add disk property 'shareable'
|
||||
|
||||
To simulate shared SAN storage an additional libvirt
|
||||
disk property needs to be set which disables caching.
|
||||
|
||||
Also updated the documentation to document this new
|
||||
property and added an example on how to simulate
|
||||
shared SAN storage
|
||||
|
||||
Closes #648
|
||||
---
|
||||
README.md | 15 ++++++++++++---
|
||||
lib/vagrant-libvirt/action/create_domain.rb | 3 ++-
|
||||
lib/vagrant-libvirt/config.rb | 1 +
|
||||
lib/vagrant-libvirt/templates/domain.xml.erb | 3 +++
|
||||
4 files changed, 18 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/README.md b/README.md
|
||||
index 6a5f4d4..ea540ec 100644
|
||||
--- a/README.md
|
||||
+++ b/README.md
|
||||
@@ -465,7 +465,8 @@ It has a number of options:
|
||||
* `type` - Type of disk image to create. Defaults to *qcow2*.
|
||||
* `bus` - Type of bus to connect device to. Defaults to *virtio*.
|
||||
* `cache` - Cache mode to use, e.g. `none`, `writeback`, `writethrough` (see the [libvirt documentation for possible values](http://libvirt.org/formatdomain.html#elementsDisks) or [here](https://www.suse.com/documentation/sles11/book_kvm/data/sect1_chapter_book_kvm.html) for a fuller explanation). Defaults to *default*.
|
||||
-* `allow_existing` - Set to true if you want to allow the VM to use a pre-existing disk. This is useful for sharing disks between VMs, e.g. in order to simulate shared SAN storage. Shared disks removed only manually. If not exists - will created. If exists - using existed.
|
||||
+* `allow_existing` - Set to true if you want to allow the VM to use a pre-existing disk. If the disk doesn't exist it will be created. Disks with this option set to true need to be removed manually.
|
||||
+* `shareable` - Set to true if you want to simulate shared SAN storage.
|
||||
|
||||
The following example creates two additional disks.
|
||||
|
||||
@@ -474,6 +475,15 @@ Vagrant.configure("2") do |config|
|
||||
config.vm.provider :libvirt do |libvirt|
|
||||
libvirt.storage :file, :size => '20G'
|
||||
libvirt.storage :file, :size => '40G', :type => 'raw'
|
||||
+ end
|
||||
+end
|
||||
+```
|
||||
+
|
||||
+For shared SAN storage to work the following example can be used:
|
||||
+```ruby
|
||||
+Vagrant.configure("2") do |config|
|
||||
+ config.vm.provider :libvirt do |libvirt|
|
||||
+ libvirt.storage :file, :size => '20G', :path => 'my_shared_disk.img', :allow_existing => true, :shareable => true, :type => 'raw'
|
||||
end
|
||||
end
|
||||
```
|
||||
diff --git a/lib/vagrant-libvirt/action/create_domain.rb b/lib/vagrant-libvirt/action/create_domain.rb
|
||||
index 0b1fe88..308b947 100644
|
||||
--- a/lib/vagrant-libvirt/action/create_domain.rb
|
||||
+++ b/lib/vagrant-libvirt/action/create_domain.rb
|
||||
@@ -191,7 +191,8 @@ def call(env)
|
||||
|
||||
@disks.each do |disk|
|
||||
msg = " -- Disk(#{disk[:device]}): #{disk[:absolute_path]}"
|
||||
- msg += ' (shared. Remove only manually)' if disk[:allow_existing]
|
||||
+ msg += ' Shared' if disk[:shareable]
|
||||
+ msg += ' (Remove only manually)' if disk[:allow_existing]
|
||||
msg += ' Not created - using existed.' if disk[:preexisting]
|
||||
env[:ui].info(msg)
|
||||
end
|
||||
diff --git a/lib/vagrant-libvirt/config.rb b/lib/vagrant-libvirt/config.rb
|
||||
index 09c1e29..49802a4 100644
|
||||
--- a/lib/vagrant-libvirt/config.rb
|
||||
+++ b/lib/vagrant-libvirt/config.rb
|
||||
@@ -376,6 +376,7 @@ def _handle_disk_storage(options={})
|
||||
:bus => options[:bus],
|
||||
:cache => options[:cache] || 'default',
|
||||
:allow_existing => options[:allow_existing],
|
||||
+ :shareable => options[:shareable],
|
||||
}
|
||||
|
||||
@disks << disk # append
|
||||
diff --git a/lib/vagrant-libvirt/templates/domain.xml.erb b/lib/vagrant-libvirt/templates/domain.xml.erb
|
||||
index d35a595..bb572e3 100644
|
||||
--- a/lib/vagrant-libvirt/templates/domain.xml.erb
|
||||
+++ b/lib/vagrant-libvirt/templates/domain.xml.erb
|
||||
@@ -75,6 +75,9 @@
|
||||
<driver name='qemu' type='<%= d[:type] %>' cache='<%= d[:cache] %>'/>
|
||||
<source file='<%= d[:absolute_path] %>'/>
|
||||
<target dev='<%= d[:device] %>' bus='<%= d[:bus] %>'/>
|
||||
+ <% if d[:shareable] %>
|
||||
+ <shareable/>
|
||||
+ <% end %>
|
||||
<%# this will get auto generated by libvirt
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='???' function='0x0'/>
|
||||
-%>
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
From 59edda86239b4b33d24f809177c4bc7e3036307a Mon Sep 17 00:00:00 2001
|
||||
From: Quinten Johnson <quinten@sgi.com>
|
||||
Date: Thu, 16 Mar 2017 10:44:07 -0500
|
||||
Subject: [PATCH] Allow additional disk serial specification
|
||||
|
||||
libvirt uses <serial></serial> to expose a disk serial to the VM.
|
||||
---
|
||||
README.md | 1 +
|
||||
lib/vagrant-libvirt/config.rb | 3 ++-
|
||||
lib/vagrant-libvirt/templates/domain.xml.erb | 3 +++
|
||||
3 files changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/README.md b/README.md
|
||||
index 81b1a8c..b8783f2 100644
|
||||
--- a/README.md
|
||||
+++ b/README.md
|
||||
@@ -467,6 +467,7 @@ It has a number of options:
|
||||
* `cache` - Cache mode to use, e.g. `none`, `writeback`, `writethrough` (see the [libvirt documentation for possible values](http://libvirt.org/formatdomain.html#elementsDisks) or [here](https://www.suse.com/documentation/sles11/book_kvm/data/sect1_chapter_book_kvm.html) for a fuller explanation). Defaults to *default*.
|
||||
* `allow_existing` - Set to true if you want to allow the VM to use a pre-existing disk. If the disk doesn't exist it will be created. Disks with this option set to true need to be removed manually.
|
||||
* `shareable` - Set to true if you want to simulate shared SAN storage.
|
||||
+* `serial` - Serial number of the disk device.
|
||||
|
||||
The following example creates two additional disks.
|
||||
|
||||
diff --git a/lib/vagrant-libvirt/config.rb b/lib/vagrant-libvirt/config.rb
|
||||
index 2602905..a535eb2 100644
|
||||
--- a/lib/vagrant-libvirt/config.rb
|
||||
+++ b/lib/vagrant-libvirt/config.rb
|
||||
@@ -377,6 +377,7 @@ def _handle_disk_storage(options = {})
|
||||
:cache => options[:cache] || 'default',
|
||||
:allow_existing => options[:allow_existing],
|
||||
:shareable => options[:shareable],
|
||||
+ :serial => options[:serial]
|
||||
}
|
||||
|
||||
@disks << disk # append
|
||||
diff --git a/lib/vagrant-libvirt/templates/domain.xml.erb b/lib/vagrant-libvirt/templates/domain.xml.erb
|
||||
index ade0914..722686a 100644
|
||||
--- a/lib/vagrant-libvirt/templates/domain.xml.erb
|
||||
+++ b/lib/vagrant-libvirt/templates/domain.xml.erb
|
||||
@@ -78,6 +78,9 @@
|
||||
<% if d[:shareable] %>
|
||||
<shareable/>
|
||||
<% end %>
|
||||
+ <% if d[:serial] %>
|
||||
+ <serial><%= d[:serial] %></serial>
|
||||
+ <% end %>
|
||||
<%# this will get auto generated by libvirt
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='???' function='0x0'/>
|
||||
-%>
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
From da87d06bfb02e96a1336ca06dc7ac620fc29515f Mon Sep 17 00:00:00 2001
|
||||
From: "Jose A. Rivera" <jarrpa@redhat.com>
|
||||
Date: Mon, 6 Feb 2017 15:12:22 +0100
|
||||
Subject: [PATCH 1/2] Cleanup some public network MAC code.
|
||||
|
||||
---
|
||||
.../action/create_network_interfaces.rb | 19 ++++++++-----------
|
||||
1 file changed, 8 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/lib/vagrant-libvirt/action/create_network_interfaces.rb b/lib/vagrant-libvirt/action/create_network_interfaces.rb
|
||||
index aef97d7..67fea35 100644
|
||||
--- a/lib/vagrant-libvirt/action/create_network_interfaces.rb
|
||||
+++ b/lib/vagrant-libvirt/action/create_network_interfaces.rb
|
||||
@@ -122,19 +122,15 @@ def call(env)
|
||||
end
|
||||
|
||||
# Re-read the network configuration and grab the MAC address
|
||||
- unless @mac
|
||||
+ if iface_configuration[:iface_type] == :public_network and not @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")
|
||||
- elsif !@portgroup.nil?
|
||||
- @mac = xml.xpath("/domain/devices/interface[source[@network='#{@network_name}']]/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
|
||||
+ source = "@network='#{@network_name}'"
|
||||
+ if @type == 'direct'
|
||||
+ source = "@dev='#{@device}'"
|
||||
+ elsif @portgroup.nil?
|
||||
+ source = "@bridge='#{@device}'"
|
||||
+ end
|
||||
+ @mac = xml.xpath("/domain/devices/interface[source[#{source}]]/mac/@address")
|
||||
iface_configuration[:mac] = @mac.to_s
|
||||
end
|
||||
end
|
||||
From cd8573777ae62398913c5000f4af76f72f5417ac Mon Sep 17 00:00:00 2001
|
||||
From: "Jose A. Rivera" <jarrpa@redhat.com>
|
||||
Date: Mon, 6 Feb 2017 15:13:26 +0100
|
||||
Subject: [PATCH 2/2] Allow multiple MACs per network.
|
||||
|
||||
---
|
||||
lib/vagrant-libvirt/action/create_network_interfaces.rb | 11 ++++++++---
|
||||
1 file changed, 8 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/lib/vagrant-libvirt/action/create_network_interfaces.rb b/lib/vagrant-libvirt/action/create_network_interfaces.rb
|
||||
index 67fea35..670b084 100644
|
||||
--- a/lib/vagrant-libvirt/action/create_network_interfaces.rb
|
||||
+++ b/lib/vagrant-libvirt/action/create_network_interfaces.rb
|
||||
@@ -64,6 +64,7 @@ def call(env)
|
||||
end
|
||||
|
||||
# Create each interface as new domain device.
|
||||
+ @macs_per_network = Hash.new(0)
|
||||
adapters.each_with_index do |iface_configuration, slot_number|
|
||||
@iface_number = slot_number
|
||||
@network_name = iface_configuration[:network_name]
|
||||
@@ -122,7 +123,7 @@ def call(env)
|
||||
end
|
||||
|
||||
# Re-read the network configuration and grab the MAC address
|
||||
- if iface_configuration[:iface_type] == :public_network and not @mac
|
||||
+ if iface_configuration[:iface_type] == :public_network
|
||||
xml = Nokogiri::XML(domain.xml_desc)
|
||||
source = "@network='#{@network_name}'"
|
||||
if @type == 'direct'
|
||||
end
|
||||
@@ -130,8 +131,12 @@ def call(env)
|
||||
elsif @portgroup.nil?
|
||||
source = "@bridge='#{@device}'"
|
||||
end
|
||||
- @mac = xml.xpath("/domain/devices/interface[source[#{source}]]/mac/@address")
|
||||
- iface_configuration[:mac] = @mac.to_s
|
||||
+ if not @mac
|
||||
+ macs = xml.xpath("/domain/devices/interface[source[#{source}]]/mac/@address")
|
||||
+ @mac = macs[@macs_per_network[source]]
|
||||
+ iface_configuration[:mac] = @mac.to_s
|
||||
+ end
|
||||
+ @macs_per_network[source] += 1
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
Name: %{vagrant_plugin_name}
|
||||
Version: 0.0.35
|
||||
Release: 1%{?dist}
|
||||
Release: 4%{?dist}
|
||||
Summary: libvirt provider for Vagrant
|
||||
Group: Development/Languages
|
||||
License: MIT
|
||||
|
|
@ -15,14 +15,26 @@ Source0: https://rubygems.org/gems/%{vagrant_plugin_name}-%{version}.gem
|
|||
# wget https://github.com/mitchellh/vagrant-spec/archive/9bba7e1228379c0a249a06ce76ba8ea7d276afb/vagrant-spec-f1a18fd3e5387328ca83e016e48373aadb67112a.tar.gz
|
||||
Source2: https://github.com/mitchellh/vagrant-spec/archive/%{vagrant_spec_commit}/vagrant-spec-%{vagrant_spec_commit}.tar.gz
|
||||
|
||||
# Fix Vagrant error when network is specified.
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1426565
|
||||
# https://github.com/vagrant-libvirt/vagrant-libvirt/pull/730
|
||||
Patch0: vagrant-libvirt-0.37.0-Use-slot-number-to-report-MAC-address.patch
|
||||
|
||||
# Add disk property 'shareable' (rhbz#1463183).
|
||||
# https://github.com/vagrant-libvirt/vagrant-libvirt/pull/649
|
||||
Patch1: vagrant-libvirt-0.0.36-Add-disk-property-shareable.patch
|
||||
|
||||
# Allow additional disk serial specification (rhbz#1463183).
|
||||
# https://github.com/vagrant-libvirt/vagrant-libvirt/pull/747
|
||||
Patch2: vagrant-libvirt-0.0.38-Allow-additional-disk-serial-specification.patch
|
||||
|
||||
Requires(posttrans): vagrant
|
||||
Requires(preun): vagrant
|
||||
Requires: ruby(release)
|
||||
Requires: ruby(rubygems)
|
||||
Requires: rubygem(fog-libvirt)
|
||||
Requires: rubygem(nokogiri) => 1.6.0
|
||||
Requires: rubygem(nokogiri) < 1.7
|
||||
Requires: rubygem(nokogiri) >= 1.6
|
||||
Requires: rubygem(nokogiri) < 2
|
||||
Requires: vagrant
|
||||
BuildRequires: vagrant
|
||||
BuildRequires: rubygem(rdoc)
|
||||
|
|
@ -55,6 +67,13 @@ gem spec %{SOURCE0} -l --ruby > %{vagrant_plugin_name}.gemspec
|
|||
# https://github.com/vagrant-libvirt/vagrant-libvirt/pull/660
|
||||
sed -i '/fog-libvirt/ s/"= 0.0.3"/">= 0.3.0"/' %{vagrant_plugin_name}.gemspec
|
||||
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
|
||||
# Relax nokogiri dependency
|
||||
sed -i '\@nokogiri@s|~> 1\.6\.0|~> 1.6|' %{vagrant_plugin_name}.gemspec
|
||||
|
||||
%build
|
||||
gem build %{vagrant_plugin_name}.gemspec
|
||||
%vagrant_plugin_install
|
||||
|
|
@ -110,6 +129,16 @@ popd
|
|||
%{vagrant_plugin_instdir}/vagrant-libvirt.gemspec
|
||||
|
||||
%changelog
|
||||
* Tue Jun 20 2017 Vít Ondruch <vondruch@redhat.com> - 0.0.35-4
|
||||
- Allow additional disk serial specification (rhbz#1463183).
|
||||
- Add disk property 'shareable' (rhbz#1463183).
|
||||
|
||||
* Fri Feb 24 2017 Vít Ondruch <vondruch@redhat.com> - 0.0.35-3
|
||||
- Fix Vagrant error when network is specified (rhbz#1426565).
|
||||
|
||||
* Sun Jan 1 2017 Mamoru TASAKA <mtasaka@fedoraproject.org> - 0.0.35-2
|
||||
- Relax nokogiri dependency
|
||||
|
||||
* Tue Oct 04 2016 Vít Ondruch <vondruch@redhat.com> - 0.0.35-1
|
||||
- Update to vagrant-libvirt 0.0.35.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue