Skip to content

Commit

Permalink
server: make clients parse config TOMLs (#810)
Browse files Browse the repository at this point in the history
Remove config TOML processing from propolis-server. The only thing the
config TOML is used for in Omicron is specifying a bootrom path (and
possibly a version string); turn this into a propolis-server command-line
argument instead. The instance spec-based ensure API already ignored the
server's config TOML, and the non-spec ensure API is about to be removed
anyway, so this is a good time to make this shift.

To avoid breaking existing config TOML users, move the TOML-to-spec
processing logic into the propolis-config-toml crate, and have it output
propolis-client's generated instance spec types. (This would have been a
layering violation previously, but is OK now that propolis-server no longer
uses this crate.) Teach propolis-cli to use this crate to process TOMLs and
to use the instance spec-based ensure endpoint to create and migrate VMs.

Remove the config TOML from the Propolis zone image and change its command
line invocation. Also change PHD's propolis-server invocations as needed.

Finally, tweak the propolis-server and propolis-cli READMEs to describe the
new state of affairs.
  • Loading branch information
gjcolombo authored Dec 18, 2024
1 parent bf824f2 commit 263fc28
Show file tree
Hide file tree
Showing 33 changed files with 815 additions and 769 deletions.
3 changes: 1 addition & 2 deletions .github/buildomat/phd-run-with-args.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ failcount=$?
set -e

tar -czvf /tmp/phd-tmp-files.tar.gz \
-C /tmp/propolis-phd /tmp/propolis-phd/*.log \
-C /tmp/propolis-phd /tmp/propolis-phd/*.toml
-C /tmp/propolis-phd /tmp/propolis-phd/*.log

exitcode=0
if [ $failcount -eq 0 ]; then
Expand Down
29 changes: 16 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ cpuid_profile_config = { path = "crates/cpuid-profile-config" }
dladm = { path = "crates/dladm" }
nvpair = { path = "crates/nvpair" }
nvpair_sys = { path = "crates/nvpair/sys" }
propolis-server-config = { path = "crates/propolis-server-config" }
propolis-config-toml = { path = "crates/propolis-config-toml" }
propolis_api_types = { path = "crates/propolis-api-types" }
propolis_types = { path = "crates/propolis-types" }
rfb = { path = "crates/rfb" }
Expand Down
2 changes: 2 additions & 0 deletions bin/propolis-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ edition = "2021"
[dependencies]
anyhow.workspace = true
clap = { workspace = true, features = ["derive"] }
crucible-client-types.workspace = true
futures.workspace = true
libc.workspace = true
newtype-uuid.workspace = true
propolis-client.workspace = true
propolis-config-toml.workspace = true
slog.workspace = true
slog-async.workspace = true
slog-term.workspace = true
Expand Down
41 changes: 41 additions & 0 deletions bin/propolis-cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Propolis CLI

The `propolis-cli` utility provides a user-friendly frontend to the
[`propolis-server`](../propolis-server) REST API.

## Getting started

The easiest way to launch a VM via the CLI is to write a TOML file describing
the VM's configuration. An example of such a file might be the following:

```toml
[block_dev.alpine_iso]
type = "file"
path = "/path/to/alpine-extended-3.12.0-x86_64.iso"

[dev.block0]
driver = "pci-virtio-block"
block_dev = "alpine_iso"
pci-path = "0.4.0"

[dev.net0]
driver = "pci-virtio-viona"
vnic = "vnic_name"
pci-path = "0.5.0"
```

To create and run a Propolis VM using this configuration:

```
# propolis-cli -s <server ip> -p <port> new --config-toml <path> <VM name>
# propolis-cli -s <server ip> -p <port> state run
```

To connect to the VM's serial console:

```
# propolis-cli -s <server ip> -p <port> serial
```

Run `propolis-cli --help` to see the full list of supported commands and their
arguments.
Loading

0 comments on commit 263fc28

Please sign in to comment.