Chapter 4. Migrating the Infrastructure

Migrating your infrastructure comprises 2 tasks:

  • Mapping the resources (cluster, datastore, and networks) of your source environment to your target environment and selecting virtual machines to migrate
  • Creating a migration plan with optional automated tasks that run before or after each virtual machine is migrated

    You can cancel a migration plan that is in progress. This option allows you to retry the migration plan immediately or to schedule it in the future.

4.1. Creating an Infrastructure Mapping

The infrastructure mapping maps your VMware resources to RHV resources.

Migration Screen

Compute Manage UI

Note

Before creating an infrastructure mapping, you must authenticate the RHV conversion hosts. If the hosts are not authenticated, the mapping will display a missing networks error.

If you add or remove providers or provider objects from an infrastructure mapping, the mapping will display missing resource errors.

  1. Click ComputeMigration.
  2. Click Create Infrastructure Mapping.
  3. Enter the name of your mapping and click Next.
  4. Select a source cluster and a target cluster.

    Note

    A target cluster that does not contain a conversion host displays a warning icon ( warning ), which appears after a few seconds' delay for polling the clusters and refreshing the UI.

  5. Click Add Mapping and Next.
  6. Map the datastore of each cluster:

    1. Select the target cluster from the drop-down list.
    2. Select a source datastore and a target datastore.
    3. Click Add Mapping and Next.
  7. Map the network of each cluster:

    1. Select the target cluster from the drop-down list.
    2. Select a source network and a target network.
    3. Click Add Mapping.
  8. Click Create.
  9. If a successful mapping message is displayed, click Close. If error messages appear, see Chapter 5, Troubleshooting.

    Your infrastructure mapping is displayed in ComputeMigration.

    infrastructure mapping created

After you have created a successful infrastructure mapping, you are ready to create and run a migration plan.

4.2. Creating and Running a Migration Plan

Prerequisites

  • Create a CSV file listing the source virtual machines if you are migrating a large number of virtual machines or if you are remigrating previously migrated virtual machines.

    The CSV file contains the virtual machine names (mandatory) and providers (optional, to differentiate virtual machines with identical names) in the following format:

    Name, Provider
    vm01, vSphere3
    vm02, vSphere3
    vm03, vSphere3
    ...
    Note

    If you are migrating a small number of virtual machines, you do not need to create a CSV file. The migration plan can discover and display a list from which you manually select the virtual machines to migrate.

  • Check the target datastore to ensure that no virtual machine has the same name as a source virtual machine.
  • Unmount ISO images from source virtual machines.
Note

A virtual machine will be in the same power state (on or off) after migration as it was before migration.

Procedure

  1. Click ComputeMigration.
  2. Click Create Migration Plan.
  3. Select the infrastructure mapping from the drop-down list.
  4. Enter the name of your migration plan.
  5. Discover the virtual machines:

    • If you are migrating a small number of virtual machines, select Choose from a list of VMs discovered in the selected infrastructure mapping and click Next.

Discovered Virtual Machines

Discover VMs

  • If you are importing a CSV file:

    1. (Optional) You can validate your infrastructure mapping. Select Choose from a list of VMs discovered in the selected infrastructure mapping and click Next. If your virtual machines appear in the list, the infrastructure mapping is correct. Click Back.
    2. Select Import a CSV file with a list of VMs to be migrated and click Next.
    3. Click Import, browse to the CSV file, and click Open.

      1. Select the virtual machines to migrate and click Next to go to Advanced Options.

        Advanced Options

        Advanced Options

        (Optional) You can select Ansible playbook services to run on the virtual machines in the migration plan before or after the migration. For example, the RHEL pre-migration playbook performs several tasks to configure a target RHEL virtual machine. You must create the Ansible environment and service catalog item before the migration plan.

      2. Click Next to go to Schedule.
      3. Select Save migration plan to run later or Start Migration Immediately and click Create.
  • If you selected Save migration plan to run later, the migration plan is saved in Migration Plans Not Started.

    To schedule the migration plan, click the Schedule button, select a date and time, and click Schedule. The plan’s status is Migration Scheduled with the date and time.

    Note

    If you wish to run a scheduled plan immediately, click Migrate.

    To edit or delete a schedule or plan, click the More Actions icon.

  • If you selected Start Migration Immediately, the migration plan runs immediately.

    The migration plan may take some time to complete. The migration plan displays progress bars showing the amount of data being transferred, the number of virtual machines being migrated, and the elapsed time.

    To view the migration progress of individual virtual machines, click Migration Plans in ProgressMigration Plan to display the migration plan details.

    Note

    During migration, the counter displaying the migration plan progress (in ComputeMigration) may be a few seconds ahead of the counter that appears in the migration plan details (ComputeMigrationMigration Plan). This is because the migration plan counter displays the total time to run the migration plan, while the migration plan details counter displays the time to migrate the virtual machines.

    1. When the migration plan has finished, check the status of the migration plan under Completed Migrations. The completed migration plan shows successfully migrated virtual machines. If error messages appear, see Chapter 5, Troubleshooting.

Remigrating Virtual Machines

If your migration goals change, you can remigrate previously migrated virtual machines:

  1. Delete the target virtual machines corresponding to the source virtual machines that you are remigrating.
  2. Delete the disks that were created in the target datastore during the earlier migration to free up space.
  3. Create a CSV file to import the source virtual machines.

    Note

    The source virtual machines cannot be discovered automatically by the migration plan because they are marked in the CloudForms VMDB as migrated.

  4. Create and run a new migration plan.

4.3. Canceling a Migration Plan

You can cancel a migration plan that has started and displays the progress bars:

  1. Click Migration Plans in ProgressMigration Plan to display the migration plan details.
  2. Select the migration plan check box and click Cancel Migration.
  3. Click Cancel Migrations to confirm the cancellation. The canceled migration appears in Migration Plans Complete with a red x indicating that the plan did not complete successfully.

You can click Retry to run the migration plan immediately or Schedule to run the migration plan in the future.

Click the More Actions button to archive, edit, or delete the migration plan.

4.4. Advanced Option: Automating Pre- and Post-Migration Tasks with Ansible

You can perform automated tasks before and after a virtual machine is migrated, such as removing web servers from a load-balancing pool before migration and adding them back to the pool after migration. Each task is an Ansible service catalog item, which you select when you create the migration plan.

The Ansible service catalog item must exist before you create the migration plan. The CloudForms inventory must contain at least one repository, one playbook, and one credential.

To set up the Ansible environment and create a service catalog item:

IMS RHEL Pre-migration Ansible Playbook Example

The ims.rhel_pre_migration role performs the following tasks to configure a target Red Hat Enterprise Linux virtual machine:

  • Preserving the static IP address configuration
  • Installing the Red Hat Virtualization guest agent

This example registers a virtual machine with a Satellite 6 server and enables the rhel-7-server-rpms repository. If no variables are provided, the playbook assumes that the repositories are already configured and installs the guest agent while maintaining the static IP address.

---
- hosts: all
  vars:
    rhsm_config:
      server_hostname: "satellite.example.com"
      server_username: "admin"
      server_password: "password"
      org_id: "organization"
    rhsm_repositories:
      - "rhel-7-server-rpms"
  roles:
    - role: ims.rhel_pre_migration