Project

General

Profile

Actions

Bug #64353

open

ceph-volume fails to parse LVs with single-character name

Added by Tobias Florek 3 months ago. Updated 3 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
% Done:

0%

Source:
Tags:
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

In `ceph_volume/api/lvm.py`'s `get_lv_path_from_mapper`, we have

```

def get_lv_path_from_mapper(mapper):
"""
This functions translates a given mapper device under the format:
/dev/mapper/LV to the format /dev/VG/LV.
eg:
from:
/dev/mapper/ceph--c1a97e46--234c--46aa--a549--3ca1d1f356a9-osd--block--32e8e896--172e--4a38--a06a--3702598510ec
to:
/dev/ceph-c1a97e46-234c-46aa-a549-3ca1d1f356a9/osd-block-32e8e896-172e-4a38-a06a-3702598510ec
"""
results = re.split(r'^\/dev\/mapper\/(.+\w)-(\w.*)', mapper)
results = list(filter(None, results))

if len(results) != 2:
return None
return f"/dev/{results[0].replace('--', '-')}/{results[1].replace('--', '-')}" 
```

This fails for e.g. `/dev/mapper/local_nvme-a`.

I am not sure whether changing the regular expression to be `r'^\/dev\/mapper\/(.+\w)-(\w.*)` has any bad consequences.

See (https://github.com/ceph/ceph/blob/c1da4c673ca749fa2d76220da1ba5d69779cd7f1/src/ceph-volume/ceph_volume/api/lvm.py#L1224)

With this bug `ceph volume inventory /dev/sda` fails.

Actions #1

Updated by Tobias Florek 3 months ago

Sorry for the formatting. I was blindly writing Markdown.

Actions

Also available in: Atom PDF