---
#
# Verify the pool configuration.
#
- name: Set _storage_pool_tests
  set_fact:
    _storage_pool_tests: ['members', 'volumes']
    # future:
    #   name
    #   type
    #   size
    #   members:
    #     disks
    #     raid
    #     compression
    #     deduplication

- name: Get VG shared value status
  command: vgs --noheadings --binary -o shared {{ storage_test_pool.name }}
  register: vgs_dump
  when: storage_test_pool.type == 'lvm' and storage_test_pool.state == 'present'
  changed_when: false

- name: Verify that VG shared value checks out
  assert:
    that: storage_test_pool.shared == actual
    msg: >-
      Shared VG presence expected state ({{ storage_test_pool.shared }})
      does not match its actual state ({{ actual }})
  when: storage_test_pool.type == 'lvm' and storage_test_pool.state == 'present'
  vars:
    actual: "{{ '1' in vgs_dump.stdout }}"

- name: Verify pool subset
  include_tasks: "test-verify-pool-{{ storage_test_pool_subset }}.yml"
  loop: "{{ _storage_pool_tests }}"
  loop_control:
    loop_var: storage_test_pool_subset
