Project

General

Profile

Actions

Bug #5211

closed

ceph-disk prepare: list_partitions() shouldn't return disks

Added by Alexandre Marangone almost 11 years ago. Updated almost 11 years ago.

Status:
Resolved
Priority:
High
Category:
-
Target version:
-
% Done:

0%

Source:
Support
Tags:
Backport:
Regression:
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

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

Actions #1

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
Actions #2

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.

Actions #3

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

Actions #4

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).

Actions #5

Updated by Sage Weil almost 11 years ago

  • Project changed from Ceph to devops
Actions #6

Updated by Ian Colle almost 11 years ago

  • Assignee set to Alexandre Marangone

Alexandre, please implement one of the suggestions you mentioned.

Actions #7

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.

Actions #9

Updated by Sage Weil almost 11 years ago

  • Status changed from New to Fix Under Review

pusehd to wip-ceph-disk

Actions #10

Updated by Sage Weil almost 11 years ago

  • Status changed from Fix Under Review to Pending Backport
Actions #11

Updated by Sage Weil almost 11 years ago

  • Status changed from Pending Backport to Resolved
Actions

Also available in: Atom PDF