oxidecomputer / oxidecomputer/omicron
`illumos-utils` code for running commands could use some cleanup
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 572
- Forks
- 97
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 96
Description
The illumos-utils crate is a grab-bag of functionality for running illumos-specific commands such as ipadm, dladm, etc. It also contains all the zone-management machinery, like InstalledZone and RunningZone, which provide mechanisms for setting up zones and running commands inside them.
These two have gotten quite conflated over time. Some stuff is run through the Zones type, like Zones::ensure_address(). That eventually execs zlogin ipadm with some args. But there's also the Ipadm::ensure_ip_addrobj_exists(), which does ... ipadm with some args. These are nearly the same, but not exactly. This pattern repeats for many contexts and commands, including route(8).
This could use some TLC and cleanup. One option to simplify this is have the command-specific functionality live in specific places. E.g., ipadm(8) is run through the Ipadm type. Then Zones or RunningZone can call into that with a specific zone name or ID. Those Ipadm types could do nothing other than format the command to exec itself, and then the zone-specific stuff decides whether to put zlogin before that or call zone_enter() or what. In other words, the crates like ipadm know how to construct commands and possibly interpret the results, and the zone modules provide the context.
This would certainly make the code more testable. It's also very low priority.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by mapping the command-running code in the illumos-utils crate, especially Zones, RunningZone, and Ipadm, along with the ipadm, dladm, and route paths. Compare how direct and zone-scoped commands are constructed, then define a separation where command-specific types format or interpret commands and zone modules provide context; add tests for the resulting command construction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- operating-systems
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100