---
title: Initiating and canceling live migration
---

# Initiating and canceling live migration {#virt-initiating-live-migration}

To move a running virtual machine (VM) to a different node without interrupting the workload, you can initiate a live migration. You can also cancel an ongoing migration to keep the VM on its original node.

You can initiate the live migration of a virtual machine (VM) to another node by using the OpenShift Container Platform web console or the command line.

You can cancel a live migration by using the web console or the command line. The VM remains on its original node.

> [!TIP]
> You can also initiate and cancel live migration by using the `virtctl migrate <vm_name>` and `virtctl migrate-cancel <vm_name>` commands.

## Initiating live migration by using the web console {#virt-initiating-vm-migration-web_virt-initiating-live-migration}

You can live migrate a running virtual machine (VM) to a different node in the cluster by using the OpenShift Container Platform web console.

> [!NOTE]
> The **Migrate** action is visible to all users but only cluster administrators can initiate a live migration.

**Prerequisites**

- You have the `kubevirt.io:migrate` RBAC role or you are a cluster administrator.
- The VM is able to be migrated.
- If the VM is configured with a host model CPU, the cluster has an available node that supports the CPU model.

**Procedure**

1. Navigate to **Virtualization** → **VirtualMachines** in the web console.
2. Take either of the following steps:

   - Click the Options menu ![](/openshift-docs-markdown/images/kebab.png "Options menu") beside the VM you want to migrate, hover over the **Migrate** option, and select **Compute**.
   - Open the **VM details** page of the VM you want to migrate, click the **Actions** menu, hover over the **Migrate** option, and select **Compute**.
3. In the **Migrate Virtual Machine to a different Node** dialog box, select either **Automatically Selected Node** or **Specific Node**.

   1. If you selected the **Specific Node** option, choose a node from the list.
4. Click **Migrate Virtual Machine**.

## Initiating live migration by using the CLI {#virt-initiating-vm-migration-cli_virt-initiating-live-migration}

You can initiate the live migration of a running virtual machine (VM) by using the command line to create a `VirtualMachineInstanceMigration` object for the VM.

**Prerequisites**

- You have installed the OpenShift CLI (`oc`).
- You have the `kubevirt.io:migrate` RBAC role or you are a cluster administrator.

**Procedure**

1. Create a `VirtualMachineInstanceMigration` manifest for the VM that you want to migrate:

   ```yaml
   apiVersion: kubevirt.io/v1
   kind: VirtualMachineInstanceMigration
   metadata:
     name: <migration_name>
   spec:
     vmiName: <vm_name>
   ```
2. Create the object by running the following command:

   ```terminal
   $ oc create -f <migration_name>.yaml
   ```

   The `VirtualMachineInstanceMigration` object triggers a live migration of the VM. This object exists in the cluster only while the virtual machine instance is running, unless manually deleted.

**Verification**

- Obtain the VM status by running the following command:

  ```terminal
  $ oc describe vmi <vm_name> -n <namespace>
  ```

  Example output:

  ```yaml
  # ...
  Status:
    Conditions:
      Last Probe Time:       <nil>
      Last Transition Time:  <nil>
      Status:                True
      Type:                  LiveMigratable
    Migration Method:  LiveMigration
    Migration State:
      Completed:                    true
      End Timestamp:                2018-12-24T06:19:42Z
      Migration UID:                d78c8962-0743-11e9-a540-fa163e0c69f1
      Source Node:                  node2.example.com
      Start Timestamp:              2018-12-24T06:19:35Z
      Target Node:                  node1.example.com
      Target Node Address:          10.9.0.18:43891
      Target Node Domain Detected:  true
  ```

## Canceling live migration by using the web console {#virt-canceling-vm-migration-web_virt-initiating-live-migration}

You can cancel the live migration of a virtual machine (VM) by using the OpenShift Container Platform web console.

**Prerequisites**

- You have the `kubevirt.io:migrate` RBAC role or you are a cluster administrator.

**Procedure**

1. Navigate to **Virtualization** → **VirtualMachines** in the web console.
2. Select **Cancel Migration** on the Options menu ![](/openshift-docs-markdown/images/kebab.png "Options menu") beside a VM.

## Canceling live migration by using the CLI {#virt-canceling-vm-migration-cli_virt-initiating-live-migration}

Cancel the live migration of a virtual machine by deleting the `VirtualMachineInstanceMigration` object associated with the migration.

**Prerequisites**

- You have installed the OpenShift CLI (`oc`).
- You have the `kubevirt.io:migrate` RBAC role or you are a cluster administrator.

**Procedure**

- Delete the `VirtualMachineInstanceMigration` object that triggered the live migration, `migration-job` in this example:

  ```terminal
  $ oc delete vmim migration-job
  ```

**Additional resources**
{._additional-resources}

- [About live migration permissions](/openshift-docs-markdown/virt/live_migration/virt-about-live-migration#virt-about-live-migration-permissions_virt-about-live-migration)
- [Initiating live migration by using the web console](/openshift-docs-markdown/virt/live_migration/virt-initiating-live-migration#virt-initiating-vm-migration-web_virt-initiating-live-migration)
- [Initiating live migration by using the CLI](/openshift-docs-markdown/virt/live_migration/virt-initiating-live-migration#virt-initiating-vm-migration-cli_virt-initiating-live-migration)
- [Canceling live migration by using the web console](/openshift-docs-markdown/virt/live_migration/virt-initiating-live-migration#virt-canceling-vm-migration-web_virt-initiating-live-migration)
- [Canceling live migration by using the CLI](/openshift-docs-markdown/virt/live_migration/virt-initiating-live-migration#virt-canceling-vm-migration-cli_virt-initiating-live-migration)
