def resource_setup(cls):
     super(AdminActionsNegativeTest, cls).resource_setup()
     cls.sh = cls.create_share()
     cls.sh_instance = (cls.shares_v2_client.get_instances_of_share(
         cls.sh["id"])[0])
     if CONF.share.run_snapshot_tests:
         cls.sn = cls.create_snapshot_wait_for_active(cls.sh["id"])
     cls.member_shares_client = clients.Manager().shares_client
     cls.member_shares_v2_client = clients.Manager().shares_v2_client
Ejemplo n.º 2
0
    def resource_setup(cls):
        cls.set_network_resources()
        super(ShareScenarioTest, cls).resource_setup()

        # Manila clients
        cls.shares_client = clients_share.Manager().shares_client
        cls.shares_v2_client = clients_share.Manager().shares_v2_client
        cls.shares_admin_client = clients_share.AdminManager().shares_client
        cls.shares_admin_v2_client = (
            clients_share.AdminManager().shares_v2_client)
Ejemplo n.º 3
0
 def resource_setup(cls):
     super(ExportLocationsTest, cls).resource_setup()
     cls.admin_client = cls.shares_v2_client
     cls.member_client = clients.Manager().shares_v2_client
     cls.share = cls.create_share()
     cls.share = cls.shares_v2_client.get_share(cls.share['id'])
     cls.share_instances = cls.shares_v2_client.get_instances_of_share(
         cls.share['id'])
Ejemplo n.º 4
0
 def resource_setup(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).resource_setup()
     if not hasattr(cls, "os"):
         cls.username = CONF.identity.username
         cls.password = CONF.identity.password
         cls.project_name = CONF.identity.project_name
         cls.verify_nonempty(cls.username, cls.password, cls.project_name)
         cls.os = clients.Manager()
     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.networks_client
         share_network_id = cls.provide_share_network(sc, nc)
         cls.os.shares_client.share_network_id = share_network_id
         cls.os.shares_v2_client.share_network_id = share_network_id
     cls.shares_client = cls.os.shares_client
     cls.shares_v2_client = cls.os.shares_v2_client
Ejemplo n.º 5
0
    def get_client_with_isolated_creds(cls,
                                       name=None,
                                       type_of_creds="admin",
                                       cleanup_in_class=False,
                                       client_version='1'):
        """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 = dynamic_creds.DynamicCredentialProvider(
            identity_version=CONF.identity.auth_version,
            name=name,
            admin_role=CONF.identity.admin_role,
            admin_creds=common_creds.get_configured_credentials(
                'identity_admin'))
        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)
        if client_version == '1':
            client = os.shares_client
        elif client_version == '2':
            client = os.shares_v2_client

        # Set place where will be deleted isolated creds
        ic_res = {
            "method": ic.clear_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.networks_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
Ejemplo n.º 7
0
 def resource_setup(cls):
     super(ShareServersNegativeAdminTest, cls).resource_setup()
     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