list-disks doesn't correctly work when using partitions for osd backends

Bug #1838078 reported by Andrey Grebennikov
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Ceph OSD Charm
Triaged
Wishlist
Unassigned
charms.ceph
Triaged
Wishlist
Unassigned

Bug Description

In full-nvme solution it makes sense to run multiple osds working on with the same nvme device.
IN order to achieve this it is necessary to use partitions when provisioning osds. However list-disks action doesn't list all possible partitions but rather shows disks only.

use-case:
pre-created 4 partitions on /dev/disk/by-dname/osd:
ubuntu@infra1:~/k8s-vxflex$ juju run --unit ceph-osd/0 'ls /dev/disk/by-dname'
nvme1n1
nvme1n1-part1
nvme1n1-part2
nvme1n1-part3
osd
osd-part1
osd-part2
osd-part3
osd-part4
sda

And osds are created on top of osd-partX partitions.
However list-disks only shows block devices themselves:

ubuntu@infra1:~/k8s-vxflex$ juju run-action ceph-osd/0 list-disks --wait
unit-ceph-osd-0:
  id: e5d80a12-0d73-4977-8c32-8c84bda3f4fb
  results:
    blacklist: '[]'
    disks: '[''/dev/sda'', ''/dev/nvme0n1'']'
    non-pristine: '[''/dev/nvme0n1'']'
  status: completed

Revision history for this message
Alex Kavanagh (ajkavanagh) wrote :

The culprit function is in charms.ceph lib/ceph/utils.py:

def unmounted_disks():
    """List of unmounted block devices on the current host."""
    disks = []
    context = pyudev.Context()
    for device in context.list_devices(DEVTYPE='disk'):
        if device['SUBSYSTEM'] == 'block':
            matched = False
            for block_type in [u'dm', u'loop', u'ram', u'nbd']:
                if block_type in device.device_node:
                    matched = True
            if matched:
                continue
            disks.append(device.device_node)
    log("Found disks: {}".format(disks))
    return [disk for disk in disks if not is_device_mounted(disk)]

It would either need to learn about partitions, or the calling function in ceph-osd would need to call another library that would add in partitions.

Changed in charm-ceph-osd:
importance: Undecided → Wishlist
status: New → Triaged
Changed in charms.ceph:
importance: Undecided → Wishlist
status: New → Triaged
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.