def setUp(self): super(ShareGroupTypeTest, self).setUp() self.manager = types.ShareGroupTypeManager(fake.FakeClient()) self.fake_group_specs = {'key1': 'value1', 'key2': 'value2'} self.fake_share_group_type_info = { 'id': fake.ShareGroupType.id, 'share_types': [fake.ShareType.id], 'name': fake.ShareGroupType.name, 'is_public': fake.ShareGroupType.is_public, 'group_specs': self.fake_group_specs, } self.share_group_type = types.ShareGroupType( self.manager, self.fake_share_group_type_info, loaded=True)
def __init__(self, username=None, api_key=None, project_id=None, auth_url=None, insecure=False, timeout=None, tenant_id=None, project_name=None, region_name=None, endpoint_type='publicURL', extensions=None, service_type=constants.V2_SERVICE_TYPE, service_name=None, retries=None, http_log_debug=False, input_auth_token=None, session=None, auth=None, cacert=None, service_catalog_url=None, user_agent='python-manilaclient', use_keyring=False, force_new_token=False, cached_token_lifetime=300, api_version=manilaclient.API_MIN_VERSION, user_id=None, user_domain_id=None, user_domain_name=None, project_domain_id=None, project_domain_name=None, cert=None, password=None, **kwargs): self.username = username self.password = password or api_key self.tenant_id = tenant_id or project_id self.tenant_name = project_name self.user_id = user_id self.project_id = project_id or tenant_id self.project_name = project_name self.user_domain_id = user_domain_id self.user_domain_name = user_domain_name self.project_domain_id = project_domain_id self.project_domain_name = project_domain_name self.endpoint_type = endpoint_type self.auth_url = auth_url self.region_name = region_name self.cacert = cacert self.cert = cert self.insecure = insecure self.use_keyring = use_keyring self.force_new_token = force_new_token self.cached_token_lifetime = cached_token_lifetime service_name = kwargs.get("share_service_name", service_name) if input_auth_token and not service_catalog_url: msg = ("For token-based authentication you should " "provide 'input_auth_token' and 'service_catalog_url'.") raise exceptions.ClientException(msg) self.project_id = tenant_id if tenant_id is not None else project_id self.keystone_client = None self.session = session # NOTE(u_glide): token authorization has highest priority. # That's why session and/or password will be ignored # if token is provided. if not input_auth_token: if session: self.keystone_client = adapter.LegacyJsonAdapter( session=session, auth=auth, interface=endpoint_type, service_type=service_type, service_name=service_name, region_name=region_name) input_auth_token = self.keystone_client.session.get_token(auth) else: self.keystone_client = self._get_keystone_client() input_auth_token = self.keystone_client.auth_token if not input_auth_token: raise RuntimeError("Not Authorized") if session and not service_catalog_url: service_catalog_url = self.keystone_client.session.get_endpoint( auth, interface=endpoint_type, service_type=service_type) elif not service_catalog_url: catalog = self.keystone_client.service_catalog.get_endpoints( service_type) for catalog_entry in catalog.get(service_type, []): if (catalog_entry.get("interface") == (endpoint_type.lower().split("url")[0]) or catalog_entry.get(endpoint_type)): if (region_name and not region_name == (catalog_entry.get( "region", catalog_entry.get("region_id")))): continue service_catalog_url = catalog_entry.get( "url", catalog_entry.get(endpoint_type)) break if not service_catalog_url: raise RuntimeError("Could not find Manila endpoint in catalog") self.api_version = api_version self.client = httpclient.HTTPClient(service_catalog_url, input_auth_token, user_agent, insecure=insecure, cacert=cacert, timeout=timeout, retries=retries, http_log_debug=http_log_debug, api_version=self.api_version) self.availability_zones = availability_zones.AvailabilityZoneManager( self) self.limits = limits.LimitsManager(self) self.messages = messages.MessageManager(self) self.services = services.ServiceManager(self) self.security_services = security_services.SecurityServiceManager(self) self.share_networks = share_networks.ShareNetworkManager(self) self.quota_classes = quota_classes.QuotaClassSetManager(self) self.quotas = quotas.QuotaSetManager(self) self.shares = shares.ShareManager(self) self.share_export_locations = ( share_export_locations.ShareExportLocationManager(self)) self.share_groups = share_groups.ShareGroupManager(self) self.share_group_snapshots = ( share_group_snapshots.ShareGroupSnapshotManager(self)) self.share_group_type_access = ( share_group_type_access.ShareGroupTypeAccessManager(self)) self.share_group_types = share_group_types.ShareGroupTypeManager(self) self.share_instances = share_instances.ShareInstanceManager(self) self.share_instance_export_locations = ( share_instance_export_locations.ShareInstanceExportLocationManager( self)) self.share_snapshots = share_snapshots.ShareSnapshotManager(self) self.share_snapshot_instances = ( share_snapshot_instances.ShareSnapshotInstanceManager(self)) self.share_snapshot_export_locations = ( share_snapshot_export_locations.ShareSnapshotExportLocationManager( self)) self.share_snapshot_instance_export_locations = ( share_snapshot_instance_export_locations. ShareSnapshotInstanceExportLocationManager(self)) self.share_types = share_types.ShareTypeManager(self) self.share_type_access = share_type_access.ShareTypeAccessManager(self) self.share_servers = share_servers.ShareServerManager(self) self.share_replicas = share_replicas.ShareReplicaManager(self) self.pools = scheduler_stats.PoolManager(self) self._load_extensions(extensions)
def setUp(self): super(ShareGroupTypeManagerTest, self).setUp() self.manager = types.ShareGroupTypeManager(fake.FakeClient()) self.fake_group_specs = {'key1': 'value1', 'key2': 'value2'}
} }) share_type_alt = share_types.ShareType( share_types.ShareTypeManager(FakeAPIClient), { 'id': 'share-type-id4', 'name': 'test-share-type4', 'share_type_access:is_public': True, 'extra_specs': { 'snapshot_support': True, 'driver_handles_share_servers': False } }) share_group_type = share_group_types.ShareGroupType( share_group_types.ShareGroupTypeManager(FakeAPIClient), { 'id': 'fake_share_group_type_id1', 'name': 'fake_share_group_type_name', 'share_types': [share_type.id], 'group_specs': { 'k1': 'v1', 'k2': 'v2' }, 'is_public': True }) share_group_type_private = share_group_types.ShareGroupType( share_group_types.ShareGroupTypeManager(FakeAPIClient), { 'id': 'fake_private_share_group_type_id2', 'name': 'fake_private_share_group_type_name', 'share_types': [share_type.id, share_type_private.id],