|
| 1 | +# Design Proposal: Remote KVM Operations via orch-cli |
| 2 | + |
| 3 | +Author(s): Edge Infrastructure Manager Team |
| 4 | + |
| 5 | +Last updated: 11/11/2025 |
| 6 | + |
| 7 | +## Abstract |
| 8 | + |
| 9 | +Remote KVM (Keyboard-Video-Mouse) enables administrators to remotely view and control the display and input devices of Intel AMT-enabled edge nodes. This capability is essential for out-of-band troubleshooting, recovery operations, and system management when SSH or other in-band access methods are unavailable. |
| 10 | + |
| 11 | +This document describes the design proposal for integrating remote KVM operations into the Edge Manageability Framework/vPRO through orch-cli or web ui. The implementation leverages existing MPS infrastructure and maintains full multi-tenancy support. |
| 12 | + |
| 13 | +**Note:** This proposal focuses on KVM session initiation and management through orch-cli. The underlying KVM redirection capability is already provided by MPS and Intel AMT, requiring only the addition of an authorization and session management layer. |
| 14 | + |
| 15 | +## Proposal |
| 16 | + |
| 17 | +### KVM Operation Flow |
| 18 | + |
| 19 | +Remote KVM operations follow the desired/current state reconciliation. When a user requests KVM access through orch-cli, the system updates the host's `desiredKvmState` field, triggering the dm-manager reconciler to establish a session with MPS and return connection details. |
| 20 | + |
| 21 | +The following diagram illustrates the KVM session establishment flow: |
| 22 | + |
| 23 | +### KVM Session Flow |
| 24 | + |
| 25 | +TBD |
| 26 | + |
| 27 | +```mermaid |
| 28 | +sequenceDiagram |
| 29 | + participant CLI as orch-cli |
| 30 | + participant APIV2 as apiv2<br/>(infra-core) |
| 31 | + participant INV as inventory<br/>(infra-core) |
| 32 | + participant DM as dm-manager<br/>(infra-external) |
| 33 | + participant MPS as MPS |
| 34 | + participant AMT as AMT Device |
| 35 | +``` |
| 36 | +### KVM Session States |
| 37 | + |
| 38 | +The KVM state machine: |
| 39 | + |
| 40 | +| State | Description | |
| 41 | +|-------|-------------| |
| 42 | +| `KVM_STATE_IDLE` | No active session, default state | |
| 43 | +| `KVM_STATE_REQUESTED` | User requested KVM access (desired state) | |
| 44 | +| `KVM_STATE_ACTIVE` | Session established with valid token | |
| 45 | +| `KVM_STATE_STOPPED` | User requested session termination | |
| 46 | +| `KVM_STATE_ERROR` | Error occurred during session establishment | |
| 47 | + |
| 48 | +### orch-cli Commands |
| 49 | + |
| 50 | +**Command structure**: |
| 51 | +- `set host <host-id> --kvm start`: Requests KVM session by setting desiredKvmState to KVM_STATE_REQUESTED |
| 52 | +- `set host <host-id> --kvm stop`: Terminates KVM session by setting desiredKvmState to KVM_STATE_STOPPED |
| 53 | +- `get host <host-id>`: Query current KVM state and session details |
| 54 | +- Uses standard flags: `--project`, `--api-endpoint` |
| 55 | + |
| 56 | +#### 1. Start KVM Session |
| 57 | + |
| 58 | +```bash |
| 59 | +# First, authenticate with Keycloak |
| 60 | +orch-cli login <keycloakuser> <userpassword> \ |
| 61 | + --keycloak https://api.${CLUSTER}/realms/master |
| 62 | + |
| 63 | +# Start KVM session |
| 64 | +orch-cli set host <host-resource-id> --project <project name> \ |
| 65 | + --api-endpoint "https://api.${CLUSTER}" \ |
| 66 | + --kvm start |
| 67 | +``` |
| 68 | + |
| 69 | +**Output**: |
| 70 | +``` |
| 71 | +KVM Session Requested: |
| 72 | + Host: <host-resource-id> |
| 73 | + Session URL: wss://mps.${CLUSTER}/kvm/<session-id> |
| 74 | + Expires: |
| 75 | + |
| 76 | +Open the URL in a browser to access the KVM console. |
| 77 | +``` |
| 78 | +#### 2. Stop KVM Session |
| 79 | + |
| 80 | +```bash |
| 81 | +# Stop active KVM session |
| 82 | +orch-cli set host <host-resource-id> --project <project name> \ |
| 83 | + --api-endpoint "https://api.${CLUSTER}" \ |
| 84 | + --kvm stop |
| 85 | +``` |
| 86 | + |
| 87 | +**Output**: |
| 88 | +``` |
| 89 | +KVM Session Stopped: |
| 90 | + Host: <host-resource-id> |
| 91 | + Status: Session terminated |
| 92 | +``` |
| 93 | + |
| 94 | +#### 3. Check KVM Status |
| 95 | + |
| 96 | +```bash |
| 97 | +# Query current KVM state |
| 98 | +orch-cli get host <host-resource-id> --project <project name> \ |
| 99 | + --api-endpoint "https://api.${CLUSTER}" |
| 100 | +``` |
| 101 | + |
| 102 | +**Output**: |
| 103 | +```json |
| 104 | +{ |
| 105 | + "host_id": "abc-123", |
| 106 | + "desired_state": "KVM_STATE_ACTIVE", |
| 107 | + "current_state": "KVM_STATE_ACTIVE", |
| 108 | + "kvm_url": "wss://", |
| 109 | + "session_token": "", |
| 110 | + "last_updated": "" |
| 111 | +} |
| 112 | +``` |
| 113 | + |
| 114 | +**Note**: KVM desired/current state: |
| 115 | +- `desiredKvmState`: KVM_STATE_REQUESTED, KVM_STATE_STOPPED |
| 116 | +- `currentKvmState`: KVM_STATE_IDLE, KVM_STATE_ACTIVE, KVM_STATE_ERROR |
| 117 | + |
| 118 | +**Authentication Requirements**: |
| 119 | +- Keycloak JWT token obtained via `orch-cli login` and stored for subsequent commands |
| 120 | +- User must belong to tenant that owns the project |
| 121 | +- User must have appropriate RBAC permissions for host management |
| 122 | + |
| 123 | +### Component Architecture |
| 124 | + |
| 125 | +The KVM operation involves the following EMF components: |
| 126 | + |
| 127 | +- **infra-core/apiv2**: REST API layer that handles host resource PATCH requests with KVM state changes |
| 128 | +- **infra-core/inventory**: PostgreSQL database storing host resources including KVM state fields |
| 129 | +- **infra-external/dm-manager**: Reconciler service that detects KVM state mismatches and orchestrates MPS calls |
| 130 | +- **mps**: Management Presence Server that generates KVM authorization tokens and provides WebSocket endpoints |
| 131 | +- **rps**: Remote Provisioning Server that enables KVM during device activation |
| 132 | + |
| 133 | +### API Design |
| 134 | +**API Endpoint**: `PATCH /compute/hosts/{resourceId}` |
| 135 | + |
| 136 | +**Request Body** (to start KVM session): |
| 137 | +```json |
| 138 | +{ |
| 139 | + "desiredKvmState": "KVM_STATE_REQUESTED" |
| 140 | +} |
| 141 | +``` |
| 142 | + |
| 143 | +**Request Body** (to stop KVM session): |
| 144 | +```json |
| 145 | +{ |
| 146 | + "desiredKvmState": "KVM_STATE_STOPPED" |
| 147 | +} |
| 148 | +``` |
| 149 | + |
| 150 | +#### MPS KVM Authorization Endpoint |
| 151 | + |
| 152 | +**A. Authorization Endpoint (Token Generation)** |
| 153 | +TBD |
| 154 | + |
| 155 | +**B. WebSocket Relay Endpoint (KVM Session)** |
| 156 | +TBD |
| 157 | + |
| 158 | +**C. KVM Display Settings Endpoints** |
| 159 | +TBD |
| 160 | + |
| 161 | +### Implementation Design |
| 162 | + |
| 163 | +### Affected components |
| 164 | + |
| 165 | +### Test plan |
| 166 | + |
| 167 | +### Architecture Open (if applicable) |
| 168 | + |
| 169 | + |
| 170 | + |
| 171 | + |
0 commit comments