Skip to content

Repository files navigation

ESXi → Elemento Migration

Tools to migrate virtual machines from a VMware ESXi host to Elemento (AtomOS), built on pyVmomi.

For each VM found on the ESXi host, the tool will:

  1. Connect to the host and enumerate its VMs.
  2. Power off each VM (if running).
  3. Locate its .vmdk / .vmx / .nvram files on the datastore (via SSH) and download them locally to esxi_files/.
  4. Convert the VM's config, disks and NICs to Elemento's C4 spec format.
  5. Import each disk as a volume, create the required networks, and register the VM on Elemento.

Project layout

  • main.py — CLI entry point; connects to ESXi and drives the migration.
  • esxi.py — ESXi/vSphere helpers (VM/host inspection, power state, file discovery & download, C4 spec conversion).
  • elemento.py — Elemento/AtomOS API client (auth, volume import, network creation, VM registration).
  • ssh.py — Enables/disables the SSH (TSM-SSH) service on the ESXi host.
  • pyvmomi/ — Vendored copy of the pyVmomi SDK.

Requirements

  • Python 3
  • A virtual environment
  • Network access to both the ESXi host and the Elemento host

Setup

python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Copy the sample environment file and fill in your credentials:

cp .env.sample .env

.env:

ESXI_USERNAME=root
ESXI_PASSWORD=
ESXI_HOST=
ELEMENTO_HOST_IP_ADDRESS=
ELEMENTO_HOST_USERNAME=
ELEMENTO_HOST_PASSWORD=

Optional variables (with defaults) recognized by elemento.py:

  • ELEMENTO_VM_API_URL (default :7777/api/v1.0/)
  • ELEMENTO_VOLUME_API_URL (default :7772/api/v1.0/)
  • ELEMENTO_NETWORK_API_URL (default :7776/api/v1.0/)
  • ELEMENTO_PORTAL_USERNAME / ELEMENTO_PORTAL_PASSWORD — used to authenticate against the Elemento portal; falls back to ELEMENTO_API_TOKEN if login fails
  • ATOMOS_ALLOW_INSECURE_TLS — set to true to skip TLS verification on Elemento API calls

Running

Activate the venv, then run main.py:

source venv/bin/activate
python main.py --host 192.168.1.10 --user root --insecure 

If --host/--user/--password are omitted, they fall back to the .env values (ESXI_HOST, ESXI_USER, ESXI_PASSWORD). If no password is provided at all, you'll be prompted for one securely.

CLI options

Flag Description
--host ESXi host or IP address
--user Username (default: root)
--password Password (prompted securely if omitted)
--port HTTPS port (default: 443)
--insecure Disable SSL certificate validation (self-signed certs)
--enable-ssh Enable and start the SSH (TSM-SSH) service on the host before migrating

Example

python main.py \
  --host esxi.lab.local \
  --user root \
  --insecure \
  --enable-ssh

This connects to esxi.lab.local, prints host info, enables SSH on the host, then lists and migrates every VM found — downloading its disk/config files and registering it on the Elemento host configured via ELEMENTO_HOST_IP_ADDRESS.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages