The hyper2kvm TUI (Terminal User Interface) provides real-time monitoring of VM migrations with a beautiful orange theme. The implementation includes an intelligent 3-tier fallback system that works on any platform.
The TUI features a vibrant orange color scheme:
When textual>=0.47.0 is installed, you get the full-featured TUI:
Features:
Installation:
pip install 'hyper2kvm[tui]'
Keyboard Shortcuts:
q - Quit applicationr - Refresh displayl - Focus log viewerm - Focus migrations paneld - Toggle dark modeWhen Textual is not installed but curses is available (most Unix/Linux/Mac systems):
Features:
Keyboard Shortcuts:
q - Quit applicationr - Refresh displayUP/DOWN - Scroll logsPlatform Support:
When neither Textual nor curses is available (e.g., Windows without curses):
Features:
Platform Support:
The TUI automatically selects the best available implementation:
from hyper2kvm.tui import run_dashboard
# Run with default settings (1 second refresh)
run_dashboard()
# Or customize refresh interval
run_dashboard(refresh_interval=2.0)
from hyper2kvm.tui import get_dashboard_type
dashboard_type = get_dashboard_type()
print(f"Using: {dashboard_type}") # 'textual', 'curses', or 'cli'
from hyper2kvm.tui import TEXTUAL_AVAILABLE
if TEXTUAL_AVAILABLE:
from hyper2kvm.tui.dashboard import MigrationDashboard
app = MigrationDashboard(refresh_interval=1.0)
app.run()
else:
print("Textual not installed. Install with: pip install 'hyper2kvm[tui]'")
from hyper2kvm.tui.fallback_dashboard import CursesDashboard
dashboard = CursesDashboard(refresh_interval=1.0)
dashboard.run()
from hyper2kvm.tui.cli_dashboard import CLIDashboard
dashboard = CLIDashboard(refresh_interval=2.0)
dashboard.run()
All dashboard implementations support the same interface:
from hyper2kvm.tui.widgets import MigrationStatus
# Create a migration status
migration = MigrationStatus(
vm_name="web-server-01",
hypervisor="vmware",
status="in_progress",
progress=0.45,
current_stage="export",
throughput_mbps=150.5,
elapsed_seconds=120.0,
)
# Add to dashboard
dashboard.add_migration(migration)
# Update progress
dashboard.update_migration_progress(
vm_name="web-server-01",
progress=0.75,
stage="convert",
throughput_mbps=180.2,
)
# Log messages
dashboard.log_message("Export completed", "INFO")
dashboard.log_message("Validation failed", "ERROR")
dashboard.log_message("Migration successful", "SUCCESS")
# Remove migration
dashboard.remove_migration("web-server-01")
@dataclass
class MigrationStatus:
vm_name: str # Name of the VM
hypervisor: str # Source hypervisor (vmware, azure, hyperv)
status: str # pending, in_progress, completed, failed
progress: float # 0.0 to 1.0
current_stage: str # export, transfer, convert, validate, etc.
throughput_mbps: float # Current throughput in MB/s
elapsed_seconds: float # Time elapsed
eta_seconds: float # Estimated time remaining (optional)
error: str # Error message if failed (optional)
The dashboard automatically calculates and displays:
Install Textual:
pip install 'hyper2kvm[tui]'
# or
pip install textual>=0.47.0
Windows doesn’t include curses by default. Options:
windows-curses:
pip install windows-curses
Use the CLI fallback (automatic)
pip install 'hyper2kvm[tui]'
If you see rendering issues:
If the dashboard feels slow:
run_dashboard(refresh_interval=2.0) # Update every 2 seconds
See the examples/ directory:
tui_demo.py - Interactive demo with simulated migrationstui_dashboard_example.py - Integration exampletui_integration_example.py - Full integration with migration pipelinehyper2kvm/tui/
├── __init__.py # Auto-detection and fallback logic
├── dashboard.py # Textual implementation (Tier 1)
├── fallback_dashboard.py # Curses implementation (Tier 2)
├── cli_dashboard.py # CLI implementation (Tier 3)
└── widgets.py # Textual widgets and MigrationStatus
Potential future additions:
To add new features or improve the TUI:
MigrationStatus dataclass if neededLGPL-3.0-or-later