예제 #1
0
    def init_cinder_hosts(self, **kwargs):
        targets = kwargs.pop('targets', {'info': {}, 'list': []})
        connector = cinder_utils.brick_get_connector_properties()
        target_ports = self.storage_info['ports']

        if (self.find_targets_from_storage(
                targets, connector, target_ports) and
                self.conf.hpxp_group_request):
            self.create_mapping_targets(targets, connector)

        utils.require_target_existed(targets)
예제 #2
0
    def initialize_connection(self, volume, connector):
        targets = {
            'info': {},
            'list': [],
        }
        ldev = utils.get_ldev(volume)
        # When 'ldev' is 0, it should be true.
        # Therefore, it cannot remove 'is None'.
        if ldev is None:
            msg = utils.output_log(619, volume_id=volume['id'])
            raise exception.HPXPError(data=msg)

        target_ports = self.get_target_ports(connector)
        if (self.find_targets_from_storage(
                targets, connector, target_ports) and
                self.conf.hpxp_group_request):
            self.create_mapping_targets(targets, connector)

        utils.require_target_existed(targets)

        targets['list'].sort()
        self.modify_target_mode(volume, targets)
        target_lun = self.map_ldev(targets, ldev)

        conn_info = {
            'driver_volume_type': self.driver_info['volume_type'],
            'data': self.get_properties(volume, targets, target_lun,
                                        connector),
        }

        if self.conf.hpxp_zoning_request:
            init_targ_map = self._build_initiator_target_map(
                connector, conn_info['data']['target_wwn'])
            if init_targ_map:
                conn_info['data']['initiator_target_map'] = init_targ_map

        return conn_info