sciurus / vagrant-mutate

Convert vagrant boxes to work with different providers
MIT License
280 stars 41 forks source link

Multi disk support #91

Open Katana-Steel opened 8 years ago

Katana-Steel commented 8 years ago

I got a VirtualBox .box with 2 disks, but running it through mutate only converted the 1st disk from the box.ovf file (meaning I could boot the VM but it's data disk wasn't available)

sciurus commented 8 years ago

Thanks for the report @Katana-Steel . That's a known limitation right now, but if anyone wants to add support for multiple disks it's definitely welcome.

swills commented 8 years ago

@Katana-Steel Could you share an example of a box with two disks?

Katana-Steel commented 8 years ago

I have the vagrant box image which is hosted on s3: https://s3.amazonaws.com/edu-downloads.10gen.com/m202/m202-ubuntu1404-2015-08.box

I can get to my vagrant file tomorrow, mutate converted box-disk1 of the ovf file to a qcow2 image, but not box-disk2 (had to create that one manually luckily it is mounting with lvm paths) pressing s at startup skips mounting /data (a 20G lvm volume)

On Aug 15, 2016 7:43 PM, "Steve Wills" notifications@github.com wrote:

@Katana-Steel https://github.com/Katana-Steel Could you share an example of a box with two disks?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sciurus/vagrant-mutate/issues/91#issuecomment-239986986, or mute the thread https://github.com/notifications/unsubscribe-auth/ADECW60xAAhK7JNvkcAWTYbHJC_yrTTDks5qgSPvgaJpZM4JeAC5 .

Katana-Steel commented 8 years ago
 # -*- mode: ruby -*-
 # vi: set ft=ruby :

 # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
 VAGRANTFILE_API_VERSION = "2"

 Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

   config.vm.box = "m202-ubuntu1404-2015-08"
   config.vm.box_url = "https://s3.amazonaws.com/edu-downloads.10gen.com/m202/m202-ubuntu1404-2015-08.box"

   config.vm.provision "shell", path: "provisioners/setup.sh"
-
+  config.vm.provider "libvirt" do |v|
+    # Uncomment the next line to show VM window. User/pass = vagrant/vagrant
+    v.memory = 2048
+    v.cpus = 1
+    v.video_type = "qxl"
+    v.video_vram = 65536
+    v.graphics_type = "spice"
+  end

   config.vm.provider "virtualbox" do |vb|
     # Uncomment the next line to show VM window. User/pass = vagrant/vagrant
     vb.gui = true

     vb.name = "m202-ubuntu1404-2015-10"
     vb.customize ["modifyvm", :id, "--memory", "2048"]
     vb.customize ["modifyvm", :id, "--cpus", "1"]  
   end

   config.ssh.username = "m202"
   config.ssh.password = "m202"

 end
bjne commented 8 years ago

This also applies to ubuntu/xenial64 that uses 2nd disk as a configdrive, and not converting this drive breaks booting it after mutate.

Katana-Steel commented 7 years ago

any interest in this issue?

iam-TJ commented 6 years ago

Confirming this affects the Ubuntu cloud-image boxes since they are for VirtualBox and contain 2 disk images: the root-fs and the cloud-init data. E.g the ubuntu/bionic64 image when mutated results in:

boxes  ubuntu-VAGRANTSLASH-bionic  0  find . -ls
   270462      4 drwxrwxr-x   4 tj       tj           4096 Jul 29 17:43 .
   270457      4 drwxrwxr-x   2 tj       tj           4096 Jul 29 17:43 ./libvirt
   262177 1028044 -rw-r--r--   1 tj       tj       1052704768 Jul 29 18:21 ./libvirt/box.img
   267960      12 -rw-rw-r--   1 tj       tj              136 Jul 29 17:43 ./libvirt/Vagrantfile
   267827      12 -rw-rw-r--   1 tj       tj               57 Jul 29 17:43 ./libvirt/metadata.json
   270463       4 drwxrwxr-x   2 tj       tj             4096 Jul 28 13:15 ./virtualbox
   268076      80 -rw-r--r--   1 tj       tj            72192 Jul 28 13:15 ./virtualbox/ubuntu-bionic-18.04-cloudimg-configdrive.vmdk
   268075  307892 -rw-r--r--   1 tj       tj        315267584 Jul 28 13:15 ./virtualbox/ubuntu-bionic-18.04-cloudimg.vmdk
   268074      12 -rw-r--r--   1 tj       tj              310 Jul 28 13:15 ./virtualbox/ubuntu-bionic-18.04-cloudimg.mf
   268066      20 -rw-r--r--   1 tj       tj            11061 Jul 28 13:15 ./virtualbox/box.ovf
   268071      12 -rw-r--r--   1 tj       tj              478 Jul 28 13:15 ./virtualbox/Vagrantfile
   268072      12 -rw-r--r--   1 tj       tj               31 Jul 28 13:15 ./virtualbox/metadata.json
Katana-Steel commented 6 years ago

Thank you @iam-TJ it would be nice if vagrant-mutate would support extra disk images. because if it can convert the first disk... why not the others

iam-TJ commented 6 years ago

I've just about finished adding the functionality - need to do some thorough testing then I'll publish the code in my forked repo. Have had to give myself a crash-course in Ruby, and Vagrant!

Tracking it here:

https://github.com/iam-TJ/vagrant-mutate/issues/1

sciurus commented 6 years ago

@iam-TJ if you're interested in maintaining vagrant-mutate I'd be happy to give you commit access here!