Skip to content

Commit e65bc61

Browse files
committed
ceph-volume: improve clarity and consistency in List.single_report
- Rename the parameter `arg` to `osd` for better readability. - Simplify the check for numeric OSD identifiers using `isdigit()`. Signed-off-by: Guillaume Abrioux <[email protected]>
1 parent 93827e8 commit e65bc61

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/ceph-volume/ceph_volume/devices/lvm/listing.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -140,20 +140,20 @@ def full_report(self):
140140
"""
141141
return self.create_report(api.get_lvs())
142142

143-
def single_report(self, arg):
143+
def single_report(self, osd):
144144
"""
145145
Generate a report for a single device. This can be either a logical
146146
volume in the form of vg/lv, a device with an absolute path like
147147
/dev/sda1 or /dev/sda, or a list of devices under same OSD ID.
148148
149149
Return value '{}' denotes failure.
150150
"""
151-
if isinstance(arg, int) or arg.isdigit():
152-
lv = api.get_lvs_from_osd_id(arg)
153-
elif arg[0] == '/':
154-
lv = api.get_lvs_from_path(arg)
151+
if osd.isdigit():
152+
lv = api.get_lvs_from_osd_id(osd)
153+
elif osd[0] == '/':
154+
lv = api.get_lvs_from_path(osd)
155155
else:
156-
vg_name, lv_name = arg.split('/')
156+
vg_name, lv_name = osd.split('/')
157157
lv = [api.get_single_lv(filters={'lv_name': lv_name,
158158
'vg_name': vg_name})]
159159

@@ -163,7 +163,7 @@ def single_report(self, arg):
163163
# check if device is a non-lvm journals or wal/db
164164
for dev_type in ['journal', 'wal', 'db']:
165165
lvs = api.get_lvs(tags={
166-
'ceph.{}_device'.format(dev_type): arg})
166+
'ceph.{}_device'.format(dev_type): osd})
167167
if lvs:
168168
# just taking the first lv here should work
169169
lv = lvs[0]

0 commit comments

Comments
 (0)