Example #1
0
    def _delete_zone_and_remove_fc_initiators(self, wwns, host_id):
        # Get tgt_port_wwns and init_targ_map to remove zone.
        portg_id = None
        if not self.fcsan:
            self.fcsan = fczm_utils.create_lookup_service()
        if self.fcsan:
            zone_helper = fc_zone_helper.FCZoneHelper(self.fcsan,
                                                      self.client)
            (tgt_port_wwns, portg_id, init_targ_map) = (
                zone_helper.get_init_targ_map(wwns, host_id))
        else:
            (tgt_port_wwns, init_targ_map) = (
                self.client.get_init_targ_map(wwns))

        # Remove the initiators from host if need.
        if host_id:
            fc_initiators = self.client.get_host_fc_initiators(host_id)
            for wwn in wwns:
                if wwn in fc_initiators:
                    self.client.remove_fc_from_host(wwn)

        info = {'driver_volume_type': 'fibre_channel',
                'data': {'target_wwn': tgt_port_wwns,
                         'initiator_target_map': init_targ_map}}
        return info, portg_id
Example #2
0
    def __init__(self, driver_name, driver_protocol, **kwargs):

        na_utils.validate_instantiation(**kwargs)

        self.driver_name = driver_name
        self.driver_protocol = driver_protocol
        self.zapi_client = None
        self._stats = {}
        self.lun_table = {}
        self.lun_ostype = None
        self.host_type = None
        self.lun_space_reservation = 'true'
        self.lookup_service = fczm_utils.create_lookup_service()
        self.app_version = kwargs.get("app_version", "unknown")

        self.configuration = kwargs['configuration']
        self.configuration.append_config_values(na_opts.netapp_connection_opts)
        self.configuration.append_config_values(na_opts.netapp_basicauth_opts)
        self.configuration.append_config_values(na_opts.netapp_transport_opts)
        self.configuration.append_config_values(
            na_opts.netapp_provisioning_opts)
        self.configuration.append_config_values(na_opts.netapp_san_opts)
        self.max_over_subscription_ratio = (
            self.configuration.max_over_subscription_ratio)
        self.reserved_percentage = self._get_reserved_percentage()
Example #3
0
    def __init__(self, *args, **kwargs):

        super(EMCVMAXFCDriver, self).__init__(*args, **kwargs)
        self.common = emc_vmax_common.EMCVMAXCommon(
            'FC',
            configuration=self.configuration)
        self.zonemanager_lookup_service = fczm_utils.create_lookup_service()
Example #4
0
 def __init__(self, *args, **kwargs):
     super(STXFCDriver, self).__init__(*args, **kwargs)
     self.common = None
     self.configuration.append_config_values(san.san_opts)
     self.lookup_service = fczm_utils.create_lookup_service()
     if type(self) != STXFCDriver:
         return
     self.configuration.append_config_values(common.common_opts)
Example #5
0
 def __init__(self, *args, **kwargs):
     # Make sure we're not invoked directly
     if type(self) == DotHillFCDriver:
         raise exception.DotHillDriverNotSupported
     super(DotHillFCDriver, self).__init__(*args, **kwargs)
     self.common = None
     self.configuration.append_config_values(san.san_opts)
     self.lookup_service = fczm_utils.create_lookup_service()
Example #6
0
 def __init__(self, *args, **kwargs):
     # Make sure we're not invoked directly
     if type(self) == DotHillFCDriver:
         raise exception.DotHillDriverNotSupported
     super(DotHillFCDriver, self).__init__(*args, **kwargs)
     self.common = None
     self.configuration.append_config_values(san.san_opts)
     self.lookup_service = fczm_utils.create_lookup_service()
Example #7
0
 def __init__(self, *args, **kwargs):
     super(FSSFCDriver, self).__init__(*args, **kwargs)
     self.gateway_fc_wwns = []
     self._storage_protocol = "FC"
     self._backend_name = (
         self.configuration.safe_get('volume_backend_name') or
         self.__class__.__name__)
     self._lookup_service = fczm_utils.create_lookup_service()
Example #8
0
 def __init__(self, *args, **kwargs):
     super(FSSFCDriver, self).__init__(*args, **kwargs)
     self.gateway_fc_wwns = []
     self._storage_protocol = "FC"
     self._backend_name = (
         self.configuration.safe_get('volume_backend_name') or
         self.__class__.__name__)
     self._lookup_service = fczm_utils.create_lookup_service()
Example #9
0
    def __init__(self, *args, **kwargs):

        super(VMAXFCDriver, self).__init__(*args, **kwargs)
        self.active_backend_id = kwargs.get('active_backend_id', None)
        self.common = common.VMAXCommon(
            'FC',
            self.VERSION,
            configuration=self.configuration,
            active_backend_id=self.active_backend_id)
        self.zonemanager_lookup_service = fczm_utils.create_lookup_service()
Example #10
0
    def __init__(self, *args, **kwargs):

        super(VMAXFCDriver, self).__init__(*args, **kwargs)
        self.active_backend_id = kwargs.get('active_backend_id', None)
        self.common = common.VMAXCommon(
            'FC',
            self.VERSION,
            configuration=self.configuration,
            active_backend_id=self.active_backend_id)
        self.zonemanager_lookup_service = fczm_utils.create_lookup_service()
Example #11
0
    def __init__(self, *args, **kwargs):
        super(V6000FCDriver, self).__init__(*args, **kwargs)
        self.gateway_fc_wwns = []
        self.stats = {}
        self.configuration.append_config_values(v6000_common.violin_opts)
        self.configuration.append_config_values(san.san_opts)
        self.common = v6000_common.V6000Common(self.configuration)
        self.lookup_service = fczm_utils.create_lookup_service()

        LOG.info(_LI("Initialized driver %(name)s version: %(vers)s."),
                 {'name': self.__class__.__name__, 'vers': self.VERSION})
Example #12
0
    def __init__(self, *args, **kwargs):
        super(V7000FCPDriver, self).__init__(*args, **kwargs)
        self.gateway_fc_wwns = []
        self.stats = {}
        self.configuration.append_config_values(v7000_common.violin_opts)
        self.configuration.append_config_values(san.san_opts)
        self.common = v7000_common.V7000Common(self.configuration)
        self.lookup_service = fczm_utils.create_lookup_service()

        LOG.info(_LI("Initialized driver %(name)s version: %(vers)s"),
                 {'name': self.__class__.__name__, 'vers': self.VERSION})
Example #13
0
    def __init__(self, *args, **kwargs):

        super(PowerMaxFCDriver, self).__init__(*args, **kwargs)
        self.active_backend_id = kwargs.get('active_backend_id', None)
        self.common = common.PowerMaxCommon(
            'FC',
            self.VERSION,
            configuration=self.configuration,
            active_backend_id=self.active_backend_id)
        self.performance = self.common.performance
        self.rest = self.common.rest
        self.zonemanager_lookup_service = fczm_utils.create_lookup_service()
Example #14
0
 def __init__(self, driver_name, driver_protocol="iSCSI", configuration=None, **kwargs):
     self.configuration = configuration
     self.configuration.append_config_values(na_opts.netapp_basicauth_opts)
     self.configuration.append_config_values(na_opts.netapp_connection_opts)
     self.configuration.append_config_values(na_opts.netapp_transport_opts)
     self.configuration.append_config_values(na_opts.netapp_eseries_opts)
     self.configuration.append_config_values(na_opts.netapp_san_opts)
     self.lookup_service = fczm_utils.create_lookup_service()
     self._backend_name = self.configuration.safe_get("volume_backend_name") or "NetApp_ESeries"
     self.driver_name = driver_name
     self.driver_protocol = driver_protocol
     self._stats = {}
     self._ssc_stats = {}
 def __init__(self, driver_name, driver_protocol="iSCSI",
              configuration=None, **kwargs):
     self.configuration = configuration
     self.configuration.append_config_values(na_opts.netapp_basicauth_opts)
     self.configuration.append_config_values(
         na_opts.netapp_connection_opts)
     self.configuration.append_config_values(na_opts.netapp_transport_opts)
     self.configuration.append_config_values(na_opts.netapp_eseries_opts)
     self.configuration.append_config_values(na_opts.netapp_san_opts)
     self.lookup_service = fczm_utils.create_lookup_service()
     self._backend_name = self.configuration.safe_get(
         "volume_backend_name") or "NetApp_ESeries"
     self.driver_name = driver_name
     self.driver_protocol = driver_protocol
     self._stats = {}
     self._ssc_stats = {}
Example #16
0
    def __init__(self, driver_name, driver_protocol, **kwargs):

        na_utils.validate_instantiation(**kwargs)

        self.driver_name = driver_name
        self.driver_protocol = driver_protocol
        self.zapi_client = None
        self._stats = {}
        self.lun_table = {}
        self.lookup_service = fczm_utils.create_lookup_service()
        self.app_version = kwargs.get("app_version", "unknown")

        self.configuration = kwargs['configuration']
        self.configuration.append_config_values(na_opts.netapp_connection_opts)
        self.configuration.append_config_values(na_opts.netapp_basicauth_opts)
        self.configuration.append_config_values(na_opts.netapp_transport_opts)
        self.configuration.append_config_values(
            na_opts.netapp_provisioning_opts)
Example #17
0
    def __init__(self, driver_name, driver_protocol, **kwargs):

        na_utils.validate_instantiation(**kwargs)

        self.driver_name = driver_name
        self.driver_protocol = driver_protocol
        self.zapi_client = None
        self._stats = {}
        self.lun_table = {}
        self.lookup_service = fczm_utils.create_lookup_service()
        self.app_version = kwargs.get("app_version", "unknown")

        self.configuration = kwargs['configuration']
        self.configuration.append_config_values(na_opts.netapp_connection_opts)
        self.configuration.append_config_values(na_opts.netapp_basicauth_opts)
        self.configuration.append_config_values(na_opts.netapp_transport_opts)
        self.configuration.append_config_values(
            na_opts.netapp_provisioning_opts)
Example #18
0
    def __init__(self, conf, storage_protocol, **kwargs):
        self.conf = conf
        self.conf.append_config_values(_COMMON_VOLUME_OPTS)

        self.db = kwargs.get('db')
        self.ctxt = None
        self.lock = {
            'do_setup': 'do_setup',
        }
        self.driver_info = _DRIVER_INFO[storage_protocol]
        self.storage_info = {
            'protocol': storage_protocol,
            'pool_id': None,
            'ldev_range': None,
            'ports': [],
            'compute_ports': [],
            'wwns': {},
            'output_first': True
        }

        self._stats = {}
        self._lookup_service = fczm_utils.create_lookup_service()
Example #19
0
    def terminate_connection(self, volume, connector, **kwargs):
        """Delete map between a volume and a host."""
        wwns = connector['wwpns']
        volume_name = huawei_utils.encode_name(volume['id'])
        lun_id = volume.get('provider_location', None)
        host_name = connector['host']
        left_lunnum = -1
        lungroup_id = None
        view_id = None
        LOG.info(_LI('terminate_connection: volume name: %(volume)s, '
                     'wwpns: %(wwns)s, '
                     'lun_id: %(lunid)s.'),
                 {'volume': volume_name,
                  'wwns': wwns,
                  'lunid': lun_id},)

        if host_name and len(host_name) > constants.MAX_HOSTNAME_LENGTH:
            host_name = six.text_type(hash(host_name))
        host_id = self.restclient.find_host(host_name)
        if host_id:
            mapping_view_name = constants.MAPPING_VIEW_PREFIX + host_id
            view_id = self.restclient.find_mapping_view(mapping_view_name)
            if view_id:
                lungroup_id = self.restclient.find_lungroup_from_map(view_id)

        if lun_id and self.restclient.check_lun_exist(lun_id):
            if lungroup_id:
                lungroup_ids = self.restclient.get_lungroupids_by_lunid(lun_id)
                if lungroup_id in lungroup_ids:
                    self.restclient.remove_lun_from_lungroup(lungroup_id,
                                                             lun_id)
                else:
                    LOG.warning(_LW("Lun is not in lungroup. "
                                    "Lun id: %(lun_id)s. "
                                    "Lungroup id: %(lungroup_id)s."),
                                {"lun_id": lun_id,
                                 "lungroup_id": lungroup_id})
        else:
            LOG.warning(_LW("Can't find lun on the array."))
        if lungroup_id:
            left_lunnum = self.restclient.get_lunnum_from_lungroup(lungroup_id)
        if int(left_lunnum) > 0:
            info = {'driver_volume_type': 'fibre_channel',
                    'data': {}}
        else:
            if not self.fcsan_lookup_service:
                self.fcsan_lookup_service = fczm_utils.create_lookup_service()

            if self.fcsan_lookup_service:
                zone_helper = fc_zone_helper.FCZoneHelper(
                    self.fcsan_lookup_service, self.restclient)

                (tgt_port_wwns, init_targ_map) = (
                    zone_helper.build_ini_targ_map(wwns))
            else:
                (tgt_port_wwns, init_targ_map) = (
                    self.restclient.get_init_targ_map(wwns))

            for wwn in wwns:
                if self.restclient.is_fc_initiator_associated_to_host(wwn):
                    self.restclient.remove_fc_from_host(wwn)
            if lungroup_id:
                if view_id and self.restclient.lungroup_associated(
                        view_id, lungroup_id):
                    self.restclient.delete_lungroup_mapping_view(view_id,
                                                                 lungroup_id)
                self.restclient.delete_lungroup(lungroup_id)

            if host_id:
                hostgroup_name = constants.HOSTGROUP_PREFIX + host_id
                hostgroup_id = self.restclient.find_hostgroup(hostgroup_name)
                if hostgroup_id:
                    if view_id and self.restclient.hostgroup_associated(
                            view_id, hostgroup_id):
                        self.restclient.delete_hostgoup_mapping_view(
                            view_id, hostgroup_id)
                    self.restclient.remove_host_from_hostgroup(
                        hostgroup_id, host_id)
                    self.restclient.delete_hostgroup(hostgroup_id)

                if not self.restclient.check_fc_initiators_exist_in_host(
                        host_id):
                    self.restclient.remove_host(host_id)

            if view_id:
                self.restclient.delete_mapping_view(view_id)

            info = {'driver_volume_type': 'fibre_channel',
                    'data': {'target_wwn': tgt_port_wwns,
                             'initiator_target_map': init_targ_map}}
        LOG.info(_LI("terminate_connection, return data is: %s."),
                 info)

        return info
Example #20
0
def create_lookup_service():
    return zm_utils.create_lookup_service()
Example #21
0
 def __init__(self, *args, **kwargs):
     super(HPE3PARFCDriver, self).__init__(*args, **kwargs)
     self.configuration.append_config_values(hpecommon.hpe3par_opts)
     self.configuration.append_config_values(san.san_opts)
     self.lookup_service = fczm_utils.create_lookup_service()
Example #22
0
 def __init__(self, *args, **kwargs):
     super(HPE3PARFCDriver, self).__init__(*args, **kwargs)
     self.lookup_service = fczm_utils.create_lookup_service()
     self.protocol = 'FC'
Example #23
0
def create_lookup_service():
    return zm_utils.create_lookup_service()
Example #24
0
 def __init__(self, *args, **kwargs):
     super(DotHillFCDriver, self).__init__(*args, **kwargs)
     self.common = None
     self.configuration.append_config_values(dothill_common.common_opts)
     self.configuration.append_config_values(san.san_opts)
     self.lookup_service = fczm_utils.create_lookup_service()
 def __init__(self, *args, **kwargs):
     super(HuaweiFCDriver, self).__init__(*args, **kwargs)
     self.fc_san = zm_utils.create_lookup_service()
Example #26
0
 def __init__(self, *args, **kwargs):
     super(InfiniboxVolumeDriver, self).__init__(*args, **kwargs)
     self.configuration.append_config_values(infinidat_opts)
     self._lookup_service = fczm_utils.create_lookup_service()
Example #27
0
 def __init__(self, *args, **kwargs):
     execute = kwargs.pop("execute", utils.execute)
     super(PureFCDriver, self).__init__(execute=execute, *args, **kwargs)
     self._storage_protocol = "FC"
     self._lookup_service = fczm_utils.create_lookup_service()
Example #28
0
    def terminate_connection(self, volume, connector, **kwargs):
        """Delete map between a volume and a host."""
        wwns = connector['wwpns']
        volume_name = huawei_utils.encode_name(volume['id'])
        lun_id = volume.get('provider_location')
        host_name = connector['host']
        left_lunnum = -1
        lungroup_id = None
        view_id = None
        LOG.info(
            _LI('terminate_connection: volume name: %(volume)s, '
                'wwpns: %(wwns)s, '
                'lun_id: %(lunid)s.'),
            {
                'volume': volume_name,
                'wwns': wwns,
                'lunid': lun_id
            },
        )

        if host_name and len(host_name) > constants.MAX_HOSTNAME_LENGTH:
            host_name = six.text_type(hash(host_name))
        host_id = self.restclient.find_host(host_name)
        if host_id:
            mapping_view_name = constants.MAPPING_VIEW_PREFIX + host_id
            view_id = self.restclient.find_mapping_view(mapping_view_name)
            if view_id:
                lungroup_id = self.restclient.find_lungroup_from_map(view_id)

        if lun_id and self.restclient.check_lun_exist(lun_id):
            if lungroup_id:
                lungroup_ids = self.restclient.get_lungroupids_by_lunid(lun_id)
                if lungroup_id in lungroup_ids:
                    self.restclient.remove_lun_from_lungroup(
                        lungroup_id, lun_id)
                else:
                    LOG.warning(
                        _LW("Lun is not in lungroup. "
                            "Lun id: %(lun_id)s. "
                            "Lungroup id: %(lungroup_id)s."), {
                                "lun_id": lun_id,
                                "lungroup_id": lungroup_id
                            })
        else:
            LOG.warning(_LW("Can't find lun on the array."))
        if lungroup_id:
            left_lunnum = self.restclient.get_lunnum_from_lungroup(lungroup_id)
        if int(left_lunnum) > 0:
            info = {'driver_volume_type': 'fibre_channel', 'data': {}}
        else:
            if not self.fcsan_lookup_service:
                self.fcsan_lookup_service = fczm_utils.create_lookup_service()

            if self.fcsan_lookup_service:
                zone_helper = fc_zone_helper.FCZoneHelper(
                    self.fcsan_lookup_service, self.restclient)

                (tgt_port_wwns,
                 init_targ_map) = (zone_helper.build_ini_targ_map(wwns))
            else:
                (tgt_port_wwns,
                 init_targ_map) = (self.restclient.get_init_targ_map(wwns))

            for wwn in wwns:
                if self.restclient.is_fc_initiator_associated_to_host(wwn):
                    self.restclient.remove_fc_from_host(wwn)
            if lungroup_id:
                if view_id and self.restclient.lungroup_associated(
                        view_id, lungroup_id):
                    self.restclient.delete_lungroup_mapping_view(
                        view_id, lungroup_id)
                self.restclient.delete_lungroup(lungroup_id)

            if host_id:
                hostgroup_name = constants.HOSTGROUP_PREFIX + host_id
                hostgroup_id = self.restclient.find_hostgroup(hostgroup_name)
                if hostgroup_id:
                    if view_id and self.restclient.hostgroup_associated(
                            view_id, hostgroup_id):
                        self.restclient.delete_hostgoup_mapping_view(
                            view_id, hostgroup_id)
                    self.restclient.remove_host_from_hostgroup(
                        hostgroup_id, host_id)
                    self.restclient.delete_hostgroup(hostgroup_id)

                if not self.restclient.check_fc_initiators_exist_in_host(
                        host_id):
                    self.restclient.remove_host(host_id)

            if view_id:
                self.restclient.delete_mapping_view(view_id)

            info = {
                'driver_volume_type': 'fibre_channel',
                'data': {
                    'target_wwn': tgt_port_wwns,
                    'initiator_target_map': init_targ_map
                }
            }
        LOG.info(_LI("terminate_connection, return data is: %s."), info)

        return info
Example #29
0
    def initialize_connection(self, volume, connector):
        lun_id, lun_type = self.get_lun_id_and_type(volume)
        wwns = connector['wwpns']
        LOG.info(
            'initialize_connection, initiator: %(wwpns)s,'
            ' LUN ID: %(lun_id)s.',
            {'wwpns': wwns,
             'lun_id': lun_id},)

        portg_id = None
        host_id = self.client.add_host_with_check(connector['host'])

        if not self.fcsan:
            self.fcsan = fczm_utils.create_lookup_service()

        if self.fcsan:
            # Use FC switch.
            zone_helper = fc_zone_helper.FCZoneHelper(self.fcsan, self.client)
            try:
                (tgt_port_wwns, portg_id, init_targ_map) = (
                    zone_helper.build_ini_targ_map(wwns, host_id, lun_id,
                                                   lun_type))
            except Exception as err:
                self.remove_host_with_check(host_id)
                msg = _('build_ini_targ_map fails. %s') % err
                raise exception.VolumeBackendAPIException(data=msg)

            for ini in init_targ_map:
                self.client.ensure_fc_initiator_added(ini, host_id)
        else:
            # Not use FC switch.
            online_wwns_in_host = (
                self.client.get_host_online_fc_initiators(host_id))
            online_free_wwns = self.client.get_online_free_wwns()
            fc_initiators_on_array = self.client.get_fc_initiator_on_array()
            wwns = [i for i in wwns if i in fc_initiators_on_array]

            for wwn in wwns:
                if (wwn not in online_wwns_in_host
                        and wwn not in online_free_wwns):
                    wwns_in_host = (
                        self.client.get_host_fc_initiators(host_id))
                    iqns_in_host = (
                        self.client.get_host_iscsi_initiators(host_id))
                    if not (wwns_in_host or iqns_in_host or
                       self.client.is_host_associated_to_hostgroup(host_id)):
                        self.client.remove_host(host_id)

                    msg = _('No FC initiator can be added to host.')
                    LOG.error(msg)
                    raise exception.VolumeBackendAPIException(data=msg)

            for wwn in wwns:
                if wwn in online_free_wwns:
                    self.client.add_fc_port_to_host(host_id, wwn)

            (tgt_port_wwns, init_targ_map) = (
                self.client.get_init_targ_map(wwns))

        # Add host into hostgroup.
        hostgroup_id = self.client.add_host_to_hostgroup(host_id)

        metadata = huawei_utils.get_volume_private_data(volume)
        LOG.info("initialize_connection, metadata is: %s.", metadata)
        hypermetro_lun = metadata.get('hypermetro_id') is not None

        map_info = self.client.do_mapping(lun_id, hostgroup_id,
                                          host_id, portg_id,
                                          lun_type, hypermetro_lun)
        host_lun_id = self.client.get_host_lun_id(host_id, lun_id,
                                                  lun_type)

        # Return FC properties.
        fc_info = {'driver_volume_type': 'fibre_channel',
                   'data': {'target_lun': int(host_lun_id),
                            'target_discovered': True,
                            'target_wwn': tgt_port_wwns,
                            'volume_id': volume.id,
                            'initiator_target_map': init_targ_map,
                            'map_info': map_info}, }

        # Deal with hypermetro connection.
        if hypermetro_lun:
            loc_tgt_wwn = fc_info['data']['target_wwn']
            local_ini_tgt_map = fc_info['data']['initiator_target_map']
            hyperm = hypermetro.HuaweiHyperMetro(self.client,
                                                 self.rmt_client,
                                                 self.configuration)
            rmt_fc_info = hyperm.connect_volume_fc(volume, connector)

            rmt_tgt_wwn = rmt_fc_info['data']['target_wwn']
            rmt_ini_tgt_map = rmt_fc_info['data']['initiator_target_map']
            fc_info['data']['target_wwn'] = (loc_tgt_wwn + rmt_tgt_wwn)
            wwns = connector['wwpns']
            for wwn in wwns:
                if (wwn in local_ini_tgt_map
                        and wwn in rmt_ini_tgt_map):
                    fc_info['data']['initiator_target_map'][wwn].extend(
                        rmt_ini_tgt_map[wwn])

                elif (wwn not in local_ini_tgt_map
                        and wwn in rmt_ini_tgt_map):
                    fc_info['data']['initiator_target_map'][wwn] = (
                        rmt_ini_tgt_map[wwn])
                # else, do nothing

            loc_map_info = fc_info['data']['map_info']
            rmt_map_info = rmt_fc_info['data']['map_info']
            same_host_id = self._get_same_hostid(loc_map_info,
                                                 rmt_map_info)

            self.client.change_hostlun_id(loc_map_info, same_host_id)
            hyperm.rmt_client.change_hostlun_id(rmt_map_info, same_host_id)

            fc_info['data']['target_lun'] = same_host_id
            hyperm.rmt_client.logout()

        fczm_utils.add_fc_zone(fc_info)
        LOG.info("Return FC info is: %s.", fc_info)
        return fc_info
Example #30
0
 def __init__(self, *args, **kwargs):
     super(HPE3PARFCDriver, self).__init__(*args, **kwargs)
     self.configuration.append_config_values(hpecommon.hpe3par_opts)
     self.configuration.append_config_values(san.san_opts)
     self.lookup_service = fczm_utils.create_lookup_service()
Example #31
0
    def initialize_connection(self, volume, connector):
        wwns = connector["wwpns"]
        volume_name = huawei_utils.encode_name(volume["id"])
        LOG.info(
            _LI("initialize_connection, initiator: %(wwpns)s," " volume name: %(volume)s."),
            {"wwpns": wwns, "volume": volume_name},
        )

        host_name_before_hash = None
        host_name = connector["host"]
        if host_name and (len(host_name) > constants.MAX_HOSTNAME_LENGTH):
            host_name_before_hash = host_name
            host_name = six.text_type(hash(host_name))

        if not self.fcsan_lookup_service:
            self.fcsan_lookup_service = fczm_utils.create_lookup_service()

        if self.fcsan_lookup_service:
            # Use FC switch.
            host_id = self.restclient.add_host_with_check(host_name, host_name_before_hash)
            zone_helper = fc_zone_helper.FCZoneHelper(self.fcsan_lookup_service, self.restclient)
            (tgt_port_wwns, init_targ_map) = zone_helper.build_ini_targ_map(wwns)
            for ini in init_targ_map:
                self.restclient.ensure_fc_initiator_added(ini, host_id)
        else:
            # Not use FC switch.
            host_id = self.restclient.add_host_with_check(host_name, host_name_before_hash)
            online_wwns_in_host = self.restclient.get_host_online_fc_initiators(host_id)
            online_free_wwns = self.restclient.get_online_free_wwns()
            for wwn in wwns:
                if wwn not in online_wwns_in_host and wwn not in online_free_wwns:
                    wwns_in_host = self.restclient.get_host_fc_initiators(host_id)
                    iqns_in_host = self.restclient.get_host_iscsi_initiators(host_id)
                    if not wwns_in_host and not iqns_in_host:
                        self.restclient.remove_host(host_id)

                    msg = _("Can not add FC initiator to host.")
                    LOG.error(msg)
                    raise exception.VolumeBackendAPIException(data=msg)

            for wwn in wwns:
                if wwn in online_free_wwns:
                    self.restclient.add_fc_port_to_host(host_id, wwn)

            (tgt_port_wwns, init_targ_map) = self.restclient.get_init_targ_map(wwns)

        # Add host into hostgroup.
        hostgroup_id = self.restclient.add_host_into_hostgroup(host_id)
        lun_id = self.restclient.mapping_hostgroup_and_lungroup(volume_name, hostgroup_id, host_id)
        host_lun_id = self.restclient.find_host_lun_id(host_id, lun_id)

        # Return FC properties.
        info = {
            "driver_volume_type": "fibre_channel",
            "data": {
                "target_lun": int(host_lun_id),
                "target_discovered": True,
                "target_wwn": tgt_port_wwns,
                "volume_id": volume["id"],
                "initiator_target_map": init_targ_map,
            },
        }

        LOG.info(_LI("initialize_connection, return data is: %s."), info)

        return info
Example #32
0
    def __init__(self, *args, **kwargs):

        super(EMCVMAXFCDriver, self).__init__(*args, **kwargs)
        self.common = emc_vmax_common.EMCVMAXCommon(
            'FC', self.VERSION, configuration=self.configuration)
        self.zonemanager_lookup_service = fczm_utils.create_lookup_service()
Example #33
0
 def __init__(self, *args, **kwargs):
     super(DotHillFCDriver, self).__init__(*args, **kwargs)
     self.common = None
     self.configuration.append_config_values(dothill_common.common_opts)
     self.configuration.append_config_values(san.san_opts)
     self.lookup_service = fczm_utils.create_lookup_service()
Example #34
0
 def fake_init(self, *args, **kwargs):
     super(dothill_fc.DotHillFCDriver, self).__init__()
     self.common = None
     self.configuration = FakeConfiguration1()
     self.lookup_service = fczm_utils.create_lookup_service()
Example #35
0
 def fake_init(self, *args, **kwargs):
     super(dothill_fc.DotHillFCDriver, self).__init__()
     self.common = None
     self.configuration = FakeConfiguration1()
     self.lookup_service = fczm_utils.create_lookup_service()
Example #36
0
 def __init__(self, *args, **kwargs):
     super(InfiniboxVolumeDriver, self).__init__(*args, **kwargs)
     self.configuration.append_config_values(infinidat_opts)
     self._lookup_service = fczm_utils.create_lookup_service()
Example #37
0
    def initialize_connection(self, volume, connector):
        wwns = connector['wwpns']
        volume_name = huawei_utils.encode_name(volume['id'])
        LOG.info(
            _LI('initialize_connection, initiator: %(wwpns)s,'
                ' volume name: %(volume)s.'),
            {
                'wwpns': wwns,
                'volume': volume_name
            },
        )

        lun_id = self.restclient.get_lunid(volume, volume_name)

        host_name_before_hash = None
        host_name = connector['host']
        if host_name and (len(host_name) > constants.MAX_HOSTNAME_LENGTH):
            host_name_before_hash = host_name
            host_name = six.text_type(hash(host_name))

        if not self.fcsan_lookup_service:
            self.fcsan_lookup_service = fczm_utils.create_lookup_service()

        if self.fcsan_lookup_service:
            # Use FC switch.
            host_id = self.restclient.add_host_with_check(
                host_name, host_name_before_hash)
            zone_helper = fc_zone_helper.FCZoneHelper(
                self.fcsan_lookup_service, self.restclient)
            (tgt_port_wwns,
             init_targ_map) = (zone_helper.build_ini_targ_map(wwns))
            for ini in init_targ_map:
                self.restclient.ensure_fc_initiator_added(ini, host_id)
        else:
            # Not use FC switch.
            host_id = self.restclient.add_host_with_check(
                host_name, host_name_before_hash)
            online_wwns_in_host = (
                self.restclient.get_host_online_fc_initiators(host_id))
            online_free_wwns = self.restclient.get_online_free_wwns()
            for wwn in wwns:
                if (wwn not in online_wwns_in_host
                        and wwn not in online_free_wwns):
                    wwns_in_host = (
                        self.restclient.get_host_fc_initiators(host_id))
                    iqns_in_host = (
                        self.restclient.get_host_iscsi_initiators(host_id))
                    if not wwns_in_host and not iqns_in_host:
                        self.restclient.remove_host(host_id)

                    msg = (_('Can not add FC initiator to host.'))
                    LOG.error(msg)
                    raise exception.VolumeBackendAPIException(data=msg)

            for wwn in wwns:
                if wwn in online_free_wwns:
                    self.restclient.add_fc_port_to_host(host_id, wwn)

            (tgt_port_wwns,
             init_targ_map) = (self.restclient.get_init_targ_map(wwns))

        # Add host into hostgroup.
        hostgroup_id = self.restclient.add_host_into_hostgroup(host_id)
        self.restclient.do_mapping(lun_id, hostgroup_id, host_id)
        host_lun_id = self.restclient.find_host_lun_id(host_id, lun_id)

        # Return FC properties.
        info = {
            'driver_volume_type': 'fibre_channel',
            'data': {
                'target_lun': int(host_lun_id),
                'target_discovered': True,
                'target_wwn': tgt_port_wwns,
                'volume_id': volume['id'],
                'initiator_target_map': init_targ_map
            },
        }

        LOG.info(_LI("initialize_connection, return data is: %s."), info)

        return info
Example #38
0
    def initialize_connection(self, volume, connector):
        wwns = connector['wwpns']
        volume_name = huawei_utils.encode_name(volume['id'])
        LOG.info(_LI(
            'initialize_connection, initiator: %(wwpns)s,'
            ' volume name: %(volume)s.'),
            {'wwpns': wwns,
             'volume': volume_name},)

        host_name_before_hash = None
        host_name = connector['host']
        if host_name and (len(host_name) > constants.MAX_HOSTNAME_LENGTH):
            host_name_before_hash = host_name
            host_name = six.text_type(hash(host_name))

        if not self.fcsan_lookup_service:
            self.fcsan_lookup_service = fczm_utils.create_lookup_service()

        if self.fcsan_lookup_service:
            # Use FC switch.
            host_id = self.restclient.add_host_with_check(
                host_name, host_name_before_hash)
            zone_helper = fc_zone_helper.FCZoneHelper(
                self.fcsan_lookup_service, self.restclient)
            (tgt_port_wwns, init_targ_map) = (
                zone_helper.build_ini_targ_map(wwns))
            for ini in init_targ_map:
                self.restclient.ensure_fc_initiator_added(ini, host_id)
        else:
            # Not use FC switch.
            host_id = self.restclient.add_host_with_check(
                host_name, host_name_before_hash)
            online_wwns_in_host = (
                self.restclient.get_host_online_fc_initiators(host_id))
            online_free_wwns = self.restclient.get_online_free_wwns()
            for wwn in wwns:
                if (wwn not in online_wwns_in_host
                        and wwn not in online_free_wwns):
                    wwns_in_host = (
                        self.restclient.get_host_fc_initiators(host_id))
                    iqns_in_host = (
                        self.restclient.get_host_iscsi_initiators(host_id))
                    if not wwns_in_host and not iqns_in_host:
                        self.restclient.remove_host(host_id)

                    msg = (_('Can not add FC initiator to host.'))
                    LOG.error(msg)
                    raise exception.VolumeBackendAPIException(data=msg)

            for wwn in wwns:
                if wwn in online_free_wwns:
                    self.restclient.add_fc_port_to_host(host_id, wwn)

            (tgt_port_wwns, init_targ_map) = (
                self.restclient.get_init_targ_map(wwns))

        # Add host into hostgroup.
        hostgroup_id = self.restclient.add_host_into_hostgroup(host_id)
        lun_id = self.restclient.mapping_hostgroup_and_lungroup(volume_name,
                                                                hostgroup_id,
                                                                host_id)
        host_lun_id = self.restclient.find_host_lun_id(host_id, lun_id)

        # Return FC properties.
        info = {'driver_volume_type': 'fibre_channel',
                'data': {'target_lun': int(host_lun_id),
                         'target_discovered': True,
                         'target_wwn': tgt_port_wwns,
                         'volume_id': volume['id'],
                         'initiator_target_map': init_targ_map}, }

        LOG.info(_LI("initialize_connection, return data is: %s."),
                 info)

        return info
Example #39
0
 def __init__(self, *args, **kwargs):
     super(KaminarioFCDriver, self).__init__(*args, **kwargs)
     self._protocol = 'FC'
     self.lookup_service = fczm_utils.create_lookup_service()
Example #40
0
 def __init__(self, conf, storage_protocol, db):
     """Initialize instance variables."""
     super(HBSDRESTFC, self).__init__(conf, storage_protocol, db)
     self._lookup_service = fczm_utils.create_lookup_service()
Example #41
0
 def __init__(self, *args, **kwargs):
     super(KaminarioFCDriver, self).__init__(*args, **kwargs)
     self._protocol = 'FC'
     self.lookup_service = fczm_utils.create_lookup_service()
Example #42
0
 def __init__(self, *args, **kwargs):
     super(HPE3PARFCDriver, self).__init__(*args, **kwargs)
     self.lookup_service = fczm_utils.create_lookup_service()
     self.protocol = 'FC'
Example #43
0
 def __init__(self, *args, **kwargs):
     execute = kwargs.pop("execute", utils.execute)
     super(PureFCDriver, self).__init__(execute=execute, *args, **kwargs)
     self._storage_protocol = "FC"
     self._lookup_service = fczm_utils.create_lookup_service()
Example #44
0
 def __init__(self, conf, storage_protocol, db):
     """Initialize instance variables."""
     super(VSPHORCMFC, self).__init__(conf, storage_protocol, db)
     self._lookup_service = fczm_utils.create_lookup_service()