Skip to content

Commit

Permalink
ceph-volume: fall back to PARTTYPE if PARTLABEL is empty
Browse files Browse the repository at this point in the history
In some cases ceph-disk does not populate PARTLABEL for wal and db
partitions. This commit adds the assumption that the empty string is a
valid label and falls back to identifying those disks by PARTTYPE.

Fixes: https://tracker.ceph.com/issues/40917

Signed-off-by: Jan Fajerski <jfajerski@suse.com>
(cherry picked from commit 82d2ae7)
  • Loading branch information
Jan Fajerski committed Aug 2, 2019
1 parent 833ca7c commit 4cdcc20
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/ceph-volume/ceph_volume/util/device.py
Expand Up @@ -5,6 +5,7 @@
from ceph_volume import sys_info
from ceph_volume.api import lvm
from ceph_volume.util import disk
from ceph_volume.util.constants import ceph_disk_guids

report_template = """
{dev:<25} {size:<12} {rot!s:<7} {available!s:<9} {model}"""
Expand Down Expand Up @@ -416,12 +417,24 @@ def partlabel(self):
return lsblk_partlabel
return self.device.blkid_api.get('PARTLABEL', '')

@property
def parttype(self):
"""
Seems like older version do not detect PARTTYPE correctly (assuming the
info in util/disk.py#lsblk is still valid).
SImply resolve to using blkid since lsblk will throw an error if asked
for an unknown columns
"""
return self.device.blkid_api.get('PARTTYPE', '')

@property
def is_member(self):
if self._is_ceph_disk_member is None:
if 'ceph' in self.partlabel:
self._is_ceph_disk_member = True
return True
elif self.parttype in ceph_disk_guids.keys():
return True
return False
return self._is_ceph_disk_member

Expand All @@ -436,4 +449,5 @@ def type(self):
for t in types:
if t in self.partlabel:
return t
return 'unknown'
label = ceph_disk_guids.get(self.parttype, {})
return label.get('type', 'unknown').split('.')[-1]
1 change: 1 addition & 0 deletions src/ceph-volume/ceph_volume/util/disk.py
Expand Up @@ -51,6 +51,7 @@ def _blkid_parser(output):
'TYPE': 'TYPE',
'PART_ENTRY_NAME': 'PARTLABEL',
'PART_ENTRY_UUID': 'PARTUUID',
'PART_ENTRY_TYPE': 'PARTTYPE',
'PTTYPE': 'PTTYPE',
}

Expand Down

0 comments on commit 4cdcc20

Please sign in to comment.