Skip to content

v2v: VMware-to-Cockpit (VM Migration Tools)

v2v is a utility tool designed to migrate virtual machines from VMware vCenter/ESXi directly into a persistent Libvirt virtual machine on the local host system (Vapor platform virtualization), utilizing virt-v2v.

It automatically installs all necessary migration packages (including virt-v2v, libguestfs, qemu-utils, and a compatibility kernel image) inside a self-contained Docker container.

The VM migration process is performed through Vapor. Once the migration process is successful, the VM will appear in Cockpit and can be managed through Cockpit.

Pre-flight Requirements

You need to install Docker to process migration.

To execute the migration successfully, the host system and the docker container require:

  1. Privileged Mode: Required to access host virtualization, /dev/kvm hardware acceleration, and system sockets.
  2. Libvirt Socket Access: Mount /var/run/libvirt inside the container.
  3. Storage Pool Access: Mount storage pool folders (such as /var/lib/libvirt/images or /home/awanio/data/virtualcompute).
  4. KVM Device Mount: Access /dev/kvm for fast guestfs appliance virtualization.

Running Migration via Vapor terminal

Processes 1 and 2 below are performed only once to install the Docker container. If the Docker container is already available, you only need to run process 3.

1. Download Image

To download image

bash
docker run --rm r.awan.app/library/tools/v2v:v1.0.4 bootstrap > v2v-install.sh

2. Install/run the image as a container:

bash
sudo sh v2v-install.sh

3. Migrate VM

A. Execute via Vapor terminal

You can run the migration tool either Interactively (recommended) or via CLI Arguments.

Interactively

This mode prompts you for connection settings and target properties, validating input dynamically and listing saved connections.

bash
sudo docker exec -it v2v migrate-v2v -i

Walkthrough:

  1. Credentials Selection: If saved credentials exist, choose a connection or choose to enter new details.
  2. Connection Type: Select vpx (vCenter/vSphere) or ssh (direct ESXi).
  3. VMware Details: Host/IP, Username, Password, and connection-specific details:
    • For vpx: Datacenter path (e.g. /Datacenter/Cluster/Host), SSL certificate verification skip.
    • For ssh: Path to target guest .vmx file on ESXi.
  4. Credentials Storage: Choose whether to persist these credentials to credentials.json (saved with restricted 0600 permissions).
  5. Source VM: Name of the VM to migrate.
  6. Target Config: Target VM Name on Vapor, Target Storage Pool, and Network interface configuration (Network vs. Bridge mapping).
  7. Execution: Real-time console output of virt-v2v conversion progress.
Standard CLI Mode

You can also run the tool non-interactively by specifying the command-line arguments:

bash
# vCenter Example:
sudo docker exec -it v2v migrate-v2v \
  --type vpx \
  --host vcenter.example.com \
  --username administrator@vsphere.local \
  --datacenter-path /Datacenter/Cluster/Host \
  --source-vm my-vcenter-vm \
  --target-name my-vapor-vm \
  --storage-pool virtualcompute \
  --network-name default

# Direct ESXi/VMX Example:
sudo docker exec -it v2v migrate-v2v \
  --type ssh \
  --host esxi.example.com \
  --username root \
  --vmx-path /vmfs/volumes/datastore1/my-vm/my-vm.vmx \
  --source-vm my-vm \
  --target-name my-vapor-vm \
  --storage-pool default

CLI Options:

  • --interactive, -i: Launch interactive prompt.
  • --type: Connection type (vpx or ssh).
  • --host: VMware host or IP address.
  • --username: VMware connection username.
  • --password: VMware password (if omitted, you will be prompted securely).
  • --datacenter-path: vCenter Datacenter path.
  • --vmx-path: Path to target guest .vmx file on ESXi.
  • --source-vm: Source VM name.
  • --target-name: Name of the migrated VM on target Vapor.
  • --storage-pool: Target storage pool (default: default).
  • --network-type: Target network mode (network or bridge, default: network).
  • --network-name: Target network/bridge name (default: default).

B. Execute Migration from container terminal

Once the container status shows as running:

  1. Click the container actions dropdown and select the Terminal action.
  2. The container terminal will open. A banner tip will appear showing the migration command:
    bash
    migrate-v2v -i
  3. Type migrate-v2v -i inside the terminal to run the interactive wizard, or launch it with the required CLI arguments directly.