
Convert Virtualbox To Kvm
Virt-convert from libvirt to vmware libvirt Intend to add OVA installation API libvirt-users using virsh (or something) to convert from KVM domain XML to vmx fedora-virt exporting a vm image; but none of the above have been resolved yet. There is a script that goes from vmx to libvirt domain XML format: Virtualization Preview.
Vagrant-mutate is a vagrant plugin to convert vagrant boxes to work with different providers.
Maintenance Notice
I am no longer actively maintaining vagrant-mutate. If you are interested in taking over, let me know.
Supported Conversions
- Virtualbox to kvm
- Virtualbox to libvirt
- Virtualbox to bhyve
- Libvirt to kvm
- Kvm to libvirt
Compatibility
Vagrant-mutate 0.3 and later requires Vagrant 1.5. If you are using an older vagrant, install vagrant-mutate version 0.2.6.
Installation
qemu-img and libvirt development
First, you must install qemu-img and the libvirt development libraries. Information on supported versions is listed at QEMU Version Compatibility.
Debian and derivatives
Red Hat and derivatives
OS X
QEMU and libvirt are available from homebrew
Windows
Download and install it from Stefan Weil or compile it yourself.
vagrant-mutate
Now you're ready to install vagrant-mutate. To install the latest released version simply run
To install from source, clone the repository and run rake build
. That will produce a gem file in the pkg directory which you can then install with vagrant plugin install
.
Usage
The basic usage is
For example, if you wanted to download a box created for virtualbox and add it to vagrant for libvirt
Or if you had already downloaded it
Or if you had already added the box to vagrant and now want to use it with libvirt
The latter syntax works for boxes you added from Vagrant Cloud or Atlas too. If you have installed multiple versions of these boxes, vagrant-mutate will always use the latest one.
If you have a box for multiple providers, you must specify the provider to use for input using the --input-provider option, e.g.
Use the Hausa Keyboard by typing through the virtual keyboard, or by clicking the keys on the keyboard directly with your mouse. Click or press the Shift key for additional Hausa characters that are not visible on the keyboard.
To export a box you created with vagrant mutate, just repackage it, e.g.
If you want to force the output box to use virtio for the disk interface, no matter what interface the input box used, use the --force-virtio option.
Debugging
vagrant and vagrant-mutate will output lots of information as they run if you set the VAGRANT_LOG environment variable to INFO. See here for information on how to do that on your operating system.
If you experience any problems, please open an issue on github.
Contributing
Contributions are welcome! I'd especially like to see support for converting between more providers added.
To contribute, follow the standard flow of
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Make sure the acceptance tests pass (
ruby test/test.rb
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Even if you can't contribute code, if you have an idea for an improvement please open an issue.
# It's important to convert the vbox image (VMDK or VDI or whatever) using |
# the same version of VirtualBox that created it. You can try converting the image |
# with qemu-img or kvm-img, but weird version mismatches will possibly make it not |
# work. |
# On your VirtualBox machine: |
cd $VBOX_ROOT/$MACHINE_ROOT/ |
VBoxManage clonehd machine.vmdk machine.img --format RAW |
scp machine.img root@kvm-host:/somewhere |
# Now go over to your KVM host. |
ssh root@kvm-host |
cd /somewhere |
# You may want to run something like the following to ensure your raw image is |
# bootable before taking all the time to dd it. |
qemu-system-x86_64 -drive file=machine.img,boot=on |
# You need to see how big of a volume you need for the image, and then create a |
# sparse dataset of that size and dd the raw image onto the ZFS raw block device. |
ls -l machine.img |
123456b |
zfs create -V 123456b zones/machine |
dd if=machine.img of=/dev/zvol/rdsk/zones/machine |
# That's it. Point your KVM branded zone at that dataset and it should boot. |
# |
# Cheers. |
commented Apr 14, 2012
You have machine.raw in line 20 and machine.img in line 25 which refers to the same file. (i'm right ? ) |
commented Apr 14, 2012
Yup. Fixed. Marvell yukon 88e8056 speed. |
commented Aug 6, 2017
This takes incredibly long. According to the partition size, you should add something like bs=1M or similar. |
