Skip to content

Commit

Permalink
ceph-volume simple.scan better detection for ceph-disk data devices
Browse files Browse the repository at this point in the history
Uses the new ``CephDiskDevice`` to look into PARTLABEL from both lsblk
(the default) falling back to blkid, which in some cases has the right
value when lsblk fails.

Signed-off-by: Alfredo Deza <adeza@redhat.com>
(cherry picked from commit c502e5f)
  • Loading branch information
Alfredo Deza committed Sep 28, 2018
1 parent 57a85c2 commit dc85588
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/ceph-volume/ceph_volume/devices/simple/scan.py
Expand Up @@ -8,6 +8,7 @@
from ceph_volume import decorators, terminal, conf
from ceph_volume.api import lvm
from ceph_volume.util import arg_validators, system, disk, encryption
from ceph_volume.util.device import Device


logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -337,10 +338,12 @@ def main(self):
return

args = parser.parse_args(self.argv)
if disk.is_partition(args.osd_path):
label = disk.lsblk(args.osd_path)['PARTLABEL']
if 'data' not in label:
raise RuntimeError('Device must be the data partition, but got: %s' % label)
device = Device(args.osd_path)
if device.is_partition:
if device.ceph_disk.type != 'data':
label = device.ceph_disk.partlabel
msg = 'Device must be the ceph data partition, but PARTLABEL reported: "%s"' % label
raise RuntimeError(msg)

# Capture some environment status, so that it can be reused all over
self.device_mounts = system.get_mounts(devices=True)
Expand Down

0 comments on commit dc85588

Please sign in to comment.