Migrating virtual machines to Virtuozzo Hybrid Infrastructure online
Limitations
- You can migrate VMs created on vCenter 5.0 or newer.
Prerequisites
- Authentication is configured in the appliance VM, as described in Setting up authentication in the appliance virtual machine.
- Remove VMware tools from Windows VMs before the migration to avoid issues on boot afterwards. VMware tools will be removed from Linux guests automatically.
To migrate a VM from VMware vCenter online
- Log in to the appliance VM as the
admin
user with the SSH key. - Get root privileges, for example, with
sudo -i
. -
Set OpenStack credentials:
# source user-openrc.sh
-
Test the connection between libvirt and VMware vCenter. For example:
# virsh -c 'vpx://<domain>%5c<user>@<hostname>?no_verify=1' list --all Enter root's password for vcenter.example.com: *** +----+--------------+----------+ | Id | Name | <...> | +----+--------------+----------+ | - | Fedora 20 | <...> | | - | Windows 2008 | <...> | +----+--------------+----------+
Where
<hostname>
is the name of the VMware ESXi host that runs virtual machines. Its full path looks like <vCenter_hostname>/<datacenter_name>/<cluster_name>/<server_hostname> and can be found in VMware vCenter.If the VPX username contains a backslash (for example,
<domain>\<user>
), escape it with%5c
:<domain>%5c<user>
. Similarly, escape spaces with%20
. -
Check the OpenStack connection and find out the
virt-v2v
appliance ID. For example:# openstack --insecure server list +--------------------------------------+--------------------+--------+-------+ | ID | Name | Status | <...> | +--------------------------------------+--------------------+--------+-------+ | 635ae4cc-4c01-461a-ae63-91ca4187a7b1 | virt-v2v-appliance | ACTIVE | <...> | +--------------------------------------+--------------------+--------+-------+
- Shut down the VM. Windows VMs must be shut down gracefully for the migration to be successful.
-
Migrate the VM to a volume in Virtuozzo Hybrid Infrastructure specifying a storage policy. To list available storage policies, run
vinfra service compute storage-policy list
in Virtuozzo Hybrid Infrastructure. For example:# virt-v2v -ip password.txt -ic 'vpx://<domain>%5c<user>@<hostname>\ ?no_verify=1' 'Windows 2008' -o openstack -oo server-id=635ae4cc-\ 4c01-461a-ae63-91ca4187a7b1 -os <policy_name>
Where
<policy_name>
is the storage policy for the converted volume. -
Find out the new volume’s ID or name. For example:
# openstack --insecure volume list +---------------------+------+-----------+------+-------------+ | ID | Name | Status | Size | Attached to | +---------------------+------+-----------+------+-------------+ | 024b6843-2de3-<...> | sda1 | available | 64 | | +---------------------+------+-----------+------+-------------+
-
If the VM used UEFI firmware, manually set the correct OS distribution and UEFI firmware type for the converted volume. To list available distributions, run
vinfra service compute show
in Virtuozzo Hybrid Infrastructure. For example:# openstack --insecure volume set sda1 --image-property os_distro=win2k8 # openstack --insecure volume set sda1 --image-property hw_firmware_type=uefi
-
In Virtuozzo Hybrid Infrastructure, create a virtual machine based on the new volume. For example:
# vinfra service compute server create migratedvm --network id=private \ --network id=public --volume source=volume,id=sda1,size=64 --flavor medium
After the migration, it is recommended to install the guest tools inside the VM. The guest tools installation will prevent possible problems with guest OS interaction via the VNC console.