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.
This parameter will be used by libvirt to set the machine type qemu will
use. For example, setting it to `pc-1.0` will generate this `os`
definition:
<os>
<type arch='x86_64' machine='pc-1.0'>hvm</type>
</os>
With libvirt-1.2.11, libvirt no longer uses lease files for dnsmasq,
which makes the existing method of fetching the ip of a vm incorrect.
This change introduces a version agnostic method to get the IP of VM
using arp cache instead.
Fixes#298
As discussed in #85 vagrant-libvirt's image management could
be better. This is only addressing a small aspect of the topic,
but due to its simplicity it could improve vagrant-libvirt in the
meantime until #85 is fully resolved.
Currently the domain template as defined in domain.xml.erb hard-codes the arch
attribute under OS tag to x86_64. This is really not required since the
'arch' attribute is automatically populated by libvirt
<type arch='x86_64'>hvm</type>
This prevents using this plugin to manage non-x86_64 architecture like
Power(ppc64) and Arm.
This patch removes the 'arch' attribute from the domain template
I'm not entirely happy with this, because we only really need a lock
when multiple VMs are using the same base box. If they are using
different boxes, we could safely upload in parallel. I did not see an
obvious way to implement that, so this will work. Parallel uploads are
likely not a performance improvement, anyway.
We should use define_storage pool_xml instead of create_storage_pool_xml
so that
* the pool is permanent
* pool creation succeeds if the directory does not already exist
The presence of quotes in the command to spawn caused ruby to run it via
a shell instead of running it directly. This broke our code for
killing the ssh processes when the VM is halted.
Closes#265