Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
Vít Ondruch
c8ad6bb752 Allow additional disk serial specification (rhbz#1463184). 2017-06-20 14:51:11 +02:00
2 changed files with 61 additions and 1 deletions

View file

@ -0,0 +1,52 @@
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
@@ -680,6 +680,7 @@ It has a number of options:
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
@@ -430,7 +430,8 @@ def _handle_disk_storage(options = {})
bus: options[:bus],
cache: options[:cache] || 'default',
allow_existing: options[:allow_existing],
- shareable: options[:shareable]
+ 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
@@ -86,6 +86,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'/>
-%>

View file

@ -4,7 +4,7 @@
Name: %{vagrant_plugin_name}
Version: 0.0.37
Release: 4%{?dist}
Release: 5%{?dist}
Summary: libvirt provider for Vagrant
Group: Development/Languages
License: MIT
@ -20,6 +20,10 @@ Source2: https://github.com/mitchellh/vagrant-spec/archive/%{vagrant_spec_commit
# https://github.com/vagrant-libvirt/vagrant-libvirt/pull/730
Patch0: vagrant-libvirt-0.37.0-Use-slot-number-to-report-MAC-address.patch
# Allow additional disk serial specification (rhbz#1463184).
# https://github.com/vagrant-libvirt/vagrant-libvirt/pull/747
Patch2: vagrant-libvirt-0.0.38-Allow-additional-disk-serial-specification.patch
Requires: ruby(release)
Requires: ruby(rubygems)
Requires: rubygem(fog-libvirt) >= 0.3.0
@ -59,6 +63,7 @@ gem unpack %{SOURCE0}
gem spec %{SOURCE0} -l --ruby > %{vagrant_plugin_name}.gemspec
%patch0 -p1
%patch2 -p1
# Relax nokogiri dependency
sed -i '\@nokogiri@s|~> 1\.6\.0|~> 1.6|' \
@ -118,6 +123,9 @@ popd
%{vagrant_plugin_instdir}/vagrant-libvirt.gemspec
%changelog
* Tue Jun 20 2017 Vít Ondruch <vondruch@redhat.com> - 0.0.37-5
- Allow additional disk serial specification (rhbz#1463184).
* Fri Feb 24 2017 Vít Ondruch <vondruch@redhat.com> - 0.0.37-4
- Fix Vagrant error when network is specified (rhbz#1426565).