Skip to content

Commit c2ce1df

Browse files
Srivastava, PiyushSrivastava, Piyush
authored andcommitted
feature/CSTACKEX-251: removed automation changes
1 parent 5e82535 commit c2ce1df

5 files changed

Lines changed: 38 additions & 66 deletions

File tree

‎test/integration/plugins/ontap/TEST_CASES.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ Each suite is sequential — tests must run in numbered order; each step builds
138138

139139
| # | Test method | Goal | Depends on | CloudStack success criteria | ONTAP success criteria | Type |
140140
|---|-------------|------|------------|-----------------------------|------------------------|------|
141-
| 01 | `test_01_create_primary_storage_pool` | Create a cluster-scoped iSCSI primary storage pool | setUpClass | `pool.state == "Up"`, `pool.type == "OntapiSCSI"` | FlexVol `online`; one igroup per cluster host (named `cs_{svmName}_{hostShortName}`) with host IQN as initiator | positive |
141+
| 01 | `test_01_create_primary_storage_pool` | Create a cluster-scoped iSCSI primary storage pool | setUpClass | `pool.state == "Up"`, `pool.type == "Iscsi"` | FlexVol `online`; one igroup per cluster host (named `cs_{svmName}_{hostShortName}`) with host IQN as initiator | positive |
142142
| 02 | `test_02_disable_storage_pool` | Disable the pool | test_01 (`pool`) | `pool.state == "Disabled"` | FlexVol still `online` | positive |
143143
| 03 | `test_03_enable_storage_pool` | Re-enable the pool | test_02 | `pool.state == "Up"` | FlexVol still `online` | positive |
144144
| 04 | `test_04_enter_maintenance_mode` | Put pool into maintenance | test_03 | `pool.state == "Maintenance"` | FlexVol still `online`; igroups unchanged | positive |
@@ -210,7 +210,7 @@ Each suite is sequential — tests must run in numbered order; each step builds
210210

211211
| # | Test method | Goal | Depends on | CloudStack success criteria | ONTAP success criteria | Type |
212212
|---|-------------|------|------------|-----------------------------|------------------------|------|
213-
| 01 | `test_01_create_iscsi_pool` | Create iSCSI ONTAP primary storage pool | setUpClass | `pool.state == "Up"`, `pool.type == "OntapiSCSI"` | FlexVol `online`; igroup per cluster host with host IQN | positive |
213+
| 01 | `test_01_create_iscsi_pool` | Create iSCSI ONTAP primary storage pool | setUpClass | `pool.state == "Up"`, `pool.type == "Iscsi"` | FlexVol `online`; igroup per cluster host with host IQN | positive |
214214
| 02 | `test_02_create_ontap_data_volume` | Allocate a CloudStack data volume (creates a LUN in the FlexVol) | test_01 (`pool`) | Volume non-None | ≥1 LUN in FlexVol | positive |
215215
| 03 | `test_03_deploy_vm` | Deploy VM using first ready KVM template; verify 0 LUN-maps exist before attach | test_02 (`volume`) | `vm.state == "Running"`; 0 LUN-maps on ONTAP | 0 LUN-maps (`list_lun_maps_for_volume` returns empty) | positive |
216216
| 04 | `test_04_attach_volume_to_vm` | Hot-attach the ONTAP iSCSI volume to the running VM — a LUN-map is created (TDS SN 27) | test_03 (`vm`, `volume`) | `volume.virtualmachineid == vm.id` | ≥1 LUN-map linking the LUN to the host's igroup | positive |

‎test/integration/plugins/ontap/iscsi/instance/test_vm_volume_attach.py‎

Lines changed: 24 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -404,42 +404,12 @@ def _poll_volume_field(self, vol_id, field, target, timeout=120,
404404
time.sleep(interval)
405405
return None
406406

407-
def _data_lun_name(self, volume=None):
408-
"""
409-
Full ONTAP path of the LUN backing the CloudStack data volume.
410-
411-
UnifiedSANStrategy names the LUN after the CloudStack volume with
412-
hyphens replaced by underscores, inside the pool's FlexVol.
413-
"""
414-
volume = volume or self.__class__.volume
415-
if volume is None or self.__class__.pool is None:
416-
return None
417-
return "/vol/%s/%s" % (self.__class__.pool.name,
418-
volume.name.replace("-", "_"))
419-
420-
def _lun_maps(self, volume=None):
421-
"""
422-
Return LUN-maps belonging to the data volume's LUN only.
423-
424-
The same FlexVol also holds the VM's ROOT LUN whenever the allocator
425-
places the root disk on this pool, so the unfiltered map list is not a
426-
measure of the data volume's accessibility.
427-
"""
428-
lun_name = self._data_lun_name(volume)
429-
if lun_name is None:
430-
return []
431-
return [m for m in self.ontap.list_lun_maps_for_volume(
432-
self.svm_name, self.__class__.pool.name)
433-
if m.get("lun", {}).get("name") == lun_name]
434-
435-
def _data_luns(self, volume=None):
436-
"""Return LUN records for the data volume's LUN only."""
437-
lun_name = self._data_lun_name(volume)
438-
if lun_name is None:
407+
def _lun_maps(self):
408+
"""Return current LUN-maps for the pool's FlexVol."""
409+
if self.__class__.pool is None:
439410
return []
440-
return [lun for lun in self.ontap.list_luns_in_volume(
441-
self.svm_name, self.__class__.pool.name)
442-
if lun.get("name") == lun_name]
411+
return self.ontap.list_lun_maps_for_volume(
412+
self.svm_name, self.__class__.pool.name)
443413

444414
# ==================================================================
445415
# Test steps
@@ -454,7 +424,7 @@ def test_01_create_iscsi_pool(self):
454424
"""
455425
Create an iSCSI primary storage pool on ONTAP.
456426
Verifies:
457-
- Pool reaches 'Up' state; type is 'OntapiSCSI'
427+
- Pool reaches 'Up' state; type is 'Iscsi'
458428
- ONTAP: FlexVol is online
459429
- ONTAP: igroup exists for every host in the cluster that has an IQN
460430
"""
@@ -463,8 +433,8 @@ def test_01_create_iscsi_pool(self):
463433

464434
self.assertEqual(pool.state, "Up",
465435
"Pool state should be 'Up', got '%s'" % pool.state)
466-
self.assertEqual(pool.type, "OntapiSCSI",
467-
"Pool type should be 'OntapiSCSI', got '%s'" % pool.type)
436+
self.assertEqual(pool.type, "Iscsi",
437+
"Pool type should be 'Iscsi', got '%s'" % pool.type)
468438

469439
ontap_vol = self.ontap.get_volume(pool.name)
470440
self.assertIsNotNone(
@@ -492,12 +462,12 @@ def test_02_create_ontap_data_volume(self):
492462
self.__class__.volume = vol
493463
self.assertIsNotNone(vol, "createVolume returned None")
494464

495-
luns = self._data_luns()
465+
luns = self.ontap.list_luns_in_volume(
466+
self.svm_name, self.__class__.pool.name)
496467
self.assertTrue(
497468
len(luns) > 0,
498-
"Expected the data volume's LUN '%s' in ONTAP FlexVol '%s' after "
499-
"volume creation, found none"
500-
% (self._data_lun_name(), self.__class__.pool.name)
469+
"Expected ≥1 LUN in ONTAP FlexVol '%s' after volume creation, "
470+
"found 0" % self.__class__.pool.name
501471
)
502472

503473
# ------------------------------------------------------------------
@@ -541,7 +511,7 @@ def test_03_deploy_vm(self):
541511
lun_maps = self._lun_maps()
542512
self.assertEqual(
543513
len(lun_maps), 0,
544-
"Expected 0 data-volume LUN-maps before volume attach, found %d: %s"
514+
"Expected 0 LUN-maps before volume attach, found %d: %s"
545515
% (len(lun_maps), lun_maps)
546516
)
547517

@@ -620,15 +590,16 @@ def test_05_stop_vm_lun_unmapped(self):
620590
lun_maps = self._lun_maps()
621591
self.assertEqual(
622592
len(lun_maps), 0,
623-
"Expected 0 data-volume LUN-maps after VM stop, found %d: %s"
593+
"Expected 0 LUN-maps after VM stop, found %d: %s"
624594
% (len(lun_maps), lun_maps)
625595
)
626596

627597
# ONTAP: LUN itself must still exist in the FlexVol
628-
luns = self._data_luns()
598+
luns = self.ontap.list_luns_in_volume(
599+
self.svm_name, self.__class__.pool.name)
629600
self.assertTrue(
630601
len(luns) > 0,
631-
"Data volume LUN should still exist in ONTAP FlexVol after VM stop"
602+
"LUN should still exist in ONTAP FlexVol after VM stop"
632603
)
633604

634605
# ------------------------------------------------------------------
@@ -718,15 +689,16 @@ def test_07_detach_volume_from_vm(self):
718689
lun_maps = self._lun_maps()
719690
self.assertEqual(
720691
len(lun_maps), 0,
721-
"Expected 0 data-volume LUN-maps after volume detach, found %d: %s"
692+
"Expected 0 LUN-maps after volume detach, found %d: %s"
722693
% (len(lun_maps), lun_maps)
723694
)
724695

725696
# ONTAP: LUN still exists in FlexVol
726-
luns = self._data_luns()
697+
luns = self.ontap.list_luns_in_volume(
698+
self.svm_name, self.__class__.pool.name)
727699
self.assertTrue(
728700
len(luns) > 0,
729-
"Data volume LUN should still exist in ONTAP FlexVol after detach"
701+
"LUN should still exist in ONTAP FlexVol after detach"
730702
)
731703

732704
# ------------------------------------------------------------------
@@ -779,11 +751,11 @@ def test_08_destroy_vm_and_cleanup(self):
779751
self.__class__.volume = None
780752

781753
# ONTAP: LUN must be removed after volume deletion
782-
luns = self._data_luns(vol)
754+
luns = self.ontap.list_luns_in_volume(self.svm_name, pool_name)
783755
self.assertEqual(
784756
len(luns), 0,
785-
"Expected the data volume's LUN to be gone from FlexVol '%s' "
786-
"after volume delete, found %d" % (pool_name, len(luns))
757+
"Expected 0 LUNs in FlexVol '%s' after volume delete, "
758+
"found %d" % (pool_name, len(luns))
787759
)
788760

789761
# Enter maintenance and force-delete the pool

‎test/integration/plugins/ontap/iscsi/pool/test_pool_lifecycle.py‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ def _assert_pool_capacity(self, pool, label):
276276
def test_01_create_primary_storage_pool(self):
277277
"""
278278
Create an iSCSI primary storage pool and verify:
279-
- CloudStack state is Up, type is OntapiSCSI
279+
- CloudStack state is Up, type is Iscsi
280280
- ONTAP: FlexVol exists and is online
281281
- ONTAP: one igroup per cluster host exists with the correct IQN initiator
282282
"""
@@ -288,8 +288,8 @@ def test_01_create_primary_storage_pool(self):
288288
"Pool state should be 'Up', got '%s'" % pool.state
289289
)
290290
self.assertEqual(
291-
pool.type, "OntapiSCSI",
292-
"Pool type should be 'OntapiSCSI', got '%s'" % pool.type
291+
pool.type, "Iscsi",
292+
"Pool type should be 'Iscsi', got '%s'" % pool.type
293293
)
294294

295295
# ONTAP: FlexVol must be online
@@ -502,7 +502,7 @@ def test_07_create_volume_on_pool(self):
502502
Create a new iSCSI pool and allocate a CloudStack data volume.
503503
For iSCSI, createAsync creates a LUN inside the pool's ONTAP FlexVol.
504504
Verifies:
505-
- pool.state is Up, type is OntapiSCSI
505+
- pool.state is Up, type is Iscsi
506506
- createVolume returns a non-None volume object
507507
- ONTAP: FlexVol is still online
508508
- ONTAP: at least one LUN is present in the FlexVol
@@ -520,8 +520,8 @@ def test_07_create_volume_on_pool(self):
520520
"Pool state should be 'Up', got '%s'" % pool.state
521521
)
522522
self.assertEqual(
523-
pool.type, "OntapiSCSI",
524-
"Pool type should be 'OntapiSCSI', got '%s'" % pool.type
523+
pool.type, "Iscsi",
524+
"Pool type should be 'Iscsi', got '%s'" % pool.type
525525
)
526526

527527
vol = self._create_volume(pool.id)

‎test/integration/plugins/ontap/iscsi/pool/test_pool_with_volumes.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ def test_01_create_pool_and_volume(self):
311311
Create an iSCSI primary storage pool and allocate a CloudStack data
312312
volume on it.
313313
Verifies:
314-
- Pool state is Up; pool type is OntapiSCSI
314+
- Pool state is Up; pool type is Iscsi
315315
- ONTAP: FlexVol is online
316316
- ONTAP: at least one igroup exists (one per cluster host with IQN)
317317
- ONTAP: after createVolume, a LUN exists in the FlexVol
@@ -324,8 +324,8 @@ def test_01_create_pool_and_volume(self):
324324
"Pool state should be 'Up', got '%s'" % pool.state
325325
)
326326
self.assertEqual(
327-
pool.type, "OntapiSCSI",
328-
"Pool type should be 'OntapiSCSI', got '%s'" % pool.type
327+
pool.type, "Iscsi",
328+
"Pool type should be 'Iscsi', got '%s'" % pool.type
329329
)
330330

331331
# ONTAP: FlexVol must be online

‎test/integration/plugins/ontap/iscsi/pool/test_zone_scoped_pool.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ def test_01_create_zone_scoped_pool(self):
249249
CloudStack calls attachZone(), which connects all eligible KVM hosts
250250
in the zone and creates igroups for each host's IQN.
251251
Verifies:
252-
- pool.state is Up, type is OntapiSCSI
252+
- pool.state is Up, type is Iscsi
253253
- ONTAP: FlexVol is online
254254
- ONTAP: igroup exists for each cluster host with the correct IQN
255255
"""
@@ -261,8 +261,8 @@ def test_01_create_zone_scoped_pool(self):
261261
"Pool state should be 'Up', got '%s'" % pool.state
262262
)
263263
self.assertEqual(
264-
pool.type, "OntapiSCSI",
265-
"Pool type should be 'OntapiSCSI', got '%s'" % pool.type
264+
pool.type, "Iscsi",
265+
"Pool type should be 'Iscsi', got '%s'" % pool.type
266266
)
267267

268268
# ONTAP: FlexVol must be online

0 commit comments

Comments
 (0)