def resource_setup(cls): super(ReplicationExportLocationsNegativeTest, cls).resource_setup() # Create share_type name = data_utils.rand_name(constants.TEMPEST_MANILA_PREFIX) cls.admin_client = cls.admin_shares_v2_client cls.replication_type = CONF.share.backend_replication_type cls.multitenancy_enabled = ( utils.replication_with_multitenancy_support()) if cls.replication_type not in constants.REPLICATION_TYPE_CHOICES: raise share_exceptions.ShareReplicationTypeException( replication_type=cls.replication_type ) cls.extra_specs = cls.add_extra_specs_to_dict( {"replication_type": cls.replication_type}) cls.share_type = cls.create_share_type( name, extra_specs=cls.extra_specs, client=cls.admin_client) cls.sn_id = None if cls.multitenancy_enabled: cls.share_network = cls.shares_v2_client.get_share_network( cls.shares_v2_client.share_network_id)['share_network'] cls.sn_id = cls.share_network['id'] cls.zones = cls.get_availability_zones_matching_share_type( cls.share_type) cls.share_zone = cls.zones[0] cls.replica_zone = cls.zones[-1]
def resource_setup(cls): super(ReplicationSnapshotTest, cls).resource_setup() cls.admin_client = cls.admin_shares_v2_client cls.replication_type = CONF.share.backend_replication_type cls.multitenancy_enabled = ( utils.replication_with_multitenancy_support()) if cls.replication_type not in constants.REPLICATION_TYPE_CHOICES: raise share_exceptions.ShareReplicationTypeException( replication_type=cls.replication_type) # create share type extra_specs = { "replication_type": cls.replication_type, "snapshot_support": True, } if CONF.share.capability_create_share_from_snapshot_support: extra_specs.update({ "create_share_from_snapshot_support": True, }) cls.share_type = cls.create_share_type(extra_specs=extra_specs) cls.share_type_id = cls.share_type['id'] cls.sn_id = None if cls.multitenancy_enabled: cls.share_network = cls.shares_v2_client.get_share_network( cls.shares_v2_client.share_network_id)['share_network'] cls.sn_id = cls.share_network['id'] cls.zones = cls.get_availability_zones_matching_share_type( cls.share_type, client=cls.admin_client) cls.share_zone = cls.zones[0] cls.replica_zone = cls.zones[-1]
def resource_setup(cls): super(ReplicationNegativeBase, cls).resource_setup() cls.admin_client = cls.admin_shares_v2_client cls.replication_type = CONF.share.backend_replication_type cls.multitenancy_enabled = ( utils.replication_with_multitenancy_support()) if cls.replication_type not in constants.REPLICATION_TYPE_CHOICES: raise share_exceptions.ShareReplicationTypeException( replication_type=cls.replication_type) # create share type extra_specs = {"replication_type": cls.replication_type} cls.share_type = cls.create_share_type(extra_specs=extra_specs) cls.share_type_id = cls.share_type['id'] cls.sn_id = None if cls.multitenancy_enabled: cls.share_network = cls.shares_v2_client.get_share_network( cls.shares_v2_client.share_network_id)['share_network'] cls.sn_id = cls.share_network['id'] cls.zones = cls.get_availability_zones_matching_share_type( cls.share_type, client=cls.admin_client) cls.share_zone = cls.zones[0] cls.replica_zone = cls.zones[-1] # create share with above share_type cls.share1, cls.instance_id1 = cls._create_share_get_instance()
def resource_setup(cls): super(RevertToSnapshotTest, cls).resource_setup() cls.admin_client = cls.admin_shares_v2_client cls.replication_multitenancy = ( utils.replication_with_multitenancy_support()) pools = cls.admin_client.list_pools(detail=True)['pools'] revert_support = [ pool['capabilities'][constants.REVERT_TO_SNAPSHOT_SUPPORT] for pool in pools ] if not any(revert_support): msg = "Revert to snapshot not supported." raise cls.skipException(msg) cls.share_type_name = data_utils.rand_name("share-type") extra_specs = { "snapshot_support": True, constants.REVERT_TO_SNAPSHOT_SUPPORT: True, } cls.revert_enabled_extra_specs = cls.add_extra_specs_to_dict( extra_specs=extra_specs) cls.share_type = cls.create_share_type( cls.share_type_name, extra_specs=cls.revert_enabled_extra_specs, client=cls.admin_client) cls.st_id = cls.share_type['id'] cls.share = cls.create_share(share_type_id=cls.st_id) if CONF.share.run_replication_tests: # Create replicated share type cls.replicated_share_type_name = data_utils.rand_name("share-type") cls.replication_type = CONF.share.backend_replication_type if cls.replication_type not in constants.REPLICATION_TYPE_CHOICES: raise share_exceptions.ShareReplicationTypeException( replication_type=cls.replication_type) extra_specs = cls.add_extra_specs_to_dict({ "replication_type": cls.replication_type, "snapshot_support": True, constants.REVERT_TO_SNAPSHOT_SUPPORT: True, }) cls.replicated_share_type = cls.create_share_type( cls.replicated_share_type_name, extra_specs=extra_specs, client=cls.admin_client) cls.zones = cls.get_availability_zones_matching_share_type( cls.replicated_share_type, client=cls.admin_client) cls.share_zone = cls.zones[0] cls.replica_zone = cls.zones[-1] cls.sn_id = None if cls.replication_multitenancy: cls.share_network = cls.shares_v2_client.get_share_network( cls.shares_v2_client.share_network_id)['share_network'] cls.sn_id = cls.share_network['id']
def resource_setup(cls): super(ReplicationActionsTest, cls).resource_setup() # Create share_type name = data_utils.rand_name(constants.TEMPEST_MANILA_PREFIX) cls.admin_client = cls.admin_shares_v2_client cls.replication_type = CONF.share.backend_replication_type cls.multitenancy_enabled = ( utils.replication_with_multitenancy_support()) if cls.replication_type not in constants.REPLICATION_TYPE_CHOICES: raise share_exceptions.ShareReplicationTypeException( replication_type=cls.replication_type) cls.extra_specs = cls.add_extra_specs_to_dict( {"replication_type": cls.replication_type}) cls.share_type = cls.create_share_type(name, extra_specs=cls.extra_specs, client=cls.admin_client) cls.zones = cls.get_availability_zones_matching_share_type( cls.share_type, client=cls.admin_client) cls.share_zone = cls.zones[0] cls.replica_zone = cls.zones[-1] # Create share with above share_type cls.creation_data = { 'kwargs': { 'share_type_id': cls.share_type['id'], 'availability_zone': cls.share_zone, } } if cls.multitenancy_enabled: cls.share_network = cls.shares_v2_client.get_share_network( cls.shares_v2_client.share_network_id)['share_network'] cls.creation_data['kwargs'].update( {'share_network_id': cls.share_network['id']}) cls.sn_id = (cls.share_network['id'] if cls.multitenancy_enabled else None) # Data for creating shares in parallel data = [cls.creation_data, cls.creation_data] cls.shares = cls.create_shares(data) cls.shares = [ cls.shares_v2_client.get_share(s['id'])['share'] for s in cls.shares ] cls.instance_id1 = cls._get_instance(cls.shares[0]) cls.instance_id2 = cls._get_instance(cls.shares[1]) # Create replicas to 2 shares cls.replica1 = cls.create_share_replica(cls.shares[0]["id"], cls.replica_zone, cleanup_in_class=True) cls.replica2 = cls.create_share_replica(cls.shares[1]["id"], cls.replica_zone, cleanup_in_class=True)