Skip to content

fix(ns-storage): make no assumptions on partition naming scheme - #1873

Open
gsanchietti wants to merge 2 commits into
mainfrom
issue1863
Open

fix(ns-storage): make no assumptions on partition naming scheme#1873
gsanchietti wants to merge 2 commits into
mainfrom
issue1863

Conversation

@gsanchietti

Copy link
Copy Markdown
Member

Instead of guessing the separator, read back the kname of the newly-created partition via lsblk and verify its number matches what was just created.

Refs: #1863

Instead of guessing the separator, read back the kname of the
newly-created partition via lsblk and verify its number matches what
was just created.
The previous attempt at dropping the naming-scheme assumption picked the
last line of `lsblk -o KNAME` and read its last character as the partition
number. NethSecurity images carry a bios_grub partition 128, which sorts
last, so setup-partition computed number 8 and aborted with "Wrong
partition number 8"; add-storage in partition mode always failed with
setup_partition_failed.

Diff the partition numbers reported by parted before and after mkpart to
learn the number actually assigned, then resolve it to a kernel name via
/sys/class/block/<part>/partition. This handles both sdX3 and nvme0n1p3
without guessing the separator and without assuming the data partition is
number 3.

Assisted-by: Claude Code:claude-opus-5[1m]
@gsanchietti
gsanchietti marked this pull request as draft August 7, 2026 09:50
@gsanchietti
gsanchietti marked this pull request as ready for review August 7, 2026 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants