From 59edda86239b4b33d24f809177c4bc7e3036307a Mon Sep 17 00:00:00 2001 From: Quinten Johnson Date: Thu, 16 Mar 2017 10:44:07 -0500 Subject: [PATCH] Allow additional disk serial specification libvirt uses 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 @@ -693,6 +693,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 @@ -480,7 +480,8 @@ module VagrantPlugins 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] %> <% end %> + <% if d[:serial] %> + <%= d[:serial] %> + <% end %> <%# this will get auto generated by libvirt
-%>