@@ -32,46 +32,48 @@ def setUp(self):
3232 self .apiclient = self .testClient .getApiClient ()
3333 self .dbclient = self .testClient .getDbConnection ()
3434 self .services = self .testClient .getParsedTestDataConfig ()
35- self ._cleanup = []
35+ self .cleanup = []
3636 self .zone = get_zone (self .apiclient , self .testClient .getZoneForTests ())
3737 self .pod = get_pod (self .apiclient , self .zone .id )
38- self .debug ("here" )
3938 self .debug (self .services )
4039 self .cluster1 = list_clusters (self .apiclient )[0 ]
41- self .debug ("here1" )
4240 self .debug (self .cluster1 )
41+ if (self .cluster1 == None ):
42+ cloudstackTestCase .skipTest (self , "Cluster not found. Skipping test." )
43+ if (self .cluster1 .hypervisortype not in ['KVM' , 'VMware' , 'Simulator' ]):
44+ cloudstackTestCase .skipTest (self , "Supported hypervisors (KVM, VMware, Simulator) not found. Skipping test." )
4345 self .cluster = {
4446 'clustername' : 'C0_testScope' ,
4547 'clustertype' : 'CloudManaged'
4648 }
49+ return
50+
51+ def tearDown (self ):
52+ super (TestPrimaryStorageScope , self ).tearDown ()
53+
54+ @attr (tags = ["advanced" , "advancedns" , "smoke" , "basic" , "sg" ], required_hardware = "true" )
55+ def test_01_primary_storage_scope_change (self ):
56+ """Test primary storage pool scope change
57+ """
58+
59+ # Create cluster
4760 self .cluster2 = Cluster .create (self .apiclient ,
4861 self .cluster ,
4962 zoneid = self .zone .id ,
5063 podid = self .pod .id ,
5164 hypervisor = self .cluster1 .hypervisortype
5265 )
53- self ._cleanup .append (self .cluster2 )
66+ self .cleanup .append (self .cluster2 )
67+
68+ # Create zone-wide storage pool
5469 self .storage = StoragePool .create (self .apiclient ,
5570 self .services ["nfs" ],
5671 scope = 'ZONE' ,
5772 zoneid = self .zone .id ,
5873 hypervisor = self .cluster1 .hypervisortype
5974 )
60- self ._cleanup .append (self .storage )
75+ self .cleanup .append (self .storage )
6176 self .debug ("Created storage pool %s in zone scope" , self .storage .id )
62- return
63-
64- def tearDown (self ):
65- try :
66- cleanup_resources (self .apiclient , self ._cleanup )
67- except Exception as e :
68- raise Exception ("Warning: Exception during cleanup : %s" % e )
69- return
70-
71- @attr (tags = ["advanced" , "advancedns" , "smoke" , "basic" , "sg" ], required_hardware = "true" )
72- def test_01_primary_storage_scope_change (self ):
73- """Test primary storage pool scope change
74- """
7577
7678 # Disable storage pool
7779 cmd = updateStoragePool .updateStoragePoolCmd ()
0 commit comments