microsoft/openvmm
Publicmirrored fromhttps://github.com/microsoft/openvmmAvailable
Guide/src/dev_guide/dev_tools/hypestv.md
109lines · modecode
| 1 | # hypestv |
| 2 | |
| 3 | `hypestv` is an interactive command-line interface for Hyper-V VMs, designed for |
| 4 | making OpenHCL developers' lives easier. |
| 5 | |
| 6 | Similar to [`ohcldiag-dev`][], it can interact with the OpenHCL paravisor |
| 7 | running inside a Hyper-V VM. But unlike `ohcldiag-dev`, it sports an interactive |
| 8 | terminal interface (with history and tab completion), and it is specifically |
| 9 | designed to interact with Hyper-VMs. |
| 10 | |
| 11 | [`ohcldiag-dev`]: ../../reference/openhcl/diag/ohcldiag_dev.md |
| 12 | |
| 13 | In many ways, it is similar to the OpenVMM interactive console. In time, it may |
| 14 | end up sharing code and capabilities with it and with `ohcldiag-dev`, but it |
| 15 | will always be a Hyper-V specific tool. |
| 16 | |
| 17 | Currently, it can: |
| 18 | |
| 19 | * Change VM state (starting/stopping/resetting) |
| 20 | * Enable serial port output to standard output, or input/output to another |
| 21 | terminal window |
| 22 | * Enable paravisor log output to standard output or another terminal window |
| 23 | * Inspect paravisor state |
| 24 | * Modify the paravisor (update the paravisor command line, reload the paravisor) |
| 25 | |
| 26 | In the future, it might be able to: |
| 27 | |
| 28 | * Enable Hyper-V log output |
| 29 | * Capture serial port output to a file |
| 30 | * Inspect host state |
| 31 | * Persistence workspaces (save/restore configured serial ports and logs) |
| 32 | |
| 33 | ## Example session |
| 34 | |
| 35 | `hypestv` launches into a detached mode, unless you specify a VM name on the |
| 36 | command line. To select a VM to work on, the VM named `tdxvm` in this example, |
| 37 | use the `select` command. If successful, you will now see the name and VM state |
| 38 | in the prompt: |
| 39 | |
| 40 | ```text |
| 41 | > select tdxvm |
| 42 | tdxvm [off]> |
| 43 | ``` |
| 44 | |
| 45 | After this, all commands will implicitly operate on `tdxvm`. Use `select` again |
| 46 | to work on another VM. |
| 47 | |
| 48 | To enable serial port output, use the `serial` command. This can be used at any |
| 49 | time, even while the VM is not running. E.g., to open a separate window for |
| 50 | interactive use of COM1 and enable logging serial port output for COM2: |
| 51 | |
| 52 | ```text |
| 53 | tdxvm [off]> serial 1 term |
| 54 | tdxvm [off]> serial 2 log |
| 55 | ``` |
| 56 | |
| 57 | You can also enable paravisor log output at any time: |
| 58 | |
| 59 | ```text |
| 60 | tdxvm [off]> paravisor kmsg log |
| 61 | ``` |
| 62 | |
| 63 | Start a VM with `start`. This is an asynchronous command: you can continue to |
| 64 | type other commands at the prompt while the VM starts. You should see an output |
| 65 | message when the VM finishes starting, as well as output about any configured |
| 66 | serial ports connecting. |
| 67 | |
| 68 | Note that, due to limitations of the `rustyline` crate, the displayed VM state |
| 69 | on the prompt may not be accurate until you type another command or press Enter. |
| 70 | |
| 71 | ```text |
| 72 | tdxvm [off]> start |
| 73 | com1 connected |
| 74 | com2 connected |
| 75 | VM started |
| 76 | tdxvm [off]> |
| 77 | tdxvm [running]> |
| 78 | ``` |
| 79 | |
| 80 | At this point, the VM is running, including the paravisor (if one is |
| 81 | configured). As in the OpenVMM interactive console, you can inspect paravisor |
| 82 | state with the `inspect` or `x` command, but under the `paravisor`/`pv` command: |
| 83 | |
| 84 | ```text |
| 85 | tdxvm [running]> pv x |
| 86 | { |
| 87 | build_info: _, |
| 88 | control_state: "started", |
| 89 | mesh: _, |
| 90 | proc: _, |
| 91 | trace: _, |
| 92 | uhdiag: _, |
| 93 | vm: _, |
| 94 | } |
| 95 | ``` |
| 96 | |
| 97 | You can terminate the VM with `kill`. This will disconnect any connected serial |
| 98 | ports as well, but they will reconnect next time the VM starts. Killing a VM |
| 99 | does not detach/deselect it; subsequent commands will continue to operate on the |
| 100 | VM. |
| 101 | |
| 102 | ```text |
| 103 | tdxvm [running]> kill |
| 104 | com1 disconnected |
| 105 | com2 disconnected |
| 106 | VM killed |
| 107 | tdxvm [stopping]> |
| 108 | tdxvm [off]> |
| 109 | ``` |
| 110 | |