Ejemplo n.º 1
0
    def __init__(self,
                 api_url,
                 username,
                 password,
                 verify_ssl=False,
                 debugLevel=None):
        """
        Initializes the class

        :param api_url: Base URL for the API.  Often the MDM host.
        :type api_url: str
        :param username: Username to login with
        :type username: str
        :param password: Password
        :type password: str
        :return: A ScaleIO object
        :rtype: ScaleIO Object
        """

        logging.basicConfig(
            format=
            '%(asctime)s: %(levelname)s %(module)s:%(funcName)s | %(message)s',
            level=self._get_log_level(debugLevel))
        self.logger = logging.getLogger(__name__)
        self.logger.debug("Logger initialized!")

        # Feature group init

        # API -> Connection
        self.connection = Connection(self,
                                     api_url,
                                     username,
                                     password,
                                     verify_ssl=False,
                                     debugLevel=None)
        self.connection._check_login(
        )  # Login. Otherwise login is called upon first API operation
        # API -> Statistics
        self.statistics = Statistics(self)
        self.provisioning = Volume(self)
        # API -> cluster level
        self.cluster = Cluster(self)
        self.cluster_sp = StoragePool(self)
        self.cluster_pd = ProtectionDomain(self)
        self.cluster_sds = Sds(self)
        self.cluster_sdc = Sdc(self)

        self.faultset = FaultSet(self)