-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VirtualBox: Support VDI with package command #10677
Comments
@auriusbendikas - is it not possible to do something like: Vagrant.configure("2") do |config|
# ...
config.vm.provider "virtualbox" do |vb|
vb.customize ["import", :id, "--options", "importtovdi"]
end
end for enabling the option? edit: I haven't tested that yet, but I'm wondering if it's possible to define a virtualbox provider customize command that enables this option. |
Hi @briancain, Just tried it today.
|
We can't use the |
Actually, looking into this some more, I think customize-commands are being called after the import has already taken place, so it is probably too late? |
You are absolutely right. The modifications are needed in the OVF import logic. If you look at the "References" section of the issue description specifically "GH-7378". This non merged pull request implements support for use_vdi property for every virtualbox driver, which in turn modifies import procedure of the OVF image where it is supported. It is a shame this pull request was not merged. In my opinion this functionality should be turned on by default on driver versions that support it. |
@chrisroberts, (as you're the one who vetoed #7378) any plans to revisit this ? IMHO this is a key missing feature from the VirtualBox provider ... Thanks in advance! |
This is something that would mean quite a bit for me! Currently, one stopping me from going full Vagrant (I do use it quite a bit already) from manual installations is how much easier it is to work with VDI in VirtualBox. I'm aware you can convert it (#3567), but it seems like unnecessary work when there's support in VirtualBox for importing to VDI already. I'm a big fan of having the virtual disks stay around 2 GB with the discard option, even after long-term use. |
Whoops, seems I used the wrong account before. For the record, simply replacing: output = execute("import", "-n", ovf) With the following: output = execute("import", "-n", "--options", "importtovdi", ovf) In Would it make sense to make this the default for VirtualBox? |
@JockeTF, i 'd suggest to keep surprises to a minimum that short term the ideal would be to add a new option to the provider (say the |
That would be quite interesting. @briancain , do you suggest any workaround? |
Hi, if the goal is essentially #7378, then my new pull request #11349 will do this out of the box. You will be able to resize disk images with Vagrant without having to worry about the format, even on the first If you really just want the primary disk to be vdi instead of vmdk, I think that's actually up to the box maintainer to choose. So you could in theory bring up a box, use |
@briancain this pull request for resizing disks is amazing |
@vadbes46 - Sure, that makes sense 👍 if you wanted to make a new feature request issue for that, that would be great! |
@briancain maybe it could be done within this issue so it can be closed? For me it seems to fully cover the original request. Thanks & Regards. |
currently did a workaround for myself - little custom provision plugin which executes only once at first up - it halts machine, recreates primary disk and reattaches it(using your code as an example), then powers on and continues provision Thanks |
@briancain I believe you are mistaken when you write above "I think that's actually up to the box maintainer to choose". The |
I tried https://www.vagrantup.com/docs/disks/configuration to pass Unfortunately Vagrant 2.2.10 doesn't support syntax
fails on:
|
I found this example online: HOME_DISK = '/path-to-disk.vdi'.freeze
Vagrant.configure('2') do |config|
config.vm.provider 'virtualbox' do |vb|
vb.memory = 4096
vb.cpus = 4
if ARGV[0] == 'up' && !File.exist?(HOME_DISK)
vb.customize ['createhd',
'--filename', HOME_DISK,
'--format', 'VDI',
'--size', 40000]
vb.customize ['storageattach', :id,
'--storagectl', 'SATA',
'--port', 0,
'--device', 0,
'--type', 'hdd',
'--medium', HOME_DISK]
end
end
... Is this a good idea, or no? - Any better way to achieve this? EDIT: This doesn't work, it creates the VDI but it's not used by the VM box: h.vm.box = 'ubuntu/focal64'. Any solution for this? |
Would love to support for this, so we can configure homestead to use VDI using the Vagrantfile. Because VMDK can't trim without converting, we've had issues with the disk reaching 70GB and needing to re-provision. currently I've got my driver edited with @JockeTF solution and it's working but would be nice to have support for this. |
Currently vagrant imports VirtualBox boxes as VMDK images just like specified in OVA. However since version 5.0 (please correct me) VBoxManage supports "--options importtovdi", which will convert VMDK image to VDI during import from OVF.
Currently there is no way to enable this option via Vagrantfile configuration.
It would be very welcome enhancement if it could be done something like this (as specified in #7378):
This opens possibilities for further customizing VDI image with features not supported by VMDK, like enabling SSD TRIM support, resizing and etc.
References
The text was updated successfully, but these errors were encountered: