Bug #5211
closedceph-disk prepare: list_partitions() shouldn't return disks
0%
Description
# ceph-disk-prepare /dev/sda
ceph-disk: Error: Device is mounted: /dev/sdak1
list_partitions('/dev/sda') will on my server return:
/dev/sdaa
/dev/sdab
/dev/sdac
/dev/sdad
/dev/sdae
/dev/sdaf
/dev/sdag
/dev/sdai
/dev/sdah
/dev/sdaj
/dev/sdak
/dev/sdak1
Updated by Alexandre Marangone almost 11 years ago
- Subject changed from ceph-disk prepare: list_partitions doesn't take into account sdaa, sdab, etc. to ceph-disk prepare: list_partitions() shouldn't return disks
Updated by Alexandre Marangone almost 11 years ago
More info:
A customer has its OS installed on /dev/sdak.
When running ceph-disk prepare /dev/sda, ceph-disk-prepare will return an error stating that sdak is partitioned.
This is obviously not right.
After digging a bit it seems that the list_partitions() function get confused with disk named sdaa, sdab, etc.
This potentially impacts anyone with more than 26 disks and a OS installed on a disk above the 26th.
Updated by Sage Weil almost 11 years ago
the python code that does this is pretty kludgey.. any suggestions for a more robust enumeration strategy should be pretty easy to implement
Updated by Alexandre Marangone almost 11 years ago
One way to do that would be to use lsblk /dev/<disk> and look for the word "part". I'm not sure lsblk is on every distribution though.
Another way that would probably work everywhere would be to list /sys/block/<disk>/ and look for <disk>N (N: partition number).
Updated by Ian Colle almost 11 years ago
- Assignee set to Alexandre Marangone
Alexandre, please implement one of the suggestions you mentioned.
Updated by Sage Weil almost 11 years ago
i think the right way to do this is to look to see if /sys/block/$disk/$part exist (e.g., /sys/block/sda/sda1) to tell if it is a child partition.
Updated by Alexandre Marangone almost 11 years ago
Came up with this: https://gist.github.com/alram/33ea3360d5aa6a86e8a4
Updated by Sage Weil almost 11 years ago
- Status changed from New to Fix Under Review
pusehd to wip-ceph-disk
Updated by Sage Weil almost 11 years ago
- Status changed from Fix Under Review to Pending Backport
Updated by Sage Weil almost 11 years ago
- Status changed from Pending Backport to Resolved