Skip to content

Commit

Permalink
Merge pull request #219 from scality/preflight_check_storage
Browse files Browse the repository at this point in the history
Detect old storage configuration earlier in the playbook
  • Loading branch information
NicolasT authored Jul 27, 2018
2 parents 3ce022a + 638a8e3 commit 3a5972d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
20 changes: 20 additions & 0 deletions roles/preflight_checks/action_plugins/validate_inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,26 @@ def check_no_duplicate_addresses(task_vars):
seen_addresses.add(address)


def check_no_old_storage_configuration(task_vars):
'''
Check that the storage configuration of MetalK8s < 0.2.0 is not present
anymore
'''

for host in task_vars['hostvars'].keys():
assert 'metal_k8s_lvm' not in task_vars['hostvars'][host], (
"You are still having the old storage configuration for {host}. "
"A breaking change was introduced in MetalK8s 0.2.0 "
"and the default LVM Volume Group has been changed "
"from 'kubevg' to '{metalk8s_lvm_default_vg}'. "
"Please follow the 'Upgrading from MetalK8s < 0.2.0' "
"chapter of the documentation").format(
host=host,
metalk8s_lvm_default_vg=task_vars['hostvars'][host].get(
'metalk8s_lvm_default_vg', 'vg_metalk8s')
)


class ActionModule(ActionBase):
def run(self, tmp=None, task_vars=None):
if task_vars is None:
Expand Down
14 changes: 0 additions & 14 deletions roles/setup_lvm_vg/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
# TODO: link to documentation in fail message
- name: "LVM Setup: Detect old configuration style < 0.2.0"
tags:
- assertion
fail:
msg: >
You're still having the old storage configuration.
A breaking change was introduced in MetalK8s 0.2.0 and the default
LVM Volume Group has been changed from "kubevg" to
{{ metalk8s_lvm_default_vg }}.
Please follow the "Upgrading from MetalK8s < 0.2.0" chapter of the
documentation
when: metal_k8s_lvm is defined

- name: "LVM Setup: Check LVM packages"
package:
name: '{{ item }}'
Expand Down

0 comments on commit 3a5972d

Please sign in to comment.