HCX OS-Assisted Migration (OSAM) Linux Fixup
search cancel

HCX OS-Assisted Migration (OSAM) Linux Fixup

book

Article ID: 441937

calendar_today

Updated On:

Products

VMware HCX

Issue/Introduction

Linux fixup uses a separate HCX-OSAM software stack to perform fixup operations and boot up the migrated VM. The software stack is a complete linux distribution which includes kernel + libraries + utilities. There are 2 such stacks one for 64-bit system and one for 32-bit system. The 64-bit stack is Photon 2.0 based. These software stacks are packaged as separate VMDKs which are part of SDR. The 64-bit stack is attached to SCSI controller 0, port 1; the 32-bit stack is attached to SCSI controller 0, port 2. The VMware Tools is included in the fixup stacks. The fixup will be the final portion of the migration performed by HCX during an OSAM migration before the sentinel agent is uninstalled, once the vm is in the vCenter environment.

Fixup is performed in 2 stages:

  1. Stage-1 fixup performed by HCX-OSAM stack
  2. Stage-2 fixup performed by Sentinel

Environment

VMWare HCX 

Resolution

Pre-Fixup

The manager performs the following pre-fixup tasks before Stage-1 fixup is triggered:

  • Create the migrated VM based on the blueprint of the source system with relevant CPU, Memory and Network Adapters (in disconnected state)
  • Mount the replica disks starting from SCSI controller 0, port 0 onward. The replica boot disk of the source VM is attached to scsi0:0
  • Copy the fixup disk and attach it to scsi0:15
  • Change the boot order of the migrated VM to boot from scsi0:15, so the system boots up from fixup disk to perform the Stage-1 fixup
  • Power On the migrated VM to trigger Stage-1 fixup

Stage 1 of Fixup

This stage of the fixup is called the out-of-guest fixup and is performed by the HCX-OSAM software stack residing on the fixup disk. Here are the steps performed during Stage-1 fixup:

  1. Fixup code residing on the fixup disk creates a folder /tmp/fixup; Manager will monitor for the presence of this folder
  2. Manger will create the following files needed for fixup:
    1. /tmp/fixup/system-configuration.json; this file contains the system configuration
    2. /tmp/fixup/replica-disk-map.json; this file contains the replica disk configuration
    3. /tmp/fixup/network-interface-map.json; this file contains the source NIC mapping to the NICs on the migrated system
    4. /tmp/fixup/BEGIN; to indicate the fixup code to begin the fixup process
  3. Fixup code will begin the fixup process by fixing the following:
    1. Modifying /etc/fstab as needed
    2. Rebuilding initrd/initramfs image
    3. Reinstall the boot loader
    4. Interfaces are renamed as eth0, eth1, etc.. and will be mapped based on the source mac-address
    5. Modifying /etc/sysconfig/network-scripts/ifcfg-XXX files on RHEL based systems and changing the interface names accordingly
    6. Modifying /etc/network/interfaces file on Ubuntu based systems and changing the interface names accordingly
    7. Disk related fixup which include:
    8. NIC related fixup which include:
    9. Modify the system to run in single-user mode and add additional code to perform in-guest fixup (or stage-2 fixup)
  4. During the fixup process, fixup code will create a file /tmp/fixup/progress.txt; which contain all the above actions that fixup code performs
  5. Once the fixup is complete, fixup code will create the following files:
    1. /tmp/fixup/fixup.log; this contains the log information that was captured by /tmp/fixup/progress.txt
    2. /tmp/fixup/result.json; this contains the result of the fixup operation
    3. /tmp/fixup/END; this indicate the manager that the Stage-1 fixup has completed

Pre Stage 2 of Fixup

The manager upon seeing the /tmp/fixup/END file, performs the following operations:

  • Collect the fixup log and result.json file from the migrated VM. The fixup log and result.json are copied on the cloud manager under /common/logs/admin as <mig-id>_fixup.log and <mig-id>_result.json respectively
  • Power-off the migrated VM
  • Change the boot order of the migrated VM to boot from scsi0:0
  • Add the CDROM drive
  • Power-On the migrated VM to trigger Stage-2 fixup
  • Mount the VMware Tools ISO

Stage 2 of Fixup

  1. This stage of the fixup is also called the in-guest fixup and is performed by the sentinel software that was installed on the source system. Here are the steps performed during Stage-2 fixup:
    1. Poll for the presence of VMware Tools ISO
    2. Install VMware Tools
    3. Switch the system from single-user mode to original run level as configured on the source system
    4. The in-guest fixup operations are performed by Sentinel, which makes sure that the migrated system will boot the same as the original system. This is enabled via the various files created by out-of-guest fixup code under /opt/vmware/hcx/osam/data. This include restoring the /etc/inittab, systemd-default-target, selinux-mode etc..
    5. Delete the in-guest fixup code and uninstall the sentinel
    6. Power-off the system

OSAM Overview