WIZ-STORAGE: Installation wizard – storage provisioning #211

Open
opened 2026-10-23 14:51:17 +00:00 by kyrylo · 0 comments
Owner

Goal

Build the storage step of the installation wizard (front-end + back-end): detect drives, show which contain data, optionally wipe them, select drives and create the storage pool.

The system scripts are written separately. This task is only the UI and the backend that calls the scripts. Use mock scripts returning the same JSON until the real ones exist.

Context

  • Btrfs pool, RAID10 by default (min. 4 drives)
  • The OS disk is separate and must never be selectable
  • The accounts step only runs after storage exists

Scripts the backend can use

Rules for all scripts: arguments as CLI flags, output as JSON on stdout, exit code 0 = success, non-zero = failure with {"error": "..."}.

Script Input Output
nas-list-drives none array: device, model, serial, size_bytes, type, is_system, mounted, empty, filesystems[]
nas-wipe-drive --device /dev/sdX {device, status}
nas-create-storage --layout raid10 --devices /dev/sda,/dev/sdb,... {pool_uuid, mount_point, usable_bytes}

Front-end: what must be shown

Screen "Select storage drives"

  • List/table of all detected drives: device, model, serial, size, type
  • Status badge: Empty or Contains data
  • For non-empty drives(can be skipped): show existing partitions/filesystems so the user sees what will be lost
  • System disk and mounted drives: greyed out, disabled, with reason ("System disk")
  • Checkbox per drive for the pool, nothing pre-selected
  • "Rescan drives" button
  • Usable capacity shown, recalculated when selection or layout changes
  • Next is disabled until enough drives are selected for the layout
  • Non-empty drives cannot be selected (wipe first or deselect)
  • Warning when selected drives differ a lot in size
  • Loading, "no drives found" and error states

Wipe flow

  • "Format / wipe" button on every non-empty drive
  • Confirmation dialog naming the drive and stating all data will be permanently erased; user must type the device name or tick a checkbox
  • Progress indicator per drive while wiping; other drives stay usable
  • On success the drive switches to "Empty"; on failure show the error

Create flow

  • Summary screen: selected drives, layout, usable capacity
  • Final confirmation ("Create storage from these drives")
  • Progress screen while creating
  • Success screen, and error screen with back/retry

Back-end: what it must do

  • GET /api/storage/drives: runs nas-list-drives, returns the parsed list
  • POST /api/storage/wipe {device}: runs nas-wipe-drive
  • POST /api/storage/provision {devices[], layout}: runs nas-create-storage
  • GET /api/storage/status: progress/result of wipe and provision (for polling)
  • Run scripts with an argument array, never a shell string built from user input
  • Server-side validation (not only in the UI):
    • device must be in the list from nas-list-drives
    • never the system disk, never a mounted drive
    • never provision a drive that is not empty
    • enough drives for the chosen layout
    • never provision when a pool already exists
  • Wipe and provision run asynchronously; requests must not block
  • Prevent double execution (e.g. provision clicked twice, wipe on the same device)
## Goal Build the storage step of the installation wizard (front-end + back-end): detect drives, show which contain data, optionally wipe them, select drives and create the storage pool. The system scripts are written separately. This task is **only the UI and the backend that calls the scripts**. Use mock scripts returning the same JSON until the real ones exist. ## Context - Btrfs pool, RAID10 by default (min. 4 drives) - The OS disk is separate and must never be selectable - The accounts step only runs after storage exists ## Scripts the backend can use Rules for all scripts: arguments as CLI flags, output as JSON on stdout, exit code 0 = success, non-zero = failure with `{"error": "..."}`. | Script | Input | Output | |---|---|---| | `nas-list-drives` | none | array: device, model, serial, size_bytes, type, is_system, mounted, empty, filesystems[] | | `nas-wipe-drive` | `--device /dev/sdX` | {device, status} | | `nas-create-storage` | `--layout raid10 --devices /dev/sda,/dev/sdb,...` | {pool_uuid, mount_point, usable_bytes} | ## Front-end: what must be shown **Screen "Select storage drives"** - [ ] List/table of all detected drives: device, model, serial, size, type - [ ] Status badge: **Empty** or **Contains data** - [ ] For non-empty drives(can be skipped): show existing partitions/filesystems so the user sees what will be lost - [ ] System disk and mounted drives: greyed out, disabled, with reason ("System disk") - [ ] Checkbox per drive for the pool, nothing pre-selected - [ ] "Rescan drives" button - [ ] Usable capacity shown, recalculated when selection or layout changes - [ ] Next is disabled until enough drives are selected for the layout - [ ] Non-empty drives cannot be selected (wipe first or deselect) - [ ] Warning when selected drives differ a lot in size - [ ] Loading, "no drives found" and error states **Wipe flow** - [ ] "Format / wipe" button on every non-empty drive - [ ] Confirmation dialog naming the drive and stating all data will be permanently erased; user must type the device name or tick a checkbox - [ ] Progress indicator per drive while wiping; other drives stay usable - [ ] On success the drive switches to "Empty"; on failure show the error **Create flow** - [ ] Summary screen: selected drives, layout, usable capacity - [ ] Final confirmation ("Create storage from these drives") - [ ] Progress screen while creating - [ ] Success screen, and error screen with back/retry ## Back-end: what it must do - [ ] `GET /api/storage/drives`: runs `nas-list-drives`, returns the parsed list - [ ] `POST /api/storage/wipe` {device}: runs `nas-wipe-drive` - [ ] `POST /api/storage/provision` {devices[], layout}: runs `nas-create-storage` - [ ] `GET /api/storage/status`: progress/result of wipe and provision (for polling) - [ ] Run scripts with an argument array, never a shell string built from user input - [ ] **Server-side validation** (not only in the UI): - device must be in the list from `nas-list-drives` - never the system disk, never a mounted drive - never provision a drive that is not empty - enough drives for the chosen layout - never provision when a pool already exists - [ ] Wipe and provision run asynchronously; requests must not block - [ ] Prevent double execution (e.g. provision clicked twice, wipe on the same device)
kyrylo added this to the Sprint 3 milestone 2026-10-23 14:51:17 +00:00
kyrylo added this to the Kanban project 2026-10-23 14:51:17 +00:00
kyrylo removed this from the Sprint 3 milestone 2026-10-23 14:51:31 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kyrylo/vorteq-nas-os#211
No description provided.