Importing a VM to VMmanager
This article describes how to import virtual machines (VMs) and VM images created with the software:
- Hyper-V;
- VirtualBox;
- VMware;
- Xen;
- various hypervisors using QEMU-KVM technology.
The import consists of the following steps:
- Preparation of the source VM.
- Preparation of VMmanager.
- Transfer of VM disks.
- Starting the VM.
Importing VMs created with OVZ virtualization is described in the article Moving an OVZ container to LXD cluster.
Restrictions
The following is not supported on imported VMs:
- changing the password using VMmanager;
- automatic adding and deletion of IP addresses;
- automatic change of disk partitions.
Because of the internal limitations of the Windows OS, we cannot guarantee the correct import of VMs with Windows family OS.
Preparation of the source VM
This step converts the source VM files into a format supported by VMmanager and transfers them to the platform cluster node. VMmanager supports the following VM disk formats:
- RAW — for Ceph and LVM storage;
- Qcow2 — for file storage.
For more information about VM disk formats, see the article Storage types.
Since RAW files are large in size, we recommend converting them to Qcow2 format before transferring them to the VMmanager cluster node.
Preparation procedure
- Stop the source VM.
If the files of VM disks:
are in a Ceph storage:
Connect to the Ceph monitor server from the source VM.
Export VM disks:
rbd export <pool_name>/<disk_name> <raw_file>
CODEComments to the command<pool_name> — name of Ceph pool
<disk_name> — name of VM disk
<raw_file> — output file in RAW format
Convert disc files to Qcow2 format:
qemu-img convert -f raw -O qcow2 <raw_file> <qcow_file>
CODEComments to the command<raw_file> — input file in RAW format
<qcow_file> — output file in Qcow2 format
are in the LVM storage:
Export them and convert them to Qcow2 format:
qemu-img convert -f raw -O qcow2 <path_to_vm/raw_file> <qcow_file>
CODEComments to the command<path_to_vm/raw_file> — path and name of the source VM disk file in RAW format
<qcow_file> — output file in Qcow2 format
If the format of the VM files is different from Qcow2, perform the conversion:
qemu-img convert -f <input_format> -O qcow2 <input_file> <qcow_file>
CODEComments to the command<input_format> — input format (optional parameter):
- vdi — for VirtualBox hypervisor;
- vmdk — for VMware hypervisor;
- vpc — for Hyper-V hypervisor
<input_file> — input file
<qcow_file> — output file in Qcow2 format
Move the VM disk files to the VMmanager cluster node.
Preparation of VMmanager
- If required, prepare and connect the correct type of storage to the cluster. Read more:
- Create VMs with required parameters: Virtual machines → Create a VM. During the creation:
- Select NoOS as the operating system.
- Select or create a configuration with at least the same disk size as the original VM. If the source VM has more than one disk, select or create a configuration with the required number of disks.
- Select the required storage type.
- If you want to import a VM without changing the IP address, select the required IP address: Pool → Allocate IP.
- Stop the created VM: Virtual machines → select the VM →
menu → Stop.
Migration of VM disks
When migrating, you will need to replace the disk files created by the platform with those of the source VM. The file names should remain the same.
If the VM has one disk, the file name is id_VM-name. For example, 42_vmtest. If the VM has more than one disk, it is stored in several files. For the first disk, the file name is id_VM-name, for the other disks — id_VM-name_disk-name. For example, a VM with three disks can be stored in files 42_vmtest, 42_vmtest_disc2, 42_vmtest_disc3.
The order of transfer depends on the type of storage used.
File storage
Copy the disks of the source VM to the storage directory on the cluster node:
cp <qcow_file> <vm_dir>/<vm_file>
<qcow_file> — imported file in Qcow2 format
<vm_dir> — VM storage directory. When creating storage with the default setting — /vm.
<vm_file> — file with the VM disk
LVM storage
Import the disks of the source VM to LVM storage:
qemu-img convert -f qcow2 -O raw <qcow_file> /dev/mapper/<vm_file>
<qcow_file> — imported file in Qcow2 format
/dev/mapper/ — path to the LVM disk
<vm_file> — file with the VM disk
Ceph
Convert the disk files of the source VM to RAW format:
qemu-img convert -f qcow2 -O raw <qcow_file> <raw_file>
CODEComments to the command<qcow_file> — input file in Qcow2 format
<raw_file> — output file in RAW format
On the Ceph monitor server:
Delete the disks of the created VM:
rbd rm <pool_name>/<vm_file>
CODEComments to the command<pool_name> — name of Ceph pool
<vm_file> — file with the VM disk
Import the disks of the source VM:
rbd import <raw_file> <pool_name>/<vm_file>
CODEComments to the command<raw_file> — imported file in RAW format
<pool_name> — name of Ceph pool
<vm_file> — file with the VM disk
Starting the VM
- Run the imported VM: Enter Virtual machines → select the VM →
menu → Start.
- If necessary, connect to the VM via VNC or SPICE and change its network settings: Enter Virtual machines → select the VM →
menu → VNC (SPICE).