Skip to content

Commit

Permalink
Do not allow removing members from existing pools in safe mode
Browse files Browse the repository at this point in the history
  • Loading branch information
vojtechtrefny committed Jun 8, 2022
1 parent 07b2352 commit bec3429
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions library/blivet.py
Original file line number Diff line number Diff line change
Expand Up @@ -1404,12 +1404,19 @@ def _manage_members(self):
if not self._device:
return

global safe_mode

add_disks = [d for d in self._disks if d not in self._device.ancestors]
remove_disks = [pv for pv in self._device.pvs if not any(d in pv.ancestors for d in self._disks)]

if not (add_disks or remove_disks):
return

if remove_disks and safe_mode:
raise BlivetAnsibleError("cannot remove members '%s' from pool '%s' in safe mode" %
(", ".join(d.name for d in remove_disks),
self._device.name))

if self._is_raid:
raise BlivetAnsibleError("managing pool members is not supported with RAID")

Expand Down

0 comments on commit bec3429

Please sign in to comment.