Exemple #1
0
    def test_log_extra_spec_warnings_deprecated_specs(self):

        mock_log = self.mock_object(na_utils.LOG, 'warning')

        na_utils.log_extra_spec_warnings({'netapp_thick_provisioned': 'true'})

        self.assertEqual(1, mock_log.call_count)
Exemple #2
0
    def test_log_extra_spec_warnings_deprecated_specs(self):

        mock_log = self.mock_object(na_utils.LOG, 'warning')

        na_utils.log_extra_spec_warnings({'netapp_thick_provisioned': 'true'})

        self.assertEqual(1, mock_log.call_count)
Exemple #3
0
    def test_log_extra_spec_warnings_obsolete_specs(self):

        mock_log = self.mock_object(na_utils.LOG, 'warning')

        na_utils.log_extra_spec_warnings({'netapp:raid_type': 'raid4'})

        self.assertEqual(1, mock_log.call_count)
Exemple #4
0
    def test_log_extra_spec_warnings_deprecated_specs(self):

        mock_log = self.mock_object(na_utils.LOG, 'warning')

        na_utils.log_extra_spec_warnings({'netapp_thick_provisioned': 'true'})

        mock_log.assert_called_once()
Exemple #5
0
    def test_log_extra_spec_warnings_obsolete_specs(self):

        mock_log = self.mock_object(na_utils.LOG, 'warning')

        na_utils.log_extra_spec_warnings({'netapp:raid_type': 'raid4'})

        self.assertEqual(1, mock_log.call_count)
Exemple #6
0
    def test_log_extra_spec_warnings_obsolete_specs(self):

        mock_log = self.mock_object(na_utils.LOG, 'warning')

        na_utils.log_extra_spec_warnings({'netapp:raid_type': 'raid4'})

        mock_log.assert_called_once()
Exemple #7
0
    def create_volume(self, volume):
        """Creates a volume.

        :param volume: volume reference
        """
        LOG.debug('create_volume on %s' % volume['host'])
        self._ensure_shares_mounted()

        # get share as pool name
        share = volume_utils.extract_host(volume['host'], level='pool')

        if share is None:
            msg = _("Pool is not available in the volume host field.")
            raise exception.InvalidHost(reason=msg)

        extra_specs = get_volume_extra_specs(volume)
        qos_policy_group = extra_specs.pop('netapp:qos_policy_group', None) \
            if extra_specs else None

        # warn on obsolete extra specs
        na_utils.log_extra_spec_warnings(extra_specs)

        try:
            volume['provider_location'] = share
            LOG.info(_LI('casted to %s') % volume['provider_location'])
            self._do_create_volume(volume)
            if qos_policy_group:
                self._set_qos_policy_group_on_volume(volume, share,
                                                     qos_policy_group)
            return {'provider_location': volume['provider_location']}
        except Exception as ex:
            LOG.error(
                _LW("Exception creating vol %(name)s on "
                    "share %(share)s. Details: %(ex)s") % {
                        'name': volume['name'],
                        'share': volume['provider_location'],
                        'ex': ex
                    })
            volume['provider_location'] = None
        finally:
            if self.ssc_enabled:
                self._update_stale_vols(self._get_vol_for_share(share))

        msg = _("Volume %s could not be created on shares.")
        raise exception.VolumeBackendAPIException(data=msg % (volume['name']))
Exemple #8
0
    def create_volume(self, volume):
        """Driver entry point for creating a new volume (Data ONTAP LUN)."""

        LOG.debug('create_volume on %s' % volume['host'])

        # get Data ONTAP volume name as pool name
        ontap_volume_name = volume_utils.extract_host(volume['host'],
                                                      level='pool')

        if ontap_volume_name is None:
            msg = _("Pool is not available in the volume host field.")
            raise exception.InvalidHost(reason=msg)

        lun_name = volume['name']

        # start with default size, get requested size
        default_size = units.Mi * 100  # 100 MB
        size = default_size if not int(volume['size'])\
            else int(volume['size']) * units.Gi

        metadata = {
            'OsType': 'linux',
            'SpaceReserved': 'true',
            'Path': '/vol/%s/%s' % (ontap_volume_name, lun_name)
        }

        extra_specs = na_utils.get_volume_extra_specs(volume)
        qos_policy_group = extra_specs.pop('netapp:qos_policy_group', None) \
            if extra_specs else None

        # warn on obsolete extra specs
        na_utils.log_extra_spec_warnings(extra_specs)

        self._create_lun(ontap_volume_name, lun_name, size, metadata,
                         qos_policy_group)
        LOG.debug('Created LUN with name %s' % lun_name)

        metadata['Path'] = '/vol/%s/%s' % (ontap_volume_name, lun_name)
        metadata['Volume'] = ontap_volume_name
        metadata['Qtree'] = None

        handle = self._create_lun_handle(metadata)
        self._add_lun_to_table(NetAppLun(handle, lun_name, size, metadata))
Exemple #9
0
    def create_volume(self, volume):
        """Creates a volume.

        :param volume: volume reference
        """
        LOG.debug('create_volume on %s' % volume['host'])
        self._ensure_shares_mounted()

        # get share as pool name
        share = volume_utils.extract_host(volume['host'], level='pool')

        if share is None:
            msg = _("Pool is not available in the volume host field.")
            raise exception.InvalidHost(reason=msg)

        extra_specs = na_utils.get_volume_extra_specs(volume)
        qos_policy_group = extra_specs.pop('netapp:qos_policy_group', None) \
            if extra_specs else None

        # warn on obsolete extra specs
        na_utils.log_extra_spec_warnings(extra_specs)

        try:
            volume['provider_location'] = share
            LOG.info(_LI('casted to %s') % volume['provider_location'])
            self._do_create_volume(volume)
            if qos_policy_group:
                self._set_qos_policy_group_on_volume(volume, share,
                                                     qos_policy_group)
            return {'provider_location': volume['provider_location']}
        except Exception as ex:
            LOG.error(_LW("Exception creating vol %(name)s on "
                          "share %(share)s. Details: %(ex)s")
                      % {'name': volume['name'],
                         'share': volume['provider_location'],
                         'ex': ex})
            volume['provider_location'] = None
        finally:
            if self.ssc_enabled:
                self._update_stale_vols(self._get_vol_for_share(share))

        msg = _("Volume %s could not be created on shares.")
        raise exception.VolumeBackendAPIException(data=msg % (volume['name']))
Exemple #10
0
    def create_volume(self, volume):
        """Driver entry point for creating a new volume (Data ONTAP LUN)."""

        LOG.debug('create_volume on %s' % volume['host'])

        # get Data ONTAP volume name as pool name
        ontap_volume_name = volume_utils.extract_host(volume['host'],
                                                      level='pool')

        if ontap_volume_name is None:
            msg = _("Pool is not available in the volume host field.")
            raise exception.InvalidHost(reason=msg)

        lun_name = volume['name']

        # start with default size, get requested size
        default_size = units.Mi * 100  # 100 MB
        size = default_size if not int(volume['size'])\
            else int(volume['size']) * units.Gi

        metadata = {'OsType': 'linux',
                    'SpaceReserved': 'true',
                    'Path': '/vol/%s/%s' % (ontap_volume_name, lun_name)}

        extra_specs = na_utils.get_volume_extra_specs(volume)
        qos_policy_group = extra_specs.pop('netapp:qos_policy_group', None) \
            if extra_specs else None

        # warn on obsolete extra specs
        na_utils.log_extra_spec_warnings(extra_specs)

        self._create_lun(ontap_volume_name, lun_name, size,
                         metadata, qos_policy_group)
        LOG.debug('Created LUN with name %s' % lun_name)

        metadata['Path'] = '/vol/%s/%s' % (ontap_volume_name, lun_name)
        metadata['Volume'] = ontap_volume_name
        metadata['Qtree'] = None

        handle = self._create_lun_handle(metadata)
        self._add_lun_to_table(NetAppLun(handle, lun_name, size, metadata))