vitastor-disk: Exit with 1 if prepare fails to initialize an OSD, list skipped disks #137

Merged
vitalif merged 8 commits from koolkhel/vitastor:prepare-exit-code into master 2026-11-23 00:10:41 +03:00

8 Commits

Author SHA1 Message Date
e648aa9169 vitastor-disk: Check the exit code in the --fast-devices overlap test
The test gave the same path twice and piped prepare into grep, so it
passed without the "return 1" and never went through a symlink. Give the
fast device as a symlink to the data disk and fail on a zero exit.
2026-11-22 18:06:10 +03:00
da3b509a3e vitastor-disk: Remove the skip() wrapper from collect_devices() 2026-11-22 16:49:54 +03:00
03a51506c8 vitastor-disk: List skipped disks by the path given
prepare resolves symlinks in the device list, so a skipped disk was
listed by its real device name rather than by the path the caller
gave, like /dev/disk/by-id/*. List it by the path as given, so the
caller can match the skipped disks to its arguments.
2026-11-22 15:41:05 +03:00
8a6ffae3cf vitastor-disk: Don't fail prepare when it creates no OSD
A prepare that skips every disk, for example because they are already
partitioned, has nothing to do rather than failing. Exit with 0 then;
the skipped disks are listed in the JSON output. An OSD that fails to
initialize still makes prepare exit with 1.
2026-11-22 15:39:45 +03:00
f99b62bc5c vitastor-disk: Print the dry-run JSON shape when prepare finds no disk
With --dry-run --json and no suitable disk, prepare printed the JSON of
a real run instead of {"devices": []}. Also test the JSON output and
the exit code when no disk is suitable.
2026-11-22 15:39:45 +03:00
0e696c9498 vitastor-disk: Don't list a disk given twice as skipped
The disk itself is used, only its repeated argument is ignored.
2026-11-22 15:39:45 +03:00
c061180135 vitastor-disk: Exit with 1 if prepare creates no OSD, list skipped disks
prepare with a device list exited with 0 when every disk was skipped,
for example as already partitioned, although no OSD was created, and
the JSON output didn't mention the skipped disks.

Exit with 1 when no OSD is created, and list each skipped disk with the
reason in "skipped" of the JSON output. A disk skipped while OSDs are
created on other disks still gives exit code 0.
2026-11-22 15:39:20 +03:00
e936d97375 vitastor-disk: Exit with 1 if prepare fails to initialize an OSD
prepare with a device list ignored the result of prepare_one() and
always exited with 0, even when none of the OSDs was initialized. The
failure was only visible in stderr and in "errors" of the JSON output.

Keep initializing the remaining OSDs, but exit with 1 if any of them
failed.
2026-11-22 15:39:03 +03:00