def resource_setup(cls): super(ReplicationAdminTest, cls).resource_setup() cls.admin_client = cls.admin_shares_v2_client cls.member_client = cls.shares_v2_client 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 ) cls.zones = cls.get_availability_zones(client=cls.admin_client) cls.share_zone = cls.zones[0] cls.replica_zone = cls.zones[-1] # create share type extra_specs = {"replication_type": cls.replication_type} cls.share_type = cls._create_share_type(extra_specs) cls.share_type_id = cls.share_type['id'] # create share cls.share = cls.create_share(size=CONF.share.share_size + 1, share_type_id=cls.share_type_id, availability_zone=cls.share_zone, client=cls.admin_client) cls.replica = cls.admin_client.list_share_replicas( share_id=cls.share['id'])[0]
def test_only_host_scheduler_hint_in_share_replica_creation(self): replication_type = CONF.share.backend_replication_type if replication_type not in constants.REPLICATION_TYPE_CHOICES: raise share_exceptions.ShareReplicationTypeException( replication_type=replication_type) extra_specs = self.add_extra_specs_to_dict( {"replication_type": replication_type}) replicated_share_type = self.create_share_type( data_utils.rand_name("replicated-shares"), extra_specs=extra_specs) share = self.create_share(share_type_id=replicated_share_type['id'], cleanup_in_class=False) share = self.admin_shares_v2_client.get_share(share['id'])['share'] share_host = share['host'] rep_domain, pools = self.get_pools_for_replication_domain(share=share) if len(pools) < 2: msg = ("Can not create valid hint due to insufficient pools.") raise self.skipException(msg) for p in pools: if p['name'] != share_host: expected_replica_host = p['name'] scheduler_hint = {"only_host": "%s" % expected_replica_host} break # create share replica with hint replica = self.create_share_replica(share['id'], cleanup_in_class=False, version=LATEST_MICROVERSION, scheduler_hints=scheduler_hint) replica = self.admin_shares_v2_client.get_share_replica( replica['id'])['share_replica'] replica_host = replica['host'] # verify same backends self.assertEqual(expected_replica_host, replica_host)
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() # 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 if cls.replication_type not in constants.REPLICATION_TYPE_CHOICES: raise share_exceptions.ShareReplicationTypeException( replication_type=cls.replication_type) cls.zones = cls.get_availability_zones(client=cls.admin_client) cls.share_zone = cls.zones[0] cls.replica_zone = cls.zones[-1] cls.extra_specs = cls.add_extra_specs_to_dict( {"replication_type": cls.replication_type}) share_type = cls.create_share_type(name, extra_specs=cls.extra_specs, client=cls.admin_client) cls.share_type = share_type["share_type"] # Create share with above share_type cls.creation_data = { 'kwargs': { 'share_type_id': cls.share_type['id'], 'availability_zone': cls.share_zone, } }
def resource_setup(cls): super(ReplicationAdminTest, cls).resource_setup() # Create share_type name = data_utils.rand_name(constants.TEMPEST_MANILA_PREFIX) cls.admin_client = cls.admin_shares_v2_client cls.member_client = cls.shares_v2_client 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) cls.zones = cls.get_availability_zones(client=cls.admin_client) cls.share_zone = cls.zones[0] cls.replica_zone = cls.zones[-1] cls.extra_specs = cls.add_required_extra_specs_to_dict( {"replication_type": cls.replication_type}) share_type = cls.create_share_type(name, cleanup_in_class=True, extra_specs=cls.extra_specs, client=cls.admin_client) cls.share_type = share_type["share_type"] # Create share with above share_type cls.share = cls.create_share(size=2, share_type_id=cls.share_type["id"], availability_zone=cls.share_zone, client=cls.admin_client) cls.replica = cls.admin_client.list_share_replicas( share_id=cls.share['id'])[0]
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(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(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)
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 if cls.replication_type not in constants.REPLICATION_TYPE_CHOICES: raise share_exceptions.ShareReplicationTypeException( replication_type=cls.replication_type) cls.zones = cls.get_availability_zones(client=cls.admin_client) cls.share_zone = cls.zones[0] cls.replica_zone = cls.zones[-1] cls.extra_specs = cls.add_extra_specs_to_dict( {"replication_type": cls.replication_type}) share_type = cls.create_share_type(name, extra_specs=cls.extra_specs, client=cls.admin_client) cls.share_type = share_type["share_type"] # Create share with above share_type cls.creation_data = { 'kwargs': { 'share_type_id': cls.share_type['id'], 'availability_zone': cls.share_zone, } } # 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']) 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)
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 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) cls.share_type_id = cls.share_type['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(ReplicationNegativeTest, cls).resource_setup() cls.admin_client = cls.admin_shares_v2_client 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 ) cls.zones = cls.get_availability_zones(client=cls.admin_client) cls.share_zone = cls.zones[0] cls.replica_zone = cls.zones[-1] # create share type extra_specs = {"replication_type": cls.replication_type} cls.share_type = cls._create_share_type(extra_specs) cls.share_type_id = cls.share_type['id'] # create share with above share_type cls.share1, cls.instance_id1 = cls._create_share_get_instance()
def resource_setup(cls): super(ReplicationExportLocationsTest, 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 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}) share_type = cls.create_share_type(name, extra_specs=cls.extra_specs, client=cls.admin_client) cls.share_type = share_type["share_type"] 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(ReplicationNegativeTest, cls).resource_setup() # Create share_type name = data_utils.rand_name(constants.TEMPEST_MANILA_PREFIX) cls.admin_client = clients.AdminManager().shares_v2_client 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) cls.zones = cls.get_availability_zones(client=cls.admin_client) cls.share_zone = cls.zones[0] cls.replica_zone = cls.zones[-1] cls.extra_specs = cls.add_required_extra_specs_to_dict( {"replication_type": cls.replication_type}) share_type = cls.create_share_type(name, extra_specs=cls.extra_specs, client=cls.admin_client) cls.share_type = share_type["share_type"] # Create share with above share_type cls.share1, cls.instance_id1 = cls._create_share_get_instance()