]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume simple.scan better detection for ceph-disk data devices 24335/head
authorAlfredo Deza <adeza@redhat.com>
Thu, 27 Sep 2018 20:17:29 +0000 (16:17 -0400)
committerAlfredo Deza <adeza@redhat.com>
Fri, 28 Sep 2018 20:28:09 +0000 (16:28 -0400)
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 c502e5f64aa4f0d832c14680e1731e58d8a3770b)

src/ceph-volume/ceph_volume/devices/simple/scan.py

index f215e2dc90bd3ace5ae9b4e33bd97533152429c7..f2f7d3dc98332a509a381bf92c8cd698d43b1054 100644 (file)
@@ -8,6 +8,7 @@ from textwrap import dedent
 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__)
@@ -336,10 +337,12 @@ class Scan(object):
             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)