Importing KVM Servers
Introduction
Although no import methods exist yet from competing virtualization solutions, it's still possible to migrate data in to VirtFusion.
VirtFusion uses the industry standard cloud-init and guest agent (if available) to provision and manage virtual servers, however a large portion of competing products use invasive methods at hypervisor level to achieve the same result. This means virtual servers imported in to VirtFusion will need extra packages if you want to take full control.
This guide will help you install those dependencies and move virtual disks in to VirtFusion.
This guide presumes you are migrating virtual machines from an existing hypervisor with virtual machines to a newly installed VirtFusion hypervisor.
Disk Preparation
Disks come in all shapes, sizes and locations and differ in type (qcow2, raw and LVM).
Dependant on the software you are using, the location of the disk could be anywhere on the hypervisor filesystem, you'll need to find the location of the disk before you can continue.
ALL DISK ACTIONS SHOULD BE COMPLETED WITH THE VIRTUAL SERVER IN AN OFFLINE STATE.
One of the most important parts of migrating a disk, is making sure you know the size and type of the disk you are going to import. If you don't do this, it may cause data corruption and inaccurate statistics in Virtfusion.
LVM
If your disks are stored in logical volumes, you will need to convert them to images. You can convert to disk images easily using the following commands:
/dev/vg_name/lv_name should be the path to the volume that contains the virtual server data and /path/to/disk.img will be the output disk image.
Convert to Qcow2 Image
qemu-img convert -O qcow2 /dev/vg_name/lv_name /path/to/disk.img
Convert to Raw Image
qemu-img convert -O raw /dev/vg_name/lv_name /path/to/disk.img
Disk Images
Find the Type and Size
If the disk is an image (qcow2/raw) or you have converted from LVM, you can easily reference the size and type using the following command:
qemu-img info /path/to/disk.img
Example output for a raw disk:
image: disk.img
file format: raw
virtual size: 10 GiB (10737418240 bytes)
disk size: 4 KiB
Example output for a qcow2 disk:
image: disk.img
file format: qcow2
virtual size: 10 GiB (10737418240 bytes)
disk size: 2.12 GiB
cluster_size: 65536
Format specific information:
compat: 1.1
compression type: zlib
lazy refcounts: false
refcount bits: 16
corrupt: false
extended l2: false
The two important fields are file format (disk type) and virtual size (disk size).