@@ -60,28 +60,22 @@ def setUp(self):
6060 return
6161
6262 def tearDown (self ):
63- try :
64- # Clean up, terminate the created templates
65- cleanup_resources (self .apiclient , self .cleanup )
66-
67- except Exception as e :
68- raise Exception ("Warning: Exception during cleanup : %s" % e )
69- return
63+ super (TestPrimaryStorageServices , self ).tearDown ()
7064
7165 @attr (tags = ["advanced" , "advancedns" , "smoke" , "basic" , "sg" ], required_hardware = "false" )
7266 def test_01_primary_storage_nfs (self ):
7367 """Test primary storage pools - XEN, KVM, VMWare. Not Supported for hyperv
68+
69+ Validate the following:
70+ 1. List Clusters
71+ 2. verify that the cluster is in 'Enabled' allocation state
72+ 3. verify that the host is added successfully and
73+ in Up state with listHosts api response
7474 """
7575
7676 if self .hypervisor .lower () in ["hyperv" ]:
7777 raise self .skipTest ("NFS primary storage not supported for Hyper-V" )
7878
79- # Validate the following:
80- # 1. List Clusters
81- # 2. verify that the cluster is in 'Enabled' allocation state
82- # 3. verify that the host is added successfully and
83- # in Up state with listHosts api response
84-
8579 # Create NFS storage pools with on XEN/KVM/VMWare clusters
8680
8781 clusters = list_clusters (
@@ -156,14 +150,17 @@ def test_01_primary_storage_nfs(self):
156150 storage_response .type ,
157151 "Check storage pool type "
158152 )
159- # Call cleanup for reusing primary storage
160- cleanup_resources (self .apiclient , self .cleanup )
161- self .cleanup = []
162153 return
163154
164155 @attr (tags = ["advanced" , "advancedns" , "smoke" , "basic" , "sg" ], required_hardware = "true" )
165156 def test_01_primary_storage_iscsi (self ):
166157 """Test primary storage pools - XEN. Not Supported for kvm,hyperv,vmware
158+
159+ Validate the following:
160+ 1. List Clusters
161+ 2. verify that the cluster is in 'Enabled' allocation state
162+ 3. verify that the host is added successfully and
163+ in Up state with listHosts api response
167164 """
168165
169166 if self .hypervisor .lower () in ["kvm" , "hyperv" , "vmware" , "lxc" ]:
@@ -172,12 +169,6 @@ def test_01_primary_storage_iscsi(self):
172169 if not self .services ["configurableData" ]["iscsi" ]["url" ]:
173170 raise self .skipTest ("iscsi test storage url not setup, skipping" )
174171
175- # Validate the following:
176- # 1. List Clusters
177- # 2. verify that the cluster is in 'Enabled' allocation state
178- # 3. verify that the host is added successfully and
179- # in Up state with listHosts api response
180-
181172 # Create iSCSI storage pools with on XEN/KVM clusters
182173 clusters = list_clusters (
183174 self .apiclient ,
@@ -251,10 +242,6 @@ def test_01_primary_storage_iscsi(self):
251242 storage_response .type ,
252243 "Check storage pool type "
253244 )
254- # Call cleanup for reusing primary storage
255- cleanup_resources (self .apiclient , self .cleanup )
256- self .cleanup = []
257-
258245 return
259246
260247 @attr (tags = ["advanced" , "advancedns" , "smoke" , "basic" , "sg" ], required_hardware = "false" )
@@ -293,7 +280,7 @@ def test_01_add_primary_storage_disabled_host(self):
293280 zoneid = self .zone .id ,
294281 podid = self .pod .id
295282 )
296- # self.cleanup.append(storage_pool_2)
283+ self .cleanup .append (storage_pool_2 )
297284
298285 # Enable host and disable others
299286 Host .update (self .apiclient , id = selected_host .id , allocationstate = "Enable" )
@@ -319,6 +306,7 @@ def test_01_add_primary_storage_disabled_host(self):
319306 self .services ["account" ],
320307 domainid = self .domain .id
321308 )
309+ self .cleanup .append (account )
322310
323311 service_offering = ServiceOffering .create (
324312 self .apiclient ,
@@ -336,7 +324,6 @@ def test_01_add_primary_storage_disabled_host(self):
336324 serviceofferingid = service_offering .id
337325 )
338326 self .cleanup .append (self .virtual_machine )
339- self .cleanup .append (account )
340327 finally :
341328 # cancel maintenance
342329 for pool in storage_pool_list :
@@ -351,14 +338,13 @@ def test_01_add_primary_storage_disabled_host(self):
351338 continue
352339 Host .update (self .apiclient , id = host .id , allocationstate = "Enable" )
353340
354- cleanup_resources (self .apiclient , self .cleanup )
355- self .cleanup = []
356341 StoragePool .enableMaintenance (self .apiclient , storage_pool_2 .id )
357342 time .sleep (30 );
358343 cmd = deleteStoragePool .deleteStoragePoolCmd ()
359344 cmd .id = storage_pool_2 .id
360345 cmd .forced = True
361346 self .apiclient .deleteStoragePool (cmd )
347+ self .cleanup .remove (storage_pool_2 )
362348
363349 return
364350
0 commit comments