Refine default orchestration flow and documentation

- Document defaults-only configuration, kernel topology override, and deprecated CLI flags in README
- Mark schema doc as deprecated per ADR-0002
- Warn that --topology/--config are ignored; adjust loader/main/context flow
- Refactor orchestrator run() to auto-select mount/apply, reuse state when already provisioned, and serialize topology via Display
- Add Callgraph/FUNCTION_LIST/ADR docs tracking the new behavior
- Derive Eq for Topology to satisfy updated CLI handling
This commit is contained in:
2025-10-09 16:51:12 +02:00
parent d374176c0b
commit c8b76a2a3d
11 changed files with 5405 additions and 297 deletions

View File

@@ -24,10 +24,10 @@ Key modules
- [src/mount/ops.rs](src/mount/ops.rs)
Features at a glance
- Topology-driven planning with built-in defaults: BtrfsSingle, BcachefsSingle, DualIndependent, Bcachefs2Copy, BtrfsRaid1, SsdHddBcachefs
- Non-destructive preview: --show/--report outputs JSON summary (disks, partition plan, filesystems, planned mountpoints)
- Topology auto-selection with built-in defaults; optional kernel cmdline override via `zosstorage.topology=` (see ADR-0002)
- Non-destructive preview: `--show`/`--report` outputs JSON summary (disks, partition plan, filesystems, planned mountpoints)
- Safe discovery: excludes removable media by default (USB sticks) unless explicitly allowed
- Config-optional: the tool runs without any YAML; sensible defaults are always present and may be overridden/merged by config
- No external YAML configuration; defaults-only per ADR-0002 (sane built-ins, topology may be overridden by kernel cmdline)
Requirements
- Linux with /proc and /sys mounted (initramfs friendly)
@@ -45,8 +45,6 @@ Install and build
Binary is target/release/zosstorage.
CLI usage
- Topology selection (config optional):
-t, --topology btrfs-single|bcachefs-single|dual-independent|bcachefs-2copy|btrfs-raid1|ssd-hdd-bcachefs
- Preview (non-destructive):
--show Print JSON summary to stdout
--report PATH Write JSON summary to a file
@@ -56,22 +54,30 @@ CLI usage
-l, --log-level LEVEL error|warn|info|debug (default: info)
-L, --log-to-file Also write logs to /run/zosstorage/zosstorage.log
- Other:
-c, --config PATH Merge a YAML config file (overrides defaults)
-s, --fstab Enable writing /etc/fstab entries (when mounts are applied)
-a, --apply Perform partitioning, filesystem creation, and mounts (destructive)
-f, --force Present but not implemented (returns an error)
Deprecated (ignored with warning; see ADR-0002)
-t, --topology VALUE Ignored; use kernel cmdline `zosstorage.topology=` instead
-c, --config PATH Ignored; external YAML configuration is not used at runtime
Examples
- Single disk plan with debug logs:
sudo ./zosstorage --show -t btrfs-single -l debug
- RAID1 btrfs across two disks; print and write summary:
sudo ./zosstorage --show --report /run/zosstorage/plan.json -t btrfs-raid1 -l debug -L
- SSD+HDD bcachefs plan, include removable devices (for lab cases):
sudo ./zosstorage --show -t ssd-hdd-bcachefs --allow-removable -l debug
- Single disk plan with debug logs (defaults to btrfs_single automatically):
sudo ./zosstorage --show -l debug
- Two-disk plan (defaults to dual_independent automatically), write summary:
sudo ./zosstorage --show --report /run/zosstorage/plan.json -l debug -L
- Include removable devices for lab scenarios:
sudo ./zosstorage --show --allow-removable -l debug
- Quiet plan to file:
sudo ./zosstorage --report /run/zosstorage/plan.json -t dual-independent
- Apply single-disk btrfs (DESTRUCTIVE; wipes target disk):
sudo ./zosstorage --apply -t btrfs-single
sudo ./zosstorage --report /run/zosstorage/plan.json
- Apply single-disk plan (DESTRUCTIVE; wipes target disk; defaults select topology automatically):
sudo ./zosstorage --apply
Kernel cmdline override (at boot)
- To force a topology, pass one of:
zosstorage.topology=btrfs-single | bcachefs-single | dual-independent | btrfs-raid1 | ssd-hdd-bcachefs | bcachefs-2copy
- The override affects only topology; all other settings use sane built-in defaults.
Preview JSON shape (examples)
1) Already provisioned (idempotency success):