8.11. Migrating virtual machines from VMware vCenter¶
Starting from Acronis Cyber Infrastructure 3.5, you can migrate virtual machines from VMware vCenter 5.0 or newer to Acronis Cyber Infrastructure using the virt-v2v
tool. You will need to create a virt-v2v
appliance virtual machine to transfer and convert the data from.
8.11.1. Deploying the appliance virtual machine¶
To create a virt-v2v
appliance VM, follow these steps:
Download the
virt-v2v
appliance image from the official repository.Upload the image to Acronis Cyber Infrastructure. For example:
# vinfra service compute image create virt-v2v-img \ --file vmware_to_acronis.qcow2
Create an SSH key for the appliance if you do not have one. For example:
# vinfra service compute key create publickey \ --public-key virt-v2v-app-key.pub
Create a virtual machine and deploy the uploaded image in it. The VM needs at least two CPUs, 4 GiB RAM, and enough storage space to accomodate the largest VM to be migrated to Acronis Cyber Infrastructure. It must also be connected to the network that handles the Compute API traffic type and the network with access to VMware vCenter API. For example:
# vinfra service compute server create virt-v2v-appliance \ --flavor medium --key-name <key> --network id=<compute_API> --network id=<vcenter_API> \ --volume source=image,id=virt-v2v-img,size=<size>
Where:
<key>
is the SSH key to authorize in the appliance VM.<compute_API>
is the network that handles the traffic type Compute API.<vcenter_API>
is the network that can access the VMware vCenter API.<size>
is the disk size. For online migration, it must be enough to accomodate the largest VM of all you are going to migrate. For offline migration, it must be enough to accomodate twice as much.
8.11.2. Setting up authentication in the appliance virtual machine¶
Log in to the appliance VM as the
admin
user with the SSH key.Get root privileges, for example, with
sudo -i
.Create a bash script that will export OpenStack credentials:
# cat > user-openrc.sh << EOF export OS_PROJECT_DOMAIN_NAME=Domain_name export OS_USER_DOMAIN_NAME=Domain_name export OS_PROJECT_NAME=Project_name export OS_USERNAME=user_name export OS_PASSWORD=Password export OS_AUTH_URL=https://<admin_panel_IP_addr>:5000/v3 export OS_IDENTITY_API_VERSION=3 export OS_INSECURE=true export NOVACLIENT_INSECURE=true export NEUTRONCLIENT_INSECURE=true export CINDERCLIENT_INSECURE=true export LIBGUESTFS_BACKEND=direct EOF
Note
You will need the administrator credentials for the project that the appliance VM belongs to.
Copy the OpenStack root CA certificate and CA keys from the Acronis Cyber Infrastructure management node:
# scp root@<MN_IP>:/usr/libexec/vstorage-ui-backend/ca/ca.* /etc/pki/ca-trust/source/anchors/ # update-ca-trust extract
Where
<MN_IP>
is the management node IP address. For more information, refer to Securing OpenStack API traffic with SSL.Create a file with the VMware vCenter password to supply to
virt-v2v
. For example:# echo $vCenterPass > password.txt
Alternatively, you can enter the password during migration or supply it to
virt-v2v
with the--password-file
option.
8.11.3. Migrating virtual machines to Acronis Cyber Infrastructure online¶
Take note of the following before you proceed:
- You can migrate VMs created on vCenter 5.0 or newer.
- Remove VMware tools from Windows VMs before the migration to avoid issues on boot afterwards. You will not be able to do this after the migration. VMware tools will be removed from Linux guests automatically.
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 Acronis Cyber 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
Find out the new volume’s ID or name. For example:
# openstack --insecure volume list +--------------------------------------+------+-----------+------+-------------+ | ID | Name | Status | Size | Attached to | +--------------------------------------+------+-----------+------+-------------+ | 024b6843-2de3-4e25-a6e1-2b6ea2d601cf | sda1 | available | 64 | | +--------------------------------------+------+-----------+------+-------------+
Create a virtual machine in Acronis Cyber Infrastructure 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
8.11.4. Migrating virtual machines to Acronis Cyber Infrastructure offline¶
If the network connection between the virt-v2v
appliance VM and VMware vCenter is inferior, you can manually copy the VMs to a USB drive, connect it to the virt-v2v
appliance VM, and convert them to Acronis Cyber Infrastructure. Do the following:
Copy all of the VM files, including
vmdk
andvmx
, to a USB drive.Attach the USB drive to a host in the same local network as the appliance VM.
Log in to the appliance VM as the
admin
user with the SSH key.Get root privileges, for example, with
sudo -i
.Copy VM files to the appliance VM, for example, using
rsync
orscp
.Set OpenStack credentials:
# source user-openrc.sh
Migrate the VM to a volume in Acronis Cyber Infrastructure. For example:
# virt-v2v -i vmx <VM_config> -o openstack \ -oo server-id=635ae4cc-4c01-461a-ae63-91ca4187a7b1
Where
<VM_config>
is the VM configuration file in thevmx
format.Find out the new volume’s ID or name. For example:
# openstack --insecure volume list +--------------------------------------+------+-----------+------+-------------+ | ID | Name | Status | Size | Attached to | +--------------------------------------+------+-----------+------+-------------+ | 024b6843-2de3-4e25-a6e1-2b6ea2d601cf | sda1 | available | 64 | | +--------------------------------------+------+-----------+------+-------------+
Create a virtual machine in Acronis Cyber Infrastructure 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