Vagrant-libvirt: Multiple disks in Vagrant box / metadata.json

Created on 27 May 2016  路  7Comments  路  Source: vagrant-libvirt/vagrant-libvirt

Hello.

Is it possible to add the "Multiple disks in Vagrant box" into the vagrant-libvirt? For example the official Virtualbox Vagrant box for Ubuntu 16.04 contains two disks:

$ wget -q https://atlas.hashicorp.com/ubuntu/boxes/xenial64/versions/20160521.0.0/providers/virtualbox.box -O - | tar tvf -
-rw-r--r-- root/root     11013 2016-05-21 16:36 box.ovf
-rw-r--r-- root/root       652 2016-05-21 16:36 Vagrantfile
-rw-r--r-- root/root        31 2016-05-21 16:36 metadata.json
-rw-r--r-- root/root       314 2016-05-21 16:36 ubuntu-xenial-16.04-cloudimg.mf
-rw-r--r-- root/root 290942976 2016-05-21 16:36 ubuntu-xenial-16.04-cloudimg.vmdk
-rw-r--r-- root/root     72192 2016-05-21 16:36 ubuntu-xenial-16.04-cloudimg-configdrive.vmdk

Is it possible to extend the vagrant-libvirt plugin to be able to support more than one disk in box file? (probably some metadata.json enhancement will be needed)

Steps to reproduce

  1. See the output of
$ wget -q https://atlas.hashicorp.com/ubuntu/boxes/xenial64/versions/20160521.0.0/providers/virtualbox.box -O - | tar tvf -
-rw-r--r-- root/root     11013 2016-05-21 16:36 box.ovf
-rw-r--r-- root/root       652 2016-05-21 16:36 Vagrantfile
-rw-r--r-- root/root        31 2016-05-21 16:36 metadata.json
-rw-r--r-- root/root       314 2016-05-21 16:36 ubuntu-xenial-16.04-cloudimg.mf
-rw-r--r-- root/root 290942976 2016-05-21 16:36 ubuntu-xenial-16.04-cloudimg.vmdk
-rw-r--r-- root/root     72192 2016-05-21 16:36 ubuntu-xenial-16.04-cloudimg-configdrive.vmdk

Expected behaviour

Vagrant libvirt boxes (metadata.json) should support more than one disk.

Actual behaviour

The Vagrant libvirt boxes has always one disk.

System configuration

OS/Distro version::

$ head -1 /etc/fedora-release
Fedora release 23 (Twenty Three)

Libvirt version:

$ rpm -qa  libvirt-daemon
libvirt-daemon-1.2.18.3-1.fc23.x86_64

Output of vagrant version; vagrant plugin list:

$ vagrant version; vagrant plugin list
Installed Version: 1.8.1
Latest Version: 1.8.1

You're running an up-to-date version of Vagrant!
vagrant-aws (0.7.0)
vagrant-cachier (1.2.1, system)
vagrant-hostmanager (1.8.1, system)
vagrant-libvirt (0.0.33, system)

Output of VAGRANT_LOG=debug vagrant ... --provider=libvirt

A Vagrantfile to reproduce the issue:

Are you using upstream vagrant package or your distros package?
Distro

enhancement

Most helpful comment

I would like to see this feature. I am working with a few network vendor products that have a requirement for multiple HDD's in their VMs.

All 7 comments

This is not currently supported. The creation of additional empty disks can be done with the Vagrantfile, but the box format supports only a single image at this point.

To add this we would have to introduce a new version to the box format and rewrite almost all the call code in https://github.com/vagrant-libvirt/vagrant-libvirt/blob/master/lib/vagrant-libvirt/action/handle_box_image.rb so it's non-trivial, but I'll flag this as an enhancement since I haven't seen any definitive arguments against it in other issues. #85 is somewhat related though.

Yes I agree...
It's quite complex change. Let's see how many people want this "feature".
Thank you...

We need this feature for configdrive for example. ubuntu/xenial64 is using configdrive.
Can this perhaps be done by placing a libvirt definition file in the box dir, like virtualbox is
doing with its box.ovf?

I would like to see this feature. I am working with a few network vendor products that have a requirement for multiple HDD's in their VMs.

As infernix said this is possible via the Vagrantfile.

I've just patched vagrant-mutate to be able to convert (Ubuntu) Virtualbox boxes that contain a 2nd (ISO9660) image with cloud-init configuration data.

It's a bit of a kludge but then in Vagrantfile I add the device. I hit a bug where the type of the device defaults to 'raw' because vagrant-libvirt doesn't set it. I've created a patch to fix that.

https://github.com/vagrant-libvirt/vagrant-libvirt/pull/907

I want to include a second disk in the packer template for ESXi 7.0 to have a ESXi base box.

To make this happen, this needs to be implemented in packer and here in vagrant-libvirt, right?

Did you guys made any progression on this issue? I see some PRs but none seemed to have advanced.

Do you have any guidance on how this should be implemented? Maybe it should be done in a specific way?

I'm also running into this limitation. I managed to convert the box to multi-disk with @iam-TJ's multi-disk branch, but I'm not yet what the easiest way is to get this box up. Blindly adding it and doing a vagrant up just says the box cannot be found.

Would it really be difficult to replace all the notions of box.img with a loop that goes over box1.img, box2.img, etc.?

Was this page helpful?
0 / 5 - 0 ratings