Live Migration of Workloads

Migrating workloads between compute nodes and storage types is a crucial feature of any modern hypervisor. OpenShift Virtualization allows the sumple and easy process of migrating your virtual machine compute and storage from one place to another.

In this lab, you will start by migrating the virtual machine compute from one node to another. Then, you will migrate the VM’s storage from one StorageClass to another.

Accessing the OpenShift Cluster

Web Console

{openshift_cluster_console_url}[{openshift_cluster_console_url},window=_blank]

CLI Login
oc login -u {openshift_cluster_admin_username} -p {openshift_cluster_admin_password} --server={openshift_api_server_url}
Cluster API

{openshift_api_server_url}[{openshift_api_server_url},window=_blank]

OpenShift Username
{openshift_cluster_admin_username}
OpenShift Password
{openshift_cluster_admin_password}

Compute Migration to a specific node

During maintenance or troubleshooting, you might need to migrate a VM to a different node. Live migration is the process of moving a running Virtual Machine Instance (VMI) to a different node without disruption.

This is similar to the VMware vMotion feature for VMs.

In this lab, you will be performing a live migration of a virtual machine from one compute node to another. To do this, you will access a running VM, determine its current node, and then move it to another node.

Requirements

  • The underlying PVC must use ReadWriteMany (RWX) access mode

  • The pod network must not be configured with the bridge binding type.

  • Ports 49152 and 49153 must be available in the VM’s virt-launcher pod; live migration fails if these ports are specified in a masquerade network interface.

  • CPU model must match on the source and destination node

Instructions

  1. Ensure you are logged in to the OpenShift Console as the admin user from your web browser and continue to the next step.

  2. Navigate to Virtualization → Virtual Machines and then click on the virtual machine named live-migrate-vm1. Note which node the VM is currently running on under General → Node. In this example, it is worker-cluster-m2ssq-1, but your worker node will be different.

    01 image compute 002
    Figure 1. Virtual machine details
  3. To migrate the VM to another worker node, click on the Actions menu, hover over Migration, and then click on Compute.

    01 image compute 003
    Figure 2. Initiate migration
  4. You will be presented with a window that asks if you would like to select the target worker node Automatically or to select a Specific Node.

    01 image compute 004
    Figure 3. Configure migration
  5. Change the selection to Specific Node and then check the box next to a node (e.g. worker-cluster-m2ssq-1. Your lab will have a different node name).

    01 image compute 005
    Figure 4. Select worker node
  6. Wait a few moments and you will see that the Virtual Machine status changes from Running to Migrating.

    01 image compute 006
    Figure 5. VM is migrating
  7. A few moments after that, the Virtual Machine status will return to Running. Note that the worker node is now on the new worker node (e.g. worker-cluster-m2ssq-1).

    01 image compute 007
    Figure 6. VM is running
  8. The VM has migrated to a new worker node while still running. Note that you will use this live migration process again later in this lab.

Compute Migration to a random node

During maintenance or troubleshooting, you might need to migrate a VM to a different node. Live migration is the process of moving a running Virtual Machine Instance (VMI) to a different node without disruption.

This is similar to the VMware vMotion feature for VMs.

In this lab, you will be performing a live migration of a virtual machine from one compute node to another. To do this, you will access a running VM, determine its current node, and then move it to another node.

Requirements

  • The underlying PVC must use ReadWriteMany (RWX) access mode

  • The pod network must not be configured with the bridge binding type.

  • Ports 49152 and 49153 must be available in the VM’s virt-launcher pod; live migration fails if these ports are specified in a masquerade network interface.

  • CPU model must match on the source and destination node

Instructions

  1. Ensure you are logged in to the OpenShift Console as the admin user and continue to the next step.

  2. Navigate to Virtualization → Virtual Machines and then click on the virtual machine named live-migrate-vm1. Note which worker node the VM is currently running on (example: worker-cluster-m2ssq-1. Your cluster will have a different node name).

    01 image compute 002
    Figure 7. Virtual machine details
  3. To migrate the VM to another worker node, click on the Actions menu, hover over Migration, and then click on Compute.

    01 image compute 003
    Figure 8. Initiate migration
  4. You will be presented with a window that asks if you would like to select the target worker node Automatically or to select a Specific Node. Leave the selection at the default, which is to migrate to an Automatically selected Node

    01 image compute 004
    Figure 9. Configure migration
  5. Wait a few moments and you will see that the Virtual Machine status changes from Running to Migrating.

    01 image compute 006
    Figure 10. VM is migrating
  6. A few moments after that, the Virtual Machine status will return to Running. Note that the worker node has changed (e.g. worker-cluster-m2ssq-3).

    01 image compute 007
    Figure 11. VM is running
  7. The VM has migrated to a new worker node while still running. Note that you will use this live migration process again later in this lab.

Storage Migration

Storage environments often have their own lifecycles and performance profiles, so it is important to be able to move virtual machines from one storage type to another for lifecycle and performance management. OpenShift Virtualization allows the migration of PVCs from one StorageClass to another while the virtual machine is running.

This is similar to the VMware Storage vMotion feature for VMs.

Requirements

TBD

Instructions

  1. Ensure you are logged in to the OpenShift Console as the admin user and continue to the next step.

  2. Navigate to Virtualization → Virtual Machines, and select the virtualmachines project. Select the VM named live-migrate-vm1.

    01 image storage 001
    Figure 12. Virtual machine details
  3. Click on the Configuration tab and select Storage. Note that the VM currently has a single bootable disk that is using the StorageClass called ocs-external-storagecluster-ceph-rbd.

    01 image storage 002
    Figure 13. View storage details
  4. Click on the Console tab and login to the virtual machine using the credentials above the console window. Run a command, such as top or ping, that will continue running as we perform the remainder of this exercise.

    01 image storage 003
    Figure 14. Run command on console
  5. Click on the Actions menu and hover over Migration and click on Storage.

    01 image storage 004
    Figure 15. Initiate storage migration
  6. In the window that appears, review the options and then click on Next. It is not necessary to change any settings at this time.

    01 image storage 005
    Figure 16. Migration details
  7. In the next screen, select the Destination Storage Class called custom-storage-class. Click Next.

    01 image storage 006
    Figure 17. Select destination StorageClass
  8. Review the storage migration configuration and then click on Migrate VirtualMachine storage.

    01 image storage 007
    Figure 18. Review migration details
  9. The next window will show you the status of the storage migration. It is safe to close the window with the X in the top corner, or you may click on the link to View storage migrations. Do not click the Stop button.

    01 image storage 008
    Figure 19. Migration has started
  10. To view the storage migration status, navigate to Migration for Virtualization → Storage migrations where you can view the status of the migration plan. The migration plan will start in the Pending state, then move to Running, then finally Completed.

    It may take some time for the migration to complete.
    01 image storage 009
    Figure 20. Migration is running
  11. Once the migration is Complete, navigate back to the virtual machine called live-migrate-vm1 and view the Configuration → Storage options again. Note that the name of the Source has changed and the Storage class has changed to custom-storage-class, which is what you selected in the storage migration plan.

    01 image storage 010
    Figure 21. VM has been migrated
  12. Click on the Console tab. You will see that your application is still running uninterrupted.

    01 image storage 011
    Figure 22. No interruption during storage migration