def resource_setup(cls): cls.set_network_resources() super(ShareScenarioTest, cls).resource_setup() os = clients_share.Manager(credentials=cls.credentials()) # Manila clients cls.shares_client = os.shares_client cls.shares_admin_client = clients_share.AdminManager().shares_client
def setUpClass(cls): if not (any(p in CONF.share.enable_protocols for p in cls.protocols) and CONF.service_available.manila): skip_msg = "Manila is disabled" raise cls.skipException(skip_msg) super(BaseSharesTest, cls).setUpClass() if not hasattr(cls, "os"): cls.username = CONF.identity.username cls.password = CONF.identity.password cls.tenant_name = CONF.identity.tenant_name cls.verify_nonempty(cls.username, cls.password, cls.tenant_name) cls.os = clients.Manager(interface=cls._interface) if CONF.share.multitenancy_enabled: if not CONF.service_available.neutron: raise cls.skipException("Neutron support is required") sc = cls.os.shares_client nc = cls.os.network_client share_network_id = cls.provide_share_network(sc, nc) cls.os.shares_client.share_network_id = share_network_id cls.shares_client = cls.os.shares_client
def setUpClass(cls): super(ServicesAdminNegativeTest, cls).setUpClass() user_clients = clients.Manager(interface=cls._interface) cls.user_shares_client = user_clients.shares_client
def setUpClass(cls): super(ExtraSpecsAdminNegativeTest, cls).setUpClass() cls.member_shares_client = clients.Manager().shares_client
def get_client_with_isolated_creds(cls, name=None, type_of_creds="admin", cleanup_in_class=False): """Creates isolated creds. :param name: name, will be used for naming ic and related stuff :param type_of_creds: admin, alt or primary :param cleanup_in_class: defines place where to delete :returns: SharesClient -- shares client with isolated creds. :returns: To client added dict attr 'creds' with :returns: key elements 'tenant' and 'user'. """ if name is None: # Get name of test method name = inspect.stack()[1][3] if len(name) > 32: name = name[0:32] # Choose type of isolated creds ic = isolated_creds.IsolatedCreds(name=name) if "admin" in type_of_creds: creds = ic.get_admin_creds() elif "alt" in type_of_creds: creds = ic.get_alt_creds() else: creds = ic.self.get_credentials(type_of_creds) ic.type_of_creds = type_of_creds # create client with isolated creds os = clients.Manager(credentials=creds) client = os.shares_client # Get tenant and user identity_client = cls._get_identity_admin_client() client.creds = {} client.creds["tenant"] = identity_client.get_tenant_by_name( client.auth_params["tenant"]) client.creds["user"] = identity_client.get_user_by_username( client.creds["tenant"]["id"], client.auth_params["user"]) # Set place where will be deleted isolated creds ic_res = { "method": ic.clear_isolated_creds, "deleted": False, } if cleanup_in_class: cls.class_isolated_creds.insert(0, ic_res) else: cls.method_isolated_creds.insert(0, ic_res) # Provide share network if CONF.share.multitenancy_enabled: if not CONF.service_available.neutron: raise cls.skipException("Neutron support is required") nc = os.network_client share_network_id = cls.provide_share_network(client, nc, ic) client.share_network_id = share_network_id resource = { "type": "share_network", "id": client.share_network_id, "client": client, } if cleanup_in_class: cls.class_resources.insert(0, resource) else: cls.method_resources.insert(0, resource) return client
def resource_setup(cls): super(ExtraSpecsAdminNegativeTest, cls).resource_setup() cls.member_shares_client = clients.Manager().shares_client
def resource_setup(cls): super(ShareServersNegativeAdminTest, cls).resource_setup() cls.member_shares_client = clients.Manager().shares_client
def resource_setup(cls): super(AdminActionsNegativeTest, cls).resource_setup() cls.sh = cls.create_share() cls.sn = cls.create_snapshot_wait_for_active(cls.sh["id"]) cls.member_shares_client = clients.Manager().shares_client
def setUpClass(cls): super(ShareServersNegativeAdminTest, cls).setUpClass() cls.member_shares_client = clients.Manager().shares_client
def setUpClass(cls): super(VolumeTypesAdminNegativeTest, cls).setUpClass() cls.member_shares_client = clients.Manager().shares_client
def resource_setup(cls): super(ServicesAdminNegativeTest, cls).resource_setup() user_clients = clients.Manager() cls.user_shares_client = user_clients.shares_client
def setUpClass(cls): super(AdminActionsNegativeTest, cls).setUpClass() __, cls.sh = cls.create_share() __, cls.sn = cls.create_snapshot_wait_for_active(cls.sh["id"]) cls.member_shares_client = clients.Manager().shares_client