Skip to content

Commit

Permalink
Added blivet backwards compatibility for shared VGs
Browse files Browse the repository at this point in the history
Older versions of blivet do not support 'shared' parameter. This resulted in
failures in tests unrelated to shared VGs. This change fixes that
behavior as well as fixes minor condition error in a test.
  • Loading branch information
japokorn authored and richm committed Dec 12, 2023
1 parent 03abcd4 commit eec6543
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion library/blivet.py
Original file line number Diff line number Diff line change
Expand Up @@ -1534,7 +1534,14 @@ def _create(self):
if not self._device:
members = self._manage_encryption(self._create_members())
try:
pool_device = self._blivet.new_vg(name=self._pool['name'], parents=members, shared=self._pool['shared'])
if self._pool['shared']:
pool_device = self._blivet.new_vg(name=self._pool['name'],
parents=members,
shared=self._pool['shared'])
else:
# Makes it compatible with older blivet versions that does not support shared VGs
pool_device = self._blivet.new_vg(name=self._pool['name'],
parents=members)
except Exception as e:
raise BlivetAnsibleError("failed to set up pool '%s': %s" % (self._pool['name'], str(e)))

Expand Down
2 changes: 1 addition & 1 deletion tests/test-verify-pool.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

- name: Verify that VG shared value checks out
assert:
that: (storage_test_pool.shared | bool) and ('1' in vgs_dump.stdout)
that: (storage_test_pool.shared | bool) == ('1' in vgs_dump.stdout)
msg: >-
Shared VG presence ({{ storage_test_pool.shared }})
does not match its expected state ({{ '1' in vgs_dump.stdout }})
Expand Down

0 comments on commit eec6543

Please sign in to comment.