hypersdk

Getting Started with hypersdk

Welcome to hypersdk - the Go implementation of the hyper2kvm migration toolkit!


🎯 What is hypersdk?

A high-performance, daemon-based VM export system that provides:

  1. Interactive CLI (hyperexport) - Beautiful terminal UI for manual exports
  2. Background Daemon (hypervisord) - REST API service for automation
  3. Control CLI (hyperctl) - Manage daemon jobs from command line

Built with:


πŸš€ Deployment Options

Choose the deployment method that best fits your environment:

Get up and running in under 5 minutes with containers:

# Build and start full stack
git clone https://github.com/ssahani/hypersdk.git
cd hypersdk
./deployments/scripts/build-images.sh --builder podman
cd deployments/docker && podman compose up -d

# Access dashboard
open http://localhost:8080/web/dashboard/

Includes: HyperSDK + Redis + Prometheus + Grafana monitoring

See Docker/Podman Guide for details.

Deploy to Kubernetes with Kustomize:

git clone https://github.com/ssahani/hypersdk.git
cd hypersdk
./deployments/scripts/deploy-k8s.sh development
kubectl port-forward -n hypersdk svc/hypervisord 8080:8080

See Kubernetes Guide for details.

Option 3: Native Installation (Traditional Method)

Install directly on Linux:

# Install RPM package
sudo dnf install hypersdk-*.rpm

# Or build from source
make build && sudo make install

See Installation Guide for details.


⚑ Quick Start (Native Installation)

1. Set Your vCenter Credentials

export GOVC_URL='https://your-vcenter.com/sdk'
export GOVC_USERNAME='administrator@vsphere.local'
export GOVC_PASSWORD='your-password'
export GOVC_INSECURE=1

2. Choose Your Workflow

Option A: Web Dashboard (Easiest!)

# Start daemon
cd ~/projects/hypersdk
./build/hypervisord

# Open in browser
xdg-open http://localhost:8080/web/dashboard/

What You Can Do:

Dashboard URLs:

Option B: Interactive Mode (For CLI Users)

cd ~/projects/hypersdk
./build/hyperexport

Then:

Option C: Daemon Mode (For Automation)

Terminal 1 - Start Daemon:

./build/hypervisord

Terminal 2 - Submit Jobs:

# Single VM
./build/hyperctl submit -vm "/datacenter/vm/my-vm" -output "/tmp/export"

# Or from YAML
./build/hyperctl submit -file example-job.yaml

# Check status
./build/hyperctl query -all

πŸ“ Your First Export

Create a Job File

Create my-export.yaml:

name: "my-first-export"
vm_path: "/datacenter/vm/my-test-vm"  # Change this to your VM path
output_path: "/tmp/my-export"
options:
  parallel_downloads: 4
  remove_cdrom: true

Submit the Job

./build/hyperctl submit -file my-export.yaml

Monitor Progress

# Watch all jobs
./build/hyperctl query -all

# Watch daemon status
./build/hyperctl status

# View logs
tail -f /tmp/hypervisord.log

πŸ”§ Common Tasks

List All VMs

The interactive CLI (./build/hyperexport) automatically discovers all VMs.

Export Multiple VMs (Batch)

Create batch-export.yaml:

jobs:
  - name: "vm-1"
    vm_path: "/datacenter/vm/vm-1"
    output_path: "/tmp/export-vm-1"

  - name: "vm-2"
    vm_path: "/datacenter/vm/vm-2"
    output_path: "/tmp/export-vm-2"

  - name: "vm-3"
    vm_path: "/datacenter/vm/vm-3"
    output_path: "/tmp/export-vm-3"

Submit:

./build/hyperctl submit -file batch-export.yaml

Cancel a Running Job

# Get job ID first
./build/hyperctl query -all

# Cancel it
./build/hyperctl cancel -id <job-id>

Check What the Daemon is Doing

./build/hyperctl status

Output:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”
| Metric     | Value  |
|────────────────────|
| Version    | 1.0.0  |
| Uptime     | 5m30s  |
| Total Jobs | 5      |
| Running    | 2      |
| Completed  | 3      |
| Failed     | 0      |
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”˜

🐍 Python Integration

Perfect for integrating with your Python hyper2kvm project:

import requests

# Submit job
resp = requests.post("http://localhost:8080/jobs/submit", json={
    "name": "python-export",
    "vm_path": "/datacenter/vm/my-vm",
    "output_path": "/tmp/export"
})

job_id = resp.json()["job_ids"][0]

# Check status
status = requests.post("http://localhost:8080/jobs/query",
    json={"job_ids": [job_id]}).json()

print(status["jobs"][0]["status"])  # "running", "completed", etc.

🎨 What Makes This Special?

Beautiful Terminal UI

 β–ˆβ–ˆ   β–ˆβ–ˆ β–ˆβ–ˆ    β–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ
 β–ˆβ–ˆ   β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ   β–ˆβ–ˆ β–ˆβ–ˆ      β–ˆβ–ˆ   β–ˆβ–ˆ
 β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ   β–ˆβ–ˆβ–ˆβ–ˆ   β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆ   β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ
 β–ˆβ–ˆ   β–ˆβ–ˆ    β–ˆβ–ˆ    β–ˆβ–ˆ      β–ˆβ–ˆ      β–ˆβ–ˆ   β–ˆβ–ˆ
 β–ˆβ–ˆ   β–ˆβ–ˆ    β–ˆβ–ˆ    β–ˆβ–ˆ      β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆ   β–ˆβ–ˆ

        Hypervisor to KVM Migration Tool

Real-Time Progress

Exporting my-vm: 45% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘| (2/4 files)
 βœ“ disk-0.vmdk (23 GB) - Complete
 βœ“ disk-1.vmdk (15 GB) - Complete
 β†’ disk-2.vmdk (18 GB) - Downloading 67%
   disk-3.vmdk (8 GB)  - Pending

Concurrent Processing

Multiple VMs export in parallel - each in its own goroutine!


πŸ“Š Example Output

Interactive CLI

 SUCCESS  Connected to vSphere successfully!
 SUCCESS  Found 201 virtual machine(s)

β”Œβ”€ Connection Info ─────────────────────┐
| vCenter: https://10.73.213.134/sdk    |
| User: administrator@vsphere.local     |
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Select a VM to export [type to search]:
> my-test-vm
  production-web-server
  dev-database
  ...

Daemon Query

# Jobs

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
| Job ID     | Name    | VM Path        | Status  | Progress   | Started |
|──────────────────────────────────────────────────────────────────────────|
| abc123...  | vm-1    | .../my-vm      | running | export 45% | 10:30:15|
| def456...  | vm-2    | .../other-vm   | complete| 100%       | 10:25:00|
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Production Deployment

Run as Systemd Service

  1. Copy binary:
    sudo cp build/hypervisord /usr/local/bin/
    
  2. Create service file /etc/systemd/system/hypervisord.service:
    [Unit]
    Description=Hypervisord - VM Export Daemon
    After=network.target
    
    [Service]
    Type=simple
    User=vmexport
    Environment="GOVC_URL=https://vcenter.example.com/sdk"
    Environment="GOVC_USERNAME=admin@vsphere.local"
    Environment="GOVC_PASSWORD=secret"
    Environment="GOVC_INSECURE=1"
    ExecStart=/usr/local/bin/hypervisord
    Restart=on-failure
    
    [Install]
    WantedBy=multi-user.target
    
  3. Enable and start:
    sudo systemctl enable hypervisord
    sudo systemctl start hypervisord
    sudo systemctl status hypervisord
    

Environment Variables

Variable Required Description
GOVC_URL βœ… Yes vCenter SDK URL
GOVC_USERNAME βœ… Yes vCenter username
GOVC_PASSWORD βœ… Yes vCenter password
GOVC_INSECURE No Skip TLS verification (1=yes)
GOVC_DATACENTER No Default datacenter
DOWNLOAD_WORKERS No Parallel downloads (default: 4)
LOG_LEVEL No debug/info/warn/error (default: info)

πŸ” Troubleshooting

Problem: Cannot Connect to vCenter

Check:

# Test credentials
echo $GOVC_URL
echo $GOVC_USERNAME

# Try direct connection
curl -k $GOVC_URL

Solution:

Problem: Job Stuck in β€œRunning”

Check daemon logs:

tail -f /tmp/hypervisord.log

Common causes:

Problem: Download Fails

Automatic retry happens 3 times. If still failing:


🌐 Using the Web Dashboard

Access the Dashboard

After starting hypervisord, open your browser to:

http://localhost:8080/web/dashboard/

Main Dashboard Features

Submit Jobs:

  1. Click β€œSubmit Job” card
  2. Enter VM path: /datacenter/vm/my-vm
  3. Enter output directory: /tmp/export
  4. Click β€œSubmit”

Monitor Jobs:

Discover VMs:

Console Viewer

Access at: http://localhost:8080/web/dashboard/vm-console.html

Features:

Using VNC Console:

  1. Find your VM in the grid
  2. Click β€œOpen VNC” button
  3. New window opens with VNC viewer
  4. Note: VM must be running with VNC graphics configured

Dashboard API Calls

The dashboard uses these key endpoints:

# Jobs
GET  /jobs/query?all=true         # List all jobs
POST /jobs/submit                 # Submit new job
GET  /jobs/progress/<id>          # Get job progress

# VMs
GET  /libvirt/domains             # List libvirt VMs
GET  /vms/list                    # List VMware VMs

# Console
GET  /console/info?name=<vm>      # Get console info
GET  /console/vnc?name=<vm>       # Open VNC console
GET  /console/serial?name=<vm>    # Open serial console
GET  /console/screenshot?name=<vm># Take screenshot

# Health
GET  /health                      # Health check

πŸ“š Learn More

Core Documentation

Dashboard Documentation

API Documentation


πŸ’‘ Pro Tips

  1. Start with interactive mode to understand the workflow
  2. Use YAML files for repeatable exports
  3. Run daemon in background for automation
  4. Monitor with hyperctl instead of checking logs
  5. Adjust parallel downloads based on network speed
  6. Remove CD/DVD before export for cleaner OVF files
  7. Disable web dashboard for API-only/headless deployments:
    ./hypervisord --disable-web
    # Or in config: web.disabled=true
    

βœ… You’re Ready!

Try your first export:

# Interactive mode
./build/hyperexport

# OR daemon mode
./build/hypervisord &
./build/hyperctl submit -vm "/path/to/your/vm" -output "/tmp/export"
./build/hyperctl query -all

Happy migrating! πŸŽ‰


Part of the hyper2kvm project family