feat(orchestrator,cli,config,fs): implement 3 modes, CLI-first precedence, kernel topo, defaults

- Orchestrator:
  - Add mutually exclusive modes: --mount-existing, --report-current, --apply
  - Wire mount-existing/report-current flows and JSON summaries
  - Reuse mount planning/application; never mount ESP
  - Context builders for new flags
  (see: src/orchestrator/run.rs:1)

- CLI:
  - Add --mount-existing and --report-current flags
  - Keep -t/--topology (ValueEnum) as before
  (see: src/cli/args.rs:1)

- FS:
  - Implement probe_existing_filesystems() using blkid to detect ZOSDATA/ZOSBOOT and dedupe by UUID
  (see: src/fs/plan.rs:1)

- Config loader:
  - Precedence now: CLI flags > kernel cmdline (zosstorage.topo) > built-in defaults
  - Read kernel cmdline topology only if CLI didn’t set -t/--topology
  - Default topology set to DualIndependent
  - Do not read /etc config by default in initramfs
  (see: src/config/loader.rs:1)

- Main:
  - Wire new Context builder flags
  (see: src/main.rs:1)

Rationale:
- Enables running from in-kernel initramfs with no config file
- Topology can be selected via kernel cmdline (zosstorage.topo) or CLI; CLI has priority
This commit is contained in:
2025-09-30 16:16:51 +02:00
parent b0d8c0bc75
commit d374176c0b
5 changed files with 336 additions and 44 deletions

View File

@@ -86,15 +86,24 @@ pub struct Cli {
/// Overrides config.device_selection.allow_removable when provided
#[arg(long = "allow-removable", default_value_t = false)]
pub allow_removable: bool,
/// Attempt to mount existing filesystems based on on-disk headers; no partitioning or mkfs.
/// Non-destructive mounting flow; uses UUID= sources and policy from config.
#[arg(long = "mount-existing", default_value_t = false)]
pub mount_existing: bool,
/// Report current initialized filesystems and mounts without performing changes.
#[arg(long = "report-current", default_value_t = false)]
pub report_current: bool,
/// Print detection and planning summary as JSON to stdout (non-default)
#[arg(long = "show", default_value_t = false)]
pub show: bool,
/// Write detection/planning JSON report to the given path (overrides config.report.path)
#[arg(long = "report")]
pub report: Option<String>,
/// Execute destructive actions (apply mode). When false, runs preview-only.
#[arg(long = "apply", default_value_t = false)]
pub apply: bool,