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.
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 different hypervisors may use different drivers when working with WIndows OS, the correct import of VMs with Windows family OS is not guaranteed.
On VMs with Windows OS imported from Hyper-V, increasing resources with the Add resources without restarting the VM option may not work properly.
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>
Comments to the command -
Convert disc files to Qcow2 format:
qemu-img convert -f raw -O qcow2 <raw_file> <qcow_file>
Comments to the command
-
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>
Comments to the command
-
-
-
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>
Comments to the command - 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>
Local 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>
Network LVM storage
Import the disks of the source VM to LVM storage:
qemu-img convert -f qcow2 -O raw <qcow_file> /dev/Network_lvm_<dev_disk>/<id_name>
Ceph
-
Convert the disk files of the source VM to RAW format:
qemu-img convert -f qcow2 -O raw <qcow_file> <raw_file>
Comments to the command -
On the Ceph monitor server:
-
Delete the disks of the created VM:
rbd rm <pool_name>/<vm_file>
Comments to the command -
Import the disks of the source VM:
rbd import <raw_file> <pool_name>/<vm_file>
Comments to the command
-
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). Read more about the network settings in the Assigning IP addresses with OS tools article.