Skip to content

Commit

Permalink
lvm: Use blivet static data when checking if the VG is active
Browse files Browse the repository at this point in the history
Instead of calling 'lvs' again in LVMVolumeGroupDevice.status
  • Loading branch information
vojtechtrefny committed Jan 20, 2022
1 parent 8d1bfe6 commit f339d98
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions blivet/devices/lvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 +221,8 @@ def status(self):

# special handling for incomplete VGs
if not self.complete:
try:
lvs_info = blockdev.lvm.lvs(vg_name=self.name)
except blockdev.LVMError:
lvs_info = []

for lv_info in lvs_info:
if lv_info.attr and lv_info.attr[4] == 'a':
for lv_info in lvs_info.cache.values():
if lv_info.vg_name == self.name and lv_info.attr and lv_info.attr[4] == 'a':
return True

return False
Expand Down

0 comments on commit f339d98

Please sign in to comment.