Skip to content
Open
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
1,292 changes: 1,292 additions & 0 deletions test/integration/plugins/ontap/helpers/qos_offerings.py

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
03 Disable zone-scoped pool — pool.state Disabled; FlexVol unchanged
04 Enable zone-scoped pool — pool.state Up; FlexVol unchanged
05 Delete zone-scoped pool — pool gone; FlexVol deleted; baseline restored
06 Zone-scoped pool accepts capacity IOPS — listStoragePools capacityiops
matches the value sent at create; FlexVol is online

Prerequisites:
- CloudStack management server with the NetApp ONTAP plugin deployed
Expand Down Expand Up @@ -176,7 +178,7 @@ def setUpClass(cls):
# Helpers
# ------------------------------------------------------------------

def _create_zone_pool(self):
def _create_zone_pool(self, capacityiops=None):
"""Create a zone-scoped iSCSI pool (no clusterid / podid)."""
ps = self.testdata[TestData.primaryStorage]
storage_ip = self.testdata[TestData.ontap][TestData.DETAIL_STORAGE_IP]
Expand All @@ -191,6 +193,8 @@ def _create_zone_pool(self):
cmd.provider = ps[TestData.provider]
cmd.tags = ps[TestData.tags]
cmd.capacitybytes = ps["capacitybytes"]
if capacityiops is not None:
cmd.capacityiops = int(capacityiops)
cmd.hypervisor = "KVM"
cmd.managed = True

Expand Down Expand Up @@ -411,3 +415,51 @@ def test_05_delete_zone_scoped_pool(self):
self._assert_igroup_baseline_unchanged(
"after zone-scoped pool deletion"
)

# ------------------------------------------------------------------
# Step 06 — Zone-scoped pool accepts capacity IOPS
# ------------------------------------------------------------------

@attr(tags=["iscsi_zone_pool"], required_hardware=True)
def test_06_zone_scoped_pool_accepts_capacity_iops(self):
"""A zone-scoped pool stores the capacity IOPS given at create."""
capacity_iops = 5000
pool = self._create_zone_pool(capacityiops=capacity_iops)
self.__class__.pool2 = pool

self.assertEqual(
pool.state, "Up",
"Pool state should be 'Up', got '%s'" % pool.state
)
listed = list_storage_pools(self.apiClient, id=pool.id)
self.assertTrue(listed, "Zone-scoped pool missing after create")
self.assertEqual(
int(listed[0].capacityiops), capacity_iops,
"Pool capacity IOPS should be %d, got '%s'"
% (capacity_iops, listed[0].capacityiops)
)

ontap_vol = self.ontap.get_volume(pool.name)
self.assertIsNotNone(
ontap_vol,
"ONTAP FlexVol not found for pool '%s'" % pool.name
)
self.assertEqual(
ontap_vol.get("state"), "online",
"ONTAP FlexVol should be 'online', got '%s'" % ontap_vol.get("state")
)

pool_name = pool.name
self._enter_maintenance(pool.id)
self._delete_pool(pool.id, forced=True)
self.__class__.pool2 = None

try:
remaining = list_storage_pools(self.apiClient, id=pool.id)
except Exception:
remaining = None
self.assertFalse(remaining, "Pool still listed in CloudStack after deletion")
self.assertIsNone(
self.ontap.get_volume(pool_name),
"ONTAP FlexVol '%s' still exists after pool deletion" % pool_name
)
16 changes: 16 additions & 0 deletions test/integration/plugins/ontap/iscsi/qos/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
89 changes: 89 additions & 0 deletions test/integration/plugins/ontap/iscsi/qos/test_qos_offerings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

"""
QoS offering coverage for a NetApp ONTAP iSCSI primary pool.

Disk offerings cover no IOPS, max only, min and max, min only, custom
size, custom IOPS, thin/sparse/fat, a shared policy, and resize. Compute
offerings cover a fixed offering, an offering that carries its own IOPS,
one bound to a disk offering, a strict offering, a custom offering, and
custom IOPS supplied at deploy. Root and data disks are also checked
together. iSCSI checks the QoS policy on the LUN.

Minimum IOPS run on AFF. On FAS those creates are rejected and no QoS
policy is left behind. Each test removes its CloudStack volumes and VMs,
then the ONTAP LUN and any unused QoS policy. tearDownClass still
force-deletes the pool and the FlexVol.

Workflow:
01 Fixed disk, no IOPS
02 Fixed disk, maximum IOPS only
03 Fixed disk, minimum and maximum IOPS
04 Fixed disk, minimum IOPS only
05 Custom-size disk with fixed IOPS
06 Custom IOPS, maximum only
07 Custom IOPS, minimum and maximum
08 Custom size and custom IOPS
09 Thin, sparse, and fat disks keep maximum IOPS
10 Two volumes share one policy until the last delete
11 Resize onto a disk offering with a higher maximum
12 Resize onto a disk offering without IOPS
13 Reject a disk offering whose minimum exceeds its maximum
14 Reject a disk offering whose minimum is zero
15 Reject custom IOPS whose minimum exceeds the maximum
16 Reject a minimum that exceeds the pool IOPS capacity
17 Fixed compute offering with an override QoS disk
18 Compute offering that carries its own maximum IOPS
19 Compute offering bound to a QoS disk
20 Strict compute offering rejects a different override disk
21 Custom compute offering with a bound QoS disk
22 Custom compute offering with a custom-size, custom-IOPS root disk
23 Compute offering with custom IOPS supplied at deploy
24 Root disk without IOPS and a data disk with IOPS
25 Root and data disks use different policies
26 Hypervisor rate limits do not create an ONTAP policy
27 Constrained custom compute with a fixed-IOPS root disk
28 Constrained custom compute with custom IOPS at deploy

Prerequisites:
- CloudStack management server with the NetApp ONTAP plugin deployed
- KVM cluster whose hosts have an iSCSI initiator
- Ready KVM template for the compute-offering cases
- ONTAP SVM with iSCSI enabled
- ontap.cfg populated

Running:
PYTHONPATH=test/integration/plugins/ontap nosetests --with-marvin \\
--marvin-config=test/integration/plugins/ontap/ontap.cfg \\
test/integration/plugins/ontap/iscsi/qos/test_qos_offerings.py -v
"""

# Import the module, not the base class: nose would otherwise collect the
# unparameterised base as a second test class in this file.
from helpers import qos_offerings as qos


class TestOntapISCSIQosOfferings(qos.OntapQosOfferingsBase):

PROTOCOL = "ISCSI"
PROTOCOL_CFG_KEY = "iscsi"
POOL_URL_SCHEME = "iscsi"
_vol_name_prefix = "QosIscsi"


qos.tag_qos_tests(TestOntapISCSIQosOfferings, "iscsi_qos")
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
03 Disable zone-scoped pool — pool.state Disabled; FlexVol unchanged
04 Enable zone-scoped pool — pool.state Up; FlexVol unchanged
05 Delete zone-scoped pool — pool gone; FlexVol deleted; export policy deleted
06 Zone-scoped pool accepts capacity IOPS — listStoragePools capacityiops
matches the value sent at create; FlexVol is online

Prerequisites:
- CloudStack management server with the NetApp ONTAP plugin deployed
Expand Down Expand Up @@ -192,7 +194,7 @@ def setUpClass(cls):
# Helpers
# ------------------------------------------------------------------

def _create_zone_pool(self):
def _create_zone_pool(self, capacityiops=None):
"""Create a zone-scoped NFS3 pool (no clusterid / podid)."""
ps = self.testdata[TestData.primaryStorage]
storage_ip = self.testdata[TestData.ontap][TestData.DETAIL_STORAGE_IP]
Expand All @@ -207,6 +209,8 @@ def _create_zone_pool(self):
cmd.provider = ps[TestData.provider]
cmd.tags = ps[TestData.tags]
cmd.capacitybytes = ps["capacitybytes"]
if capacityiops is not None:
cmd.capacityiops = int(capacityiops)
cmd.hypervisor = "KVM"
cmd.managed = True

Expand Down Expand Up @@ -479,6 +483,63 @@ def test_05_delete_zone_scoped_pool(self):
"Export policy '%s' still exists after pool deletion" % ep_name
)

# ------------------------------------------------------------------
# Step 06 — Zone-scoped pool accepts capacity IOPS
# ------------------------------------------------------------------

@attr(tags=["zone_pool"], required_hardware=True)
def test_06_zone_scoped_pool_accepts_capacity_iops(self):
"""A zone-scoped pool stores the capacity IOPS given at create."""
capacity_iops = 5000
pool = self._create_zone_pool(capacityiops=capacity_iops)
self.__class__.pool2 = pool
self.__class__.pool_ep_name = self._get_export_policy_name(pool)

self.assertEqual(
pool.state, "Up",
"Pool state should be 'Up', got '%s'" % pool.state
)
listed = list_storage_pools(self.apiClient, id=pool.id)
self.assertTrue(listed, "Zone-scoped pool missing after create")
self.assertEqual(
int(listed[0].capacityiops), capacity_iops,
"Pool capacity IOPS should be %d, got '%s'"
% (capacity_iops, listed[0].capacityiops)
)

ontap_vol = self.ontap.get_volume(pool.name)
self.assertIsNotNone(
ontap_vol,
"ONTAP FlexVol not found for pool '%s'" % pool.name
)
self.assertEqual(
ontap_vol.get("state"), "online",
"ONTAP FlexVol should be 'online', got '%s'" % ontap_vol.get("state")
)

pool_name = pool.name
ep_name = self.__class__.pool_ep_name
self._enter_maintenance(pool.id)
self._cleanup_kvm_storage_pool_mounts(pool.id)
self._delete_pool(pool.id, forced=True)
self.__class__.pool2 = None
self.__class__.pool_ep_name = None

try:
remaining = list_storage_pools(self.apiClient, id=pool.id)
except Exception:
remaining = None
self.assertFalse(remaining, "Pool still listed in CloudStack after deletion")
self.assertIsNone(
self.ontap.get_volume(pool_name),
"ONTAP FlexVol '%s' still exists after pool deletion" % pool_name
)
if ep_name:
self.assertIsNone(
self.ontap.get_export_policy(ep_name),
"Export policy '%s' still exists after pool deletion" % ep_name
)

# ------------------------------------------------------------------
# Class-level teardown
# ------------------------------------------------------------------
Expand Down
16 changes: 16 additions & 0 deletions test/integration/plugins/ontap/nfs3/qos/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
88 changes: 88 additions & 0 deletions test/integration/plugins/ontap/nfs3/qos/test_qos_offerings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

"""
QoS offering coverage for a NetApp ONTAP NFS3 primary pool.

Disk offerings cover no IOPS, max only, min and max, min only, custom
size, custom IOPS, thin/sparse/fat, a shared policy, and resize. Compute
offerings cover a fixed offering, an offering that carries its own IOPS,
one bound to a disk offering, a strict offering, a custom offering, and
custom IOPS supplied at deploy. Root and data disks are also checked
together.

Minimum IOPS run on AFF. On FAS those creates are rejected and no QoS
policy is left behind. Each test removes its CloudStack volumes and VMs,
then the ONTAP file and any unused QoS policy. tearDownClass unmounts the
pool, then force-deletes the pool, the FlexVol, and the export policy.

Workflow:
01 Fixed disk, no IOPS
02 Fixed disk, maximum IOPS only
03 Fixed disk, minimum and maximum IOPS
04 Fixed disk, minimum IOPS only
05 Custom-size disk with fixed IOPS
06 Custom IOPS, maximum only
07 Custom IOPS, minimum and maximum
08 Custom size and custom IOPS
09 Thin, sparse, and fat disks keep maximum IOPS
10 Two volumes share one policy until the last delete
11 Resize onto a disk offering with a higher maximum
12 Resize onto a disk offering without IOPS
13 Reject a disk offering whose minimum exceeds its maximum
14 Reject a disk offering whose minimum is zero
15 Reject custom IOPS whose minimum exceeds the maximum
16 Reject a minimum that exceeds the pool IOPS capacity
17 Fixed compute offering with an override QoS disk
18 Compute offering that carries its own maximum IOPS
19 Compute offering bound to a QoS disk
20 Strict compute offering rejects a different override disk
21 Custom compute offering with a bound QoS disk
22 Custom compute offering with a custom-size, custom-IOPS root disk
23 Compute offering with custom IOPS supplied at deploy
24 Root disk without IOPS and a data disk with IOPS
25 Root and data disks use different policies
26 Hypervisor rate limits do not create an ONTAP policy
27 Constrained custom compute with a fixed-IOPS root disk
28 Constrained custom compute with custom IOPS at deploy

Prerequisites:
- CloudStack management server with the NetApp ONTAP plugin deployed
- KVM cluster and a ready KVM template for the compute-offering cases
- ONTAP SVM with NFS enabled
- ontap.cfg populated

Running:
PYTHONPATH=test/integration/plugins/ontap nosetests --with-marvin \\
--marvin-config=test/integration/plugins/ontap/ontap.cfg \\
test/integration/plugins/ontap/nfs3/qos/test_qos_offerings.py -v
"""

# Import the module, not the base class: nose would otherwise collect the
# unparameterised base as a second test class in this file.
from helpers import qos_offerings as qos


class TestOntapNFS3QosOfferings(qos.OntapQosOfferingsBase):

PROTOCOL = "NFS3"
PROTOCOL_CFG_KEY = "nfs3"
POOL_URL_SCHEME = "nfs"
_vol_name_prefix = "QosNfs"


qos.tag_qos_tests(TestOntapNFS3QosOfferings, "nfs3_qos")
Loading
Loading