def do_setup(self, context): """Driver initialization""" if infinisdk is None: msg = _("Missing 'infinisdk' python module, ensure the library" " is installed and available.") raise exception.VolumeDriverException(message=msg) auth = (self.configuration.san_login, self.configuration.san_password) self.management_address = self.configuration.san_ip self._system = infinisdk.InfiniBox(self.management_address, auth=auth) self._system.login() backend_name = self.configuration.safe_get('volume_backend_name') self._backend_name = backend_name or self.__class__.__name__ self._volume_stats = None if self.configuration.infinidat_storage_protocol.lower() == 'iscsi': self._protocol = 'iSCSI' if len(self.configuration.infinidat_iscsi_netspaces) == 0: msg = _('No iSCSI network spaces configured') raise exception.VolumeDriverException(message=msg) else: self._protocol = 'FC' if (self.configuration.infinidat_use_compression and not self._system.compat.has_compression()): # InfiniBox systems support compression only from v3.0 and up msg = _('InfiniBox system does not support volume compression.\n' 'Compression is available on InfiniBox 3.0 onward.\n' 'Please disable volume compression by setting ' 'infinidat_use_compression to False in the Cinder ' 'configuration file.') raise exception.VolumeDriverException(message=msg) LOG.debug('setup complete')
def do_setup(self, context): """Driver initialization""" if infinisdk is None: msg = _("Missing 'infinisdk' python module, ensure the library" " is installed and available.") raise exception.ManilaException(message=msg) infinibox_login = self._safe_get_from_config_or_fail('infinibox_login') infinibox_password = ( self._safe_get_from_config_or_fail('infinibox_password')) auth = (infinibox_login, infinibox_password) self.management_address = ( self._safe_get_from_config_or_fail('infinibox_hostname')) self._pool_name = ( self._safe_get_from_config_or_fail('infinidat_pool_name')) self._network_space_name = (self._safe_get_from_config_or_fail( 'infinidat_nas_network_space_name')) self._system = infinisdk.InfiniBox(self.management_address, auth=auth) self._system.login() backend_name = self.configuration.safe_get('share_backend_name') self._backend_name = backend_name or self.__class__.__name__ thin_provisioning = self.configuration.infinidat_thin_provision self._provtype = "THIN" if thin_provisioning else "THICK" LOG.debug('setup complete')
def _setup_and_get_system_object(self, management_address, auth): system = infinisdk.InfiniBox(management_address, auth=auth) system.api.add_auto_retry( lambda e: isinstance( e, infinisdk.core.exceptions.APITransportFailure) and "Interrupted system call" in e.error_desc, _API_MAX_RETRIES) system.api.set_source_identifier(_INFINIDAT_MANILA_IDENTIFIER) system.login() return system
def do_setup(self, context): """Driver initialization""" if infinisdk is None: msg = _("Missing 'infinisdk' python module, ensure the library" " is installed and available.") raise exception.VolumeDriverException(message=msg) auth = (self.configuration.san_login, self.configuration.san_password) management_address = self.configuration.san_ip self._system = infinisdk.InfiniBox(management_address, auth=auth) self._system.login() backend_name = self.configuration.safe_get('volume_backend_name') self._backend_name = backend_name or self.__class__.__name__ self._volume_stats = None LOG.debug('setup complete')
def authenticate(self, key, credentials): from infinisdk.core.exceptions import APICommandFailed if credentials is None: return False config = config_get(silent=True) validate_key_val('IboxAddress', config['IboxAddress']) try: ibox = infinisdk.InfiniBox(config['IboxAddress'], auth=(credentials.get_username(), credentials.get_password())) ibox.login() return True except APICommandFailed: return False
def ibox_login(self): '''tries to connect using credintal store''' from smb.cli.smb_log import get_logger, log_n_raise logger = get_logger() store = initiate_store(self.config['IboxAddress']) ibox = infinisdk.InfiniBox(str(self.config['IboxAddress']), auth=(store.get_username(), store.get_password())) response = ibox.login() if response.status_code == 200: return ibox else: log_n_raise( logger, "Couldn't connect to InfiniBox with current credentials")
def do_setup(self, context): """Driver initialization""" if infinisdk is None: msg = _("Missing 'infinisdk' python module, ensure the library" " is installed and available.") raise exception.VolumeDriverException(message=msg) auth = (self.configuration.san_login, self.configuration.san_password) self.management_address = self.configuration.san_ip self._system = infinisdk.InfiniBox(self.management_address, auth=auth) self._system.login() backend_name = self.configuration.safe_get('volume_backend_name') self._backend_name = backend_name or self.__class__.__name__ self._volume_stats = None if self.configuration.infinidat_storage_protocol.lower() == 'iscsi': self._protocol = 'iSCSI' if len(self.configuration.infinidat_iscsi_netspaces) == 0: msg = _('No iSCSI network spaces configured') raise exception.VolumeDriverException(message=msg) else: self._protocol = 'FC' LOG.debug('setup complete')