|
2 | 2 |
|
3 | 3 | ## Requirements |
4 | 4 |
|
5 | | -- **Windows 11 Pro, Enterprise, or Education** (Home edition doesn't include Hyper-V) |
| 5 | +- **Windows 11 Pro, Enterprise, or Education** — Home edition doesn't include Hyper-V at all |
6 | 6 | - **Hyper-V feature enabled** in Windows Features |
| 7 | +- No VirtualBox or VBoxManage needed — Hyper-V is built into Windows |
7 | 8 |
|
8 | 9 | ```powershell |
9 | | -# Enable Hyper-V (Admin): |
| 10 | +# Enable Hyper-V (Admin, one-time): |
10 | 11 | Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All |
| 12 | +# Reboot required |
11 | 13 | ``` |
12 | 14 |
|
13 | 15 | ## VM Management |
14 | 16 |
|
15 | | -Same UI as VirtualBox — the VMs page shows both providers. Hyper-V VMs have a blue badge. |
| 17 | +The main VMs page shows VirtualBox and Hyper-V side by side. Hyper-V VMs are marked with a blue badge. |
16 | 18 |
|
17 | | -| Action | How | |
18 | | -|--------|-----| |
19 | | -| List VMs | `GET /api/v1/vms` (includes Hyper-V VMs) | |
20 | | -| Create | Set `provider: "hyperv"` in the create form | |
21 | | -| Start/Stop | Same buttons, routed to Hyper-V via `?provider=hyperv` | |
22 | | -| Pause/Resume | Same as VirtualBox | |
| 19 | +### Create a Hyper-V VM |
23 | 20 |
|
24 | | -## Limitations |
| 21 | +From the **Hyper-V** page: |
| 22 | +1. Click **Create VM** |
| 23 | +2. Set name, RAM (MB), disk (GB) |
| 24 | +3. The VM is created with default switch networking (NAT-equivalent) |
25 | 25 |
|
26 | | -Hyper-V support is currently focused on **basic lifecycle** (create, start, stop, pause, resume). Compared to VirtualBox: |
| 26 | +Via API: |
| 27 | +```powershell |
| 28 | +POST /api/v1/vms |
| 29 | +Content-Type: application/json |
| 30 | +
|
| 31 | +{"name": "hyperv-test", "provider": "hyperv", "memory_mb": 4096, "disk_gb": 40} |
| 32 | +``` |
| 33 | + |
| 34 | +### Start / Stop / Pause / Resume |
| 35 | + |
| 36 | +Same buttons as VirtualBox — the provider is detected from the VM metadata. The backend routes to Hyper-V PowerShell cmdlets automatically. |
| 37 | + |
| 38 | +| Action | Button | API | |
| 39 | +|--------|--------|-----| |
| 40 | +| Start | ▶ Start | `POST /api/v1/vms/{name}/start?provider=hyperv` | |
| 41 | +| Stop | ■ Stop | `POST /api/v1/vms/{name}/stop?provider=hyperv` | |
| 42 | +| Pause | ⏸ Pause | `POST /api/v1/vms/{name}/pause?provider=hyperv` | |
| 43 | +| Resume | ▶ Resume | `POST /api/v1/vms/{name}/resume?provider=hyperv` | |
| 44 | + |
| 45 | +## Current limitations |
| 46 | + |
| 47 | +Hyper-V support is focused on **basic lifecycle operations**. Advanced VirtualBox features are not available for Hyper-V: |
27 | 48 |
|
28 | 49 | | Feature | VirtualBox | Hyper-V | |
29 | 50 | |---------|-----------|---------| |
| 51 | +| Create / Start / Stop | ✅ | ✅ | |
| 52 | +| Pause / Resume | ✅ | ✅ | |
| 53 | +| Delete | ✅ | ✅ | |
30 | 54 | | Snapshots | ✅ | ❌ | |
31 | | -| Networking | ✅ (NAT, bridged, etc.) | ❌ | |
32 | | -| Console | ✅ (VRDP + VNC) | ❌ | |
33 | | -| ISO attach | ✅ | ❌ | |
| 55 | +| Network config (NAT, bridged, etc.) | ✅ | ❌ (uses default switch) | |
| 56 | +| Console (VNC / VRDP) | ✅ | ❌ | |
| 57 | +| ISO attach / detach | ✅ | ❌ | |
34 | 58 | | Unattended install | ✅ | ❌ | |
| 59 | +| Port forwarding | ✅ | ❌ | |
| 60 | +| Templates | ✅ | ❌ | |
| 61 | + |
| 62 | +Hyper-V is ideal for: |
| 63 | +- **Lightweight Windows dev VMs** that just need to exist and run |
| 64 | +- **Quick testing** where you don't need snapshot rollback or console access |
| 65 | +- **Leveraging Windows-native virtualization** without installing VirtualBox |
35 | 66 |
|
36 | | -Hyper-V is best for **lightweight Windows VM management** — if you need advanced features, use VirtualBox. |
| 67 | +If you need snapshots, console access, advanced networking, or ISO management, use VirtualBox instead — both providers coexist on the same machine. |
37 | 68 |
|
38 | 69 | ## Architecture |
39 | 70 |
|
40 | | -Hyper-V calls go through PowerShell cmdlets: |
41 | | -```python |
42 | | -# vm_service.py routes to: |
43 | | -hyperv_manager → PowerShell → Hyper-V WMI |
| 71 | +Hyper-V operations go through PowerShell cmdlets, not VBoxManage: |
| 72 | + |
| 73 | +``` |
| 74 | +Frontend POST → REST API → vm_service → hyperv_manager → PowerShell → Hyper-V WMI |
44 | 75 | ``` |
45 | 76 |
|
46 | | -No VBoxManage needed. Hyper-V operations run in a separate process via `subprocess.run(["powershell", "-Command", ...])`. |
| 77 | +The `hyperv_manager.py` module runs PowerShell commands via `subprocess.run`: |
| 78 | +- `Get-VM` — list VMs |
| 79 | +- `New-VM` — create VM |
| 80 | +- `Start-VM` / `Stop-VM` / `Suspend-VM` / `Resume-VM` — lifecycle |
| 81 | +- `Remove-VM` — delete |
| 82 | + |
| 83 | +No VBoxManage, no VirtualBox installation required. Works on any Windows edition that supports Hyper-V. |
0 commit comments