]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume: fix raw list with logical partition
authorDimitri Savineau <dsavinea@redhat.com>
Fri, 3 Sep 2021 18:24:48 +0000 (14:24 -0400)
committerGuillaume Abrioux <gabrioux@redhat.com>
Wed, 8 Sep 2021 11:16:10 +0000 (13:16 +0200)
This is a regression introduced by 9212420, when the host is using a
logical partition then lsblk reports that partition as a child from the
physical device.
That logical partition is prefixed by the `└─` character.

This leads the `raw list` subcommand to show the lsblk error on the stderr.

```
$ ceph-volume raw list
{}
 stderr: lsblk: `-/dev/sda1: not a block device
```

The lsblk command output looks like:

```
$ lsblk --paths --output=NAME --noheadings
/dev/sda
└─/dev/sda1
/dev/sdb
/dev/sdc
/dev/sdd
```

Using the `--list` option with lsblk solves the issue.

```
$ lsblk --list --paths --output=NAME --noheadings
/dev/sda
/dev/sda1
/dev/sdb
/dev/sdc
/dev/sdd
```

Fixes: https://tracker.ceph.com/issues/52504
Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
(cherry picked from commit 7a6486bf4ddb2d789cc16047d8163baa8473e253)

src/ceph-volume/ceph_volume/devices/raw/list.py

index 054db345e887444db720dcf6507833265e9de507..c86d4996f8d05699e1c5e3297ea10dbd412d9abd 100644 (file)
@@ -72,7 +72,7 @@ class List(object):
             # the parent disk has a bluestore header, but children may be the most appropriate
             # devices to return if the parent disk does not have a bluestore header.
             out, err, ret = process.call([
-                'lsblk', '--paths', '--output=NAME', '--noheadings',
+                'lsblk', '--paths', '--output=NAME', '--noheadings', '--list'
             ])
             assert not ret
             devs = out