mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
This
```ruby
Vagrant.configure("2") do |c|
c.vm.box = "centos-7.0"
c.vm.hostname = "default-centos-70.vagrantup.com"
c.vm.provider :libvirt do |p|
p.storage :file, :size => "5M", :path => "vagrant_vdb.qcow2", :device => "vdb"
p.storage :file, :size => "5M", :path => "vagrant_vdc.qcow2", :device => "vdc"
end
end
```
works.
But this fails:
```ruby
def add_block_device(node, port, size)
node.vm.provider 'libvirt' do |lv|
port_name = ('b'..'z').to_a[port-1]
lv.storage :file, :size => "#{size}M", :path => "vagrant_#{node.vm.hostname}_vd#{port_name}.qcow2", :device => "vd#{port_name}"
end
end
Vagrant.configure("2") do |c|
c.vm.box = "centos-7.0"
c.vm.hostname = "default-centos-70.vagrantup.com"
add_block_device(c, 1, 5)
add_block_device(c, 2, 5)
end
```
In the second case only the last disk is added:
```
==> default: -- Disks: vdc(qcow2,5M)
==> default: -- Disk(vdc): /var/lib/libvirt/images/vagrant_default-centos-70.vagrantup.com_vdc.qcow2
```
This patch corrects this. It is done as the `customize` configuration
is the vagrant code.