From e75d2942c9ba54d62218d1fe328b1681b6cdcb02 Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Mon, 30 Sep 2024 09:17:11 +0000 Subject: [PATCH] ceph-volume: drop unnecessary call to `get_single_lv()` `Zap.zap_lv()` currently makes a call to `get_single_lv()`: ``` lv = api.get_single_lv(filters={'lv_name': device.lv_name, 'vg_name': device.vg_name}) ``` this isn't needed and redundant as zap_lv() takes an instance of `Device()` as argument which has already a `lv_api` attribute: class Device in device.py: ``` else: vgname, lvname = self.path.split('/') filters = {'lv_name': lvname, 'vg_name': vgname} lv = lvm.get_single_lv(filters=filters) # <---- same call if lv: self.lv_api = lv ``` This implies a duplicate call to `subprocess.Popen()` unnecessarily. Fixes: https://tracker.ceph.com/issues/68312 Signed-off-by: Guillaume Abrioux (cherry picked from commit c0e05bf36067294420631f33c5e43c32077eeb82) --- src/ceph-volume/ceph_volume/devices/lvm/zap.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ceph-volume/ceph_volume/devices/lvm/zap.py b/src/ceph-volume/ceph_volume/devices/lvm/zap.py index c1bef82c109..2b6925f5b27 100644 --- a/src/ceph-volume/ceph_volume/devices/lvm/zap.py +++ b/src/ceph-volume/ceph_volume/devices/lvm/zap.py @@ -191,8 +191,7 @@ class Zap(object): Device examples: vg-name/lv-name, /dev/vg-name/lv-name Requirements: Must be a logical volume (LV) """ - lv = api.get_single_lv(filters={'lv_name': device.lv_name, 'vg_name': - device.vg_name}) + lv: api.Volume = device.lv_api self.unmount_lv(lv) zap_device(device.path) -- 2.39.5