def setUpClass(cls): super(VolumeTypesTest, cls).setUpClass() adm_user = cls.config.identity.admin_username adm_pass = cls.config.identity.admin_password adm_tenant = cls.config.identity.admin_tenant_name auth_url = cls.config.identity.uri cls.client = volume_types_client.VolumeTypesClientJSON( cls.config, adm_user, adm_pass, auth_url, adm_tenant)
def setUpClass(cls): super(VolumeMultiBackendTest, cls).setUpClass() adm_user = cls.config.identity.admin_username adm_pass = cls.config.identity.admin_password adm_tenant = cls.config.identity.admin_tenant_name auth_url = cls.config.identity.uri cls.client = volumes_client.VolumesClientJSON(cls.config, adm_user, adm_pass, auth_url, adm_tenant) cls.client2 = volume_types_client.VolumeTypesClientJSON(cls.config, adm_user, adm_pass, auth_url, adm_tenant) ## variables initialization type_name1 = rand_name('type-') type_name2 = rand_name('type-') cls.volume_type_list = [] vol_name1 = rand_name('Volume-') vol_name2 = rand_name('Volume-') cls.volume_id_list = [] try: ## Volume types creation extra_specs1 = {"volume_backend_name": cls.backend1_name} resp, cls.body1 = cls.client2.create_volume_type( type_name1, extra_specs=extra_specs1) cls.volume_type_list.append(cls.body1) extra_specs2 = {"volume_backend_name": cls.backend2_name} resp, cls.body2 = cls.client2.create_volume_type( type_name2, extra_specs=extra_specs2) cls.volume_type_list.append(cls.body2) ## Volumes creation resp, cls.volume1 = cls.client.create_volume( size=1, display_name=vol_name1, volume_type=type_name1) cls.client.wait_for_volume_status(cls.volume1['id'], 'available') cls.volume_id_list.append(cls.volume1['id']) resp, cls.volume2 = cls.client.create_volume( size=1, display_name=vol_name2, volume_type=type_name2) cls.client.wait_for_volume_status(cls.volume2['id'], 'available') cls.volume_id_list.append(cls.volume2['id']) except Exception: LOG.exception("setup failed") cls.tearDownClass() raise
def setUpClass(cls): super(VolumeMultiBackendTest, cls).setUpClass() if not CONF.volume_feature_enabled.multi_backend: cls.tearDownClass() raise cls.skipException("Cinder multi-backend feature disabled") cls.backend1_name = CONF.volume.backend1_name cls.backend2_name = CONF.volume.backend2_name adm_user = CONF.identity.admin_username adm_pass = CONF.identity.admin_password adm_tenant = CONF.identity.admin_tenant_name auth_url = CONF.identity.uri cls.volume_client = volumes_client.VolumesClientJSON( adm_user, adm_pass, auth_url, adm_tenant) cls.type_client = volume_types_client.VolumeTypesClientJSON( adm_user, adm_pass, auth_url, adm_tenant) cls.volume_type_id_list = [] cls.volume_id_list = [] try: # Volume/Type creation (uses backend1_name) type1_name = data_utils.rand_name('Type-') vol1_name = data_utils.rand_name('Volume-') extra_specs1 = {"volume_backend_name": cls.backend1_name} resp, cls.type1 = cls.type_client.create_volume_type( type1_name, extra_specs=extra_specs1) cls.volume_type_id_list.append(cls.type1['id']) resp, cls.volume1 = cls.volume_client.create_volume( size=1, display_name=vol1_name, volume_type=type1_name) cls.volume_id_list.append(cls.volume1['id']) cls.volume_client.wait_for_volume_status(cls.volume1['id'], 'available') if cls.backend1_name != cls.backend2_name: # Volume/Type creation (uses backend2_name) type2_name = data_utils.rand_name('Type-') vol2_name = data_utils.rand_name('Volume-') extra_specs2 = {"volume_backend_name": cls.backend2_name} resp, cls.type2 = cls.type_client.create_volume_type( type2_name, extra_specs=extra_specs2) cls.volume_type_id_list.append(cls.type2['id']) resp, cls.volume2 = cls.volume_client.create_volume( size=1, display_name=vol2_name, volume_type=type2_name) cls.volume_id_list.append(cls.volume2['id']) cls.volume_client.wait_for_volume_status( cls.volume2['id'], 'available') except Exception as e: LOG.exception("setup failed: %s" % e) cls.tearDownClass() raise