1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

lvmdbustest.py: Use local data instead of fetching

Avoid making more dbus calls to get information we already have.  This
also avoids us getting an error where a dbus object representation is
being deleted by another process while we are trying to gather information
about it across the wire.
This commit is contained in:
Tony Asleson 2019-10-14 14:33:16 -05:00
parent f91df163e2
commit 508d1808b0

View File

@ -88,8 +88,12 @@ def _root_pv_name(res, pv_name):
vg_name = pv_name.split('/')[2] vg_name = pv_name.split('/')[2]
for v in res[VG_INT]: for v in res[VG_INT]:
if v.Vg.Name == vg_name: if v.Vg.Name == vg_name:
pv = ClientProxy(bus, v.Vg.Pvs[0], interfaces=(PV_INT, )) for pv in res[PV_INT]:
return _root_pv_name(res, pv.Pv.Name) if pv.object_path in v.Vg.Pvs:
return _root_pv_name(res, pv.Pv.Name)
return None
def _prune_lvs(res, interface, vg_object_path): def _prune_lvs(res, interface, vg_object_path):
lvs = [lv for lv in res[interface] if lv.LvCommon.Vg == vg_object_path] lvs = [lv for lv in res[interface] if lv.LvCommon.Vg == vg_object_path]
res[interface] = lvs res[interface] = lvs