mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
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
This commit is contained in:
15
README.md
15
README.md
@@ -591,9 +591,9 @@ It has a number of options:
|
||||
[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.
|
||||
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.
|
||||
|
||||
@@ -606,6 +606,15 @@ Vagrant.configure("2") do |config|
|
||||
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
|
||||
```
|
||||
|
||||
### Reload behavior
|
||||
|
||||
On `vagrant reload` the following additional disk attributes are updated in
|
||||
|
||||
@@ -191,7 +191,8 @@ module VagrantPlugins
|
||||
|
||||
@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
|
||||
|
||||
@@ -376,6 +376,7 @@ module VagrantPlugins
|
||||
:bus => options[:bus],
|
||||
:cache => options[:cache] || 'default',
|
||||
:allow_existing => options[:allow_existing],
|
||||
:shareable => options[:shareable],
|
||||
}
|
||||
|
||||
@disks << disk # append
|
||||
|
||||
@@ -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'/>
|
||||
-%>
|
||||
|
||||
Reference in New Issue
Block a user