Ejemplo n.º 1
0
    def check_for_setup_error(self):
        """Returns an error if prerequisites aren't met."""
        self.common.check_for_setup_error()

        bn = "/vshare/config/iscsi/enable"
        resp = self.common.vip.basic.get_node_values(bn)
        if resp[bn] is not True:
            raise exception.ViolinInvalidBackendConfig(
                reason=_('iSCSI is not enabled'))
        if len(self.gateway_iscsi_ip_addresses_mga) == 0:
            raise exception.ViolinInvalidBackendConfig(
                reason=_('no available iSCSI IPs on mga'))
        if len(self.gateway_iscsi_ip_addresses_mgb) == 0:
            raise exception.ViolinInvalidBackendConfig(
                reason=_('no available iSCSI IPs on mgb'))
Ejemplo n.º 2
0
    def check_for_setup_error(self):
        """Returns an error if prerequisites aren't met."""
        self.common.check_for_setup_error()

        if len(self.gateway_fc_wwns) == 0:
            raise exception.ViolinInvalidBackendConfig(
                reason=_('No FCP targets found'))
Ejemplo n.º 3
0
    def _export_lun(self, volume, connector=None):
        """Generates the export configuration for the given volume.

        :param volume:  volume object provided by the Manager
        :param connector:  connector object provided by the Manager
        :returns: the LUN ID assigned by the backend
        """
        lun_id = ''
        v = self.common.vmem_mg

        if not connector:
            raise exception.ViolinInvalidBackendConfig(
                reason=_('No initiators found, cannot proceed'))

        LOG.debug(
            "Exporting lun %(vol_id)s - initiator wwpns %(i_wwpns)s "
            "- target wwpns %(t_wwpns)s.", {
                'vol_id': volume['id'],
                'i_wwpns': connector['wwpns'],
                't_wwpns': self.gateway_fc_wwns
            })

        try:
            lun_id = self.common._send_cmd_and_verify(
                v.lun.assign_lun_to_client, self._is_lun_id_ready,
                "Assign SAN client successfully",
                [volume['id'], connector['host'], "ReadWrite"],
                [volume['id'], connector['host']])

        except exception.ViolinBackendErr:
            LOG.exception(_LE("Backend returned err for lun export."))
            raise

        except Exception:
            raise exception.ViolinInvalidBackendConfig(
                reason=_('LUN export failed!'))

        lun_id = self._get_lun_id(volume['id'], connector['host'])
        LOG.info(_LI("Exported lun %(vol_id)s on lun_id %(lun_id)s."), {
            'vol_id': volume['id'],
            'lun_id': lun_id
        })

        return lun_id
Ejemplo n.º 4
0
    def check_for_setup_error(self):
        """Returns an error if prerequisites aren't met."""
        if vmemclient is None:
            msg = _('vmemclient python library not found')
            raise exception.VolumeBackendAPIException(data=msg)

        LOG.info("CONCERTO version: %s", self.vmem_mg.version)

        if not self._is_supported_vmos_version(self.vmem_mg.version):
            msg = _('CONCERTO version is not supported')
            raise exception.ViolinInvalidBackendConfig(reason=msg)
Ejemplo n.º 5
0
    def check_for_setup_error(self):
        """Returns an error if prerequisites aren't met."""

        if len(self.container) == 0:
            msg = _('container is missing')
            raise exception.ViolinInvalidBackendConfig(reason=msg)

        if not self._is_supported_vmos_version(self.vip.version):
            msg = _('VMOS version is not supported')
            raise exception.ViolinInvalidBackendConfig(reason=msg)

        bn1 = ("/vshare/state/local/container/%s/threshold/usedspace"
               "/threshold_hard_val" % self.container)
        bn2 = ("/vshare/state/local/container/%s/threshold/provision"
               "/threshold_hard_val" % self.container)
        ret_dict = self.vip.basic.get_node_values([bn1, bn2])

        for node in ret_dict:
            # The infrastructure does not support space reclamation so
            # ensure it is disabled.  When used space exceeds the hard
            # limit, snapshot space reclamation begins.  Default is 0
            # => no space reclamation.
            #
            if node.endswith('/usedspace/threshold_hard_val'):
                if ret_dict[node] != 0:
                    msg = _('space reclamation threshold is enabled but not '
                            'supported by Cinder infrastructure.')
                    raise exception.ViolinInvalidBackendConfig(reason=msg)

            # The infrastructure does not support overprovisioning so
            # ensure it is disabled.  When provisioned space exceeds
            # the hard limit, further provisioning is stopped.
            # Default is 100 => provisioned space equals usable space.
            #
            elif node.endswith('/provision/threshold_hard_val'):
                if ret_dict[node] != 100:
                    msg = _('provisioned space threshold is not equal to '
                            'usable space.')
                    raise exception.ViolinInvalidBackendConfig(reason=msg)
Ejemplo n.º 6
0
    def _export_lun(self, volume, target, connector):
        """Generates the export configuration for the given volume.

        :param volume:  volume object provided by the Manager
        :param connector:  connector object provided by the Manager
        :returns: the LUN ID assigned by the backend
        """
        lun_id = ''
        v = self.common.vmem_mg

        LOG.debug(
            "Exporting lun %(vol_id)s - initiator iqns %(i_iqns)s "
            "- target iqns %(t_iqns)s.", {
                'vol_id': volume['id'],
                'i_iqns': connector['initiator'],
                't_iqns': self.gateway_iscsi_ip_addresses
            })

        try:
            lun_id = self.common._send_cmd_and_verify(
                v.lun.assign_lun_to_iscsi_target, self._is_lun_id_ready,
                "Assign device successfully", [volume['id'], target],
                [volume['id'], connector['host']])

        except exception.ViolinBackendErr:
            LOG.exception(_LE("Backend returned error for lun export."))
            raise

        except Exception:
            raise exception.ViolinInvalidBackendConfig(
                reason=_('LUN export failed!'))

        lun_id = self._get_lun_id(volume['id'], connector['host'])
        LOG.info(_LI("Exported lun %(vol_id)s on lun_id %(lun_id)s."), {
            'vol_id': volume['id'],
            'lun_id': lun_id
        })

        return lun_id
Ejemplo n.º 7
0
 def check_for_setup_error(self):
     """Returns an error if prerequisites aren't met."""
     self.common.check_for_setup_error()
     if len(self.gateway_iscsi_ip_addresses) == 0:
         msg = _('No iSCSI IPs configured on SAN gateway')
         raise exception.ViolinInvalidBackendConfig(reason=msg)