Skip to content
This repository was archived by the owner on Sep 9, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
---
# Creates per-tier QoS policies on VAST via REST API for tiers that define qos_policy.
# Uses ansible.builtin.uri because the vendored collection has no QoS module.
# NOTE: VAST 5.4.x only supports policy_type VIEW and USER — no VOLUME type.
# Block StorageClasses must NOT reference qos_policy (the CSI driver rejects
# VIEW-type policies on volumes). QoS for block is deferred until VAST adds
# VOLUME-type QoS support.
# Sets policy_type based on tier protocol: VIEW for NFS, VOLUME for block.
#
# Requires in scope:
# _vast_vms_conn — VAST VMS connection dict (admin or tenant manager)
Expand All @@ -14,9 +11,9 @@
# Sets output fact:
# _vast_qos_policy_names — list of created QoS policy names

- name: Filter NFS tiers with qos_policy defined (block QoS not supported on VAST 5.4.x)
- name: Filter tiers with qos_policy defined
ansible.builtin.set_fact:
_vast_qos_tiers: "{{ _provider_tiers | selectattr('qos_policy', 'defined') | rejectattr('protocol', 'equalto', 'block') | list }}"
_vast_qos_tiers: "{{ _provider_tiers | selectattr('qos_policy', 'defined') | list }}"

- name: Skip QoS policy creation when no tiers define qos_policy
when: _vast_qos_tiers | length == 0
Expand Down Expand Up @@ -69,7 +66,8 @@
body: >-
{{ {'name': item.item.qos_policy,
'tenant_id': _vast_tenant_id | int,
'mode': 'STATIC'}
'mode': 'STATIC',
'policy_type': ('VOLUME' if item.item.protocol == 'block' else 'VIEW')}
| combine(item.item.qos_limits | default({})) }}
headers:
Authorization: "Bearer {{ _vast_qos_auth.json.access }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,8 @@
'tenant_name': tenant_name})
| combine({'csi.storage.k8s.io/node-stage-secret-name': _vast_csi_secret_ref.name})
| combine({'csi.storage.k8s.io/node-stage-secret-namespace': _vast_csi_secret_ref.namespace})
| combine(_vast_sc_block_encryption_params | default({})) }}
| combine(_vast_sc_block_encryption_params | default({}))
| combine(({'qos_policy': item.qos_policy} if item.qos_policy is defined else {})) }}
reclaimPolicy: Delete
volumeBindingMode: WaitForFirstConsumer
loop: "{{ _vast_block_tiers }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ stringData:
vast_local_provider_id: "PLACEHOLDER_DO_NOT_USE_1"
vip_pool_name: "PLACEHOLDER_DO_NOT_USE_vippool-test-tenant"
vast_endpoint: "PLACEHOLDER_DO_NOT_USE_https://vast-vms.example.com"
storage_tiers: '[{"name":"default","protocol":"nfs","provider":"vast","qos_policy":"test-qos"}]'
storage_tiers: '[{"name":"default","protocol":"nfs","provider":"vast","qos_policy":"test-qos"},{"name":"block-perf","protocol":"block","provider":"vast","qos_policy":"test-qos-block"}]'
storage_provider_type: "vast"
tenant_manager_name: "PLACEHOLDER_DO_NOT_USE_osac-test-tenant"
tenant_manager_username: "PLACEHOLDER_DO_NOT_USE_osac-test-tenant"
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/mock_vms_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"views": {"name": "", "path": "/", "policy_id": 1, "tenant_id": 1},
"viewpolicies": {"name": "", "flavor": "NFS", "protocols": ["NFS"], "tenant_id": 1},
"quotas": {"name": "", "hard_limit": 0, "soft_limit": 0, "tenant_id": 1},
"qospolicies": {"name": "", "tenant_id": 1, "mode": "STATIC"},
"qospolicies": {"name": "", "tenant_id": 1, "mode": "STATIC", "policy_type": "VIEW"},
"users": {"name": "", "local_provider_id": 1},
"roles": {"name": "", "tenant_id": 1, "tenant_ids": [], "permissions_list": []},
"managers": {"username": "", "user_type": "TENANT_ADMIN", "tenant_id": 1, "roles": []},
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/setup_test_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export VAST_VIP_POOL_NAME="osac-test-pool"
export VAST_VIP_POOL_IP_RANGES='[["10.0.0.10","10.0.0.50"]]'
export VAST_VIP_POOL_SUBNET_CIDR="24"
export VAST_VALIDATE_CERTS="false"
export STORAGE_TIERS='[{"name":"default","protocol":"nfs","provider":"vast","qos_policy":"test-qos","qos_limits":{"static_limits":{"max_reads_bw_mbps":100,"max_writes_bw_mbps":100}}}]'
export STORAGE_TIERS='[{"name":"default","protocol":"nfs","provider":"vast","qos_policy":"test-qos","qos_limits":{"static_limits":{"max_reads_bw_mbps":100,"max_writes_bw_mbps":100}}},{"name":"block-perf","protocol":"block","provider":"vast","qos_policy":"test-qos-block","qos_limits":{"static_limits":{"max_reads_bw_mbps":200,"max_writes_bw_mbps":200}}}]'
ENVEOF
fi

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
vast_local_provider_id: "1"
vip_pool_name: "osac-test-pool"
vast_endpoint: "127.0.0.1:18443"
storage_tiers: '[{"name":"default","protocol":"nfs","provider":"vast","qos_policy":"test-qos"},{"name":"block-tier","protocol":"block","provider":"vast"}]'
storage_tiers: '[{"name":"default","protocol":"nfs","provider":"vast","qos_policy":"test-qos"},{"name":"block-tier","protocol":"block","provider":"vast","qos_policy":"test-qos-block"}]'
storage_provider_type: "vast"
tenant_manager_name: "osac-test-ensuresc"
tenant_manager_username: "osac-test-ensuresc"
Expand Down Expand Up @@ -101,9 +101,19 @@
- name: default
protocol: nfs
provider: vast
qos_policy: test-qos
qos_limits:
static_limits:
max_reads_bw_mbps: 100
max_writes_bw_mbps: 100
- name: block-tier
protocol: block
provider: vast
qos_policy: test-qos-block
qos_limits:
static_limits:
max_reads_bw_mbps: 200
max_writes_bw_mbps: 200
storage_provider_action: ensure_storage_class
storage_provider_provisioning_target: vmaas
storage_provider_snapshots_enabled: true
Expand Down Expand Up @@ -230,6 +240,7 @@
- _block_sc_result.resources[0].parameters.storagePath is not defined
- _block_sc_result.resources[0].parameters.viewPolicy is not defined
- _block_sc_result.resources[0].parameters.secretName is not defined
- _block_sc_result.resources[0].parameters.qos_policy == "test-qos-block"
fail_msg: "Block StorageClass parameters incorrect: {{ _block_sc_result.resources[0].parameters }}"
success_msg: "Block StorageClass parameters correct"

Expand Down Expand Up @@ -352,9 +363,19 @@
- name: default
protocol: nfs
provider: vast
qos_policy: test-qos
qos_limits:
static_limits:
max_reads_bw_mbps: 100
max_writes_bw_mbps: 100
- name: block-tier
protocol: block
provider: vast
qos_policy: test-qos-block
qos_limits:
static_limits:
max_reads_bw_mbps: 200
max_writes_bw_mbps: 200
storage_provider_action: ensure_storage_class
storage_provider_provisioning_target: vmaas
storage_provider_snapshots_enabled: true
Expand Down Expand Up @@ -409,6 +430,22 @@
fail_msg: "No view policy API calls found — ensure_storage_class should create view policies"
success_msg: "View policy API calls detected"

- name: Extract QoS policy creation calls
ansible.builtin.set_fact:
_qos_create_calls: >-
{{ _call_log
| selectattr('path', 'search', 'qospolicies')
| selectattr('method', 'equalto', 'POST')
| list }}

- name: Assert QoS policies were created with correct policy_type
ansible.builtin.assert:
that:
- _qos_create_calls | selectattr('body.name', 'equalto', 'test-qos') | map(attribute='body.policy_type') | first == 'VIEW'
- _qos_create_calls | selectattr('body.name', 'equalto', 'test-qos-block') | map(attribute='body.policy_type') | first == 'VOLUME'
fail_msg: "QoS policy_type incorrect — NFS should be VIEW, block should be VOLUME"
success_msg: "QoS policies created with correct policy_type per protocol"

# ── Cleanup ──
- name: "Storage Provider Ensure SC - Cleanup"
hosts: localhost
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@
static_limits:
max_reads_bw_mbps: 100
max_writes_bw_mbps: 100
- name: block-perf
protocol: block
provider: vast
qos_policy: test-qos-block
qos_limits:
static_limits:
max_reads_bw_mbps: 200
max_writes_bw_mbps: 200
storage_provider_action: setup
storage_provider_provisioning_target: vmaas
storage_provider_snapshots_enabled: false
Expand Down
Loading