Exemple #1
0
 def _setup_qos_for_volume(self, volume, extra_specs):
     try:
         qos_policy_group_info = na_utils.get_valid_qos_policy_group_info(volume, extra_specs)
     except exception.Invalid:
         msg = _("Invalid QoS specification detected while getting QoS " "policy for volume %s") % volume["id"]
         raise exception.VolumeBackendAPIException(data=msg)
     self.zapi_client.provision_qos_policy_group(qos_policy_group_info)
     return qos_policy_group_info
Exemple #2
0
    def test_get_valid_qos_policy_group_info_exception_path(self):
        mock_get_volume_type = self.mock_object(na_utils,
                                                'get_volume_type_from_volume')
        mock_get_volume_type.side_effect = exception.VolumeTypeNotFound
        expected = fake.QOS_POLICY_GROUP_INFO_NONE

        result = na_utils.get_valid_qos_policy_group_info(fake.VOLUME)

        self.assertEqual(expected, result)
Exemple #3
0
    def test_get_valid_qos_policy_group_info_volume_type_none(self):
        mock_get_volume_type = self.mock_object(na_utils,
                                                'get_volume_type_from_volume')
        mock_get_volume_type.return_value = None
        expected = fake.QOS_POLICY_GROUP_INFO_NONE

        result = na_utils.get_valid_qos_policy_group_info(fake.VOLUME)

        self.assertEqual(expected, result)
Exemple #4
0
    def test_get_valid_qos_policy_group_info_volume_type_none(self):
        mock_get_volume_type = self.mock_object(na_utils,
                                                'get_volume_type_from_volume')
        mock_get_volume_type.return_value = None
        expected = fake.QOS_POLICY_GROUP_INFO_NONE

        result = na_utils.get_valid_qos_policy_group_info(fake.VOLUME)

        self.assertEqual(expected, result)
Exemple #5
0
    def test_get_valid_qos_policy_group_info_exception_path(self):
        mock_get_volume_type = self.mock_object(na_utils,
                                                'get_volume_type_from_volume')
        mock_get_volume_type.side_effect = exception.VolumeTypeNotFound
        expected = fake.QOS_POLICY_GROUP_INFO_NONE

        result = na_utils.get_valid_qos_policy_group_info(fake.VOLUME)

        self.assertEqual(expected, result)
Exemple #6
0
 def _setup_qos_for_volume(self, volume, extra_specs):
     try:
         qos_policy_group_info = na_utils.get_valid_qos_policy_group_info(
             volume, extra_specs)
     except exception.Invalid:
         msg = _('Invalid QoS specification detected while getting QoS '
                 'policy for volume %s') % volume['id']
         raise exception.VolumeBackendAPIException(data=msg)
     self.zapi_client.provision_qos_policy_group(qos_policy_group_info)
     return qos_policy_group_info
Exemple #7
0
 def _do_qos_for_volume(self, volume, extra_specs, cleanup=True):
     try:
         qos_policy_group_info = na_utils.get_valid_qos_policy_group_info(volume, extra_specs)
         self.zapi_client.provision_qos_policy_group(qos_policy_group_info)
         self._set_qos_policy_group_on_volume(volume, qos_policy_group_info)
     except Exception:
         with excutils.save_and_reraise_exception():
             LOG.error(_LE("Setting QoS for %s failed"), volume["id"])
             if cleanup:
                 LOG.debug("Cleaning volume %s", volume["id"])
                 self._cleanup_volume_on_failure(volume)
Exemple #8
0
 def delete_volume(self, volume):
     """Deletes a logical volume."""
     self._delete_backing_file_for_volume(volume)
     try:
         qos_policy_group_info = na_utils.get_valid_qos_policy_group_info(
             volume)
         self.zapi_client.mark_qos_policy_group_for_deletion(
             qos_policy_group_info)
     except Exception:
         # Don't blow up here if something went wrong de-provisioning the
         # QoS policy for the volume.
         pass
Exemple #9
0
 def _do_qos_for_volume(self, volume, extra_specs, cleanup=True):
     try:
         qos_policy_group_info = na_utils.get_valid_qos_policy_group_info(
             volume, extra_specs)
         self.zapi_client.provision_qos_policy_group(qos_policy_group_info)
         self._set_qos_policy_group_on_volume(volume, qos_policy_group_info)
     except Exception:
         with excutils.save_and_reraise_exception():
             LOG.error("Setting QoS for %s failed", volume['id'])
             if cleanup:
                 LOG.debug("Cleaning volume %s", volume['id'])
                 self._cleanup_volume_on_failure(volume)
Exemple #10
0
 def delete_volume(self, volume):
     """Deletes a logical volume."""
     self._delete_backing_file_for_volume(volume)
     try:
         qos_policy_group_info = na_utils.get_valid_qos_policy_group_info(
             volume)
         self.zapi_client.mark_qos_policy_group_for_deletion(
             qos_policy_group_info)
     except Exception:
         # Don't blow up here if something went wrong de-provisioning the
         # QoS policy for the volume.
         pass
Exemple #11
0
    def unmanage(self, volume):
        """Removes the specified volume from Cinder management.

           Does not delete the underlying backend storage object.
        """
        try:
            qos_policy_group_info = na_utils.get_valid_qos_policy_group_info(volume)
        except exception.Invalid:
            # Unmanage even if there was invalid qos policy specified for the
            # volume.
            qos_policy_group_info = None
        self._mark_qos_policy_group_for_deletion(qos_policy_group_info)
        super(NetAppBlockStorageCmodeLibrary, self).unmanage(volume)
Exemple #12
0
    def delete_volume(self, volume):
        """Driver entry point for destroying existing volumes."""
        super(NetAppBlockStorageCmodeLibrary, self).delete_volume(volume)
        try:
            qos_policy_group_info = na_utils.get_valid_qos_policy_group_info(volume)
        except exception.Invalid:
            # Delete even if there was invalid qos policy specified for the
            # volume.
            qos_policy_group_info = None
        self._mark_qos_policy_group_for_deletion(qos_policy_group_info)

        msg = "Deleted LUN with name %(name)s and QoS info %(qos)s"
        LOG.debug(msg, {"name": volume["name"], "qos": qos_policy_group_info})
Exemple #13
0
 def _setup_qos_for_volume(self, volume, extra_specs):
     try:
         qos_policy_group_info = na_utils.get_valid_qos_policy_group_info(
             volume, extra_specs)
     except exception.Invalid:
         msg = _('Invalid QoS specification detected while getting QoS '
                 'policy for volume %s') % volume['id']
         raise exception.VolumeBackendAPIException(data=msg)
     pool = volume_utils.extract_host(volume['host'], level='pool')
     qos_min_support = self.ssc_library.is_qos_min_supported(pool)
     self.zapi_client.provision_qos_policy_group(qos_policy_group_info,
                                                 qos_min_support)
     return qos_policy_group_info
Exemple #14
0
    def delete_volume(self, volume):
        """Driver entry point for destroying existing volumes."""
        super(NetAppBlockStorageCmodeLibrary, self).delete_volume(volume)
        try:
            qos_policy_group_info = na_utils.get_valid_qos_policy_group_info(
                volume)
        except exception.Invalid:
            # Delete even if there was invalid qos policy specified for the
            # volume.
            qos_policy_group_info = None
        self._mark_qos_policy_group_for_deletion(qos_policy_group_info)

        msg = 'Deleted LUN with name %(name)s and QoS info %(qos)s'
        LOG.debug(msg, {'name': volume['name'], 'qos': qos_policy_group_info})
Exemple #15
0
 def delete_volume(self, volume):
     """Deletes a logical volume."""
     share = volume['provider_location']
     super(NetAppCmodeNfsDriver, self).delete_volume(volume)
     try:
         qos_policy_group_info = na_utils.get_valid_qos_policy_group_info(
             volume)
         self.zapi_client.mark_qos_policy_group_for_deletion(
             qos_policy_group_info)
     except Exception:
         # Don't blow up here if something went wrong de-provisioning the
         # QoS policy for the volume.
         pass
     self._post_prov_deprov_in_ssc(share)
Exemple #16
0
    def unmanage(self, volume):
        """Removes the specified volume from Cinder management.

           Does not delete the underlying backend storage object.
        """
        try:
            qos_policy_group_info = na_utils.get_valid_qos_policy_group_info(
                volume)
        except exception.Invalid:
            # Unmanage even if there was invalid qos policy specified for the
            # volume.
            qos_policy_group_info = None
        self._mark_qos_policy_group_for_deletion(qos_policy_group_info)
        super(NetAppBlockStorageCmodeLibrary, self).unmanage(volume)
Exemple #17
0
    def test_get_valid_spec_qos_policy_group_info(self):
        mock_get_volume_type = self.mock_object(na_utils,
                                                'get_volume_type_from_volume')
        mock_get_volume_type.return_value = fake.VOLUME_TYPE
        mock_get_legacy_qos_policy = self.mock_object(na_utils,
                                                      'get_legacy_qos_policy')
        mock_get_legacy_qos_policy.return_value = None
        mock_get_valid_qos_spec_from_volume_type = self.mock_object(
            na_utils, 'get_valid_backend_qos_spec_from_volume_type')
        mock_get_valid_qos_spec_from_volume_type.return_value =\
            fake.QOS_POLICY_GROUP_SPEC

        result = na_utils.get_valid_qos_policy_group_info(fake.VOLUME)

        self.assertEqual(fake.QOS_POLICY_GROUP_INFO, result)
Exemple #18
0
    def test_get_valid_legacy_qos_policy_group_info(self):
        mock_get_volume_type = self.mock_object(na_utils,
                                                'get_volume_type_from_volume')
        mock_get_volume_type.return_value = fake.VOLUME_TYPE
        mock_get_legacy_qos_policy = self.mock_object(na_utils,
                                                      'get_legacy_qos_policy')

        mock_get_legacy_qos_policy.return_value = fake.LEGACY_QOS
        mock_get_valid_qos_spec_from_volume_type = self.mock_object(
            na_utils, 'get_valid_backend_qos_spec_from_volume_type')
        mock_get_valid_qos_spec_from_volume_type.return_value = None
        self.mock_object(na_utils, 'check_for_invalid_qos_spec_combination')

        result = na_utils.get_valid_qos_policy_group_info(fake.VOLUME)

        self.assertEqual(fake.LEGACY_QOS_POLICY_GROUP_INFO, result)
Exemple #19
0
    def test_get_valid_spec_qos_policy_group_info(self):
        mock_get_volume_type = self.mock_object(na_utils,
                                                'get_volume_type_from_volume')
        mock_get_volume_type.return_value = fake.VOLUME_TYPE
        mock_get_legacy_qos_policy = self.mock_object(na_utils,
                                                      'get_legacy_qos_policy')
        mock_get_legacy_qos_policy.return_value = None
        mock_get_valid_qos_spec_from_volume_type = self.mock_object(
            na_utils, 'get_valid_backend_qos_spec_from_volume_type')
        mock_get_valid_qos_spec_from_volume_type.return_value =\
            fake.QOS_POLICY_GROUP_SPEC
        self.mock_object(na_utils, 'check_for_invalid_qos_spec_combination')

        result = na_utils.get_valid_qos_policy_group_info(fake.VOLUME)

        self.assertEqual(fake.QOS_POLICY_GROUP_INFO, result)
Exemple #20
0
    def unmanage(self, volume):
        """Removes the specified volume from Cinder management.

           Does not delete the underlying backend storage object. A log entry
           will be made to notify the Admin that the volume is no longer being
           managed.

           :param volume: Cinder volume to unmanage
        """
        try:
            qos_policy_group_info = na_utils.get_valid_qos_policy_group_info(volume)
            self.zapi_client.mark_qos_policy_group_for_deletion(qos_policy_group_info)
        except Exception:
            # Unmanage even if there was a problem deprovisioning the
            # associated qos policy group.
            pass

        super(NetAppCmodeNfsDriver, self).unmanage(volume)
Exemple #21
0
 def delete_volume(self, volume):
     """Driver entry point for destroying existing volumes."""
     lun = self.lun_table.get(volume["name"])
     netapp_vol = None
     if lun:
         netapp_vol = lun.get_metadata_property("Volume")
     super(NetAppBlockStorageCmodeLibrary, self).delete_volume(volume)
     try:
         qos_policy_group_info = na_utils.get_valid_qos_policy_group_info(volume)
     except exception.Invalid:
         # Delete even if there was invalid qos policy specified for the
         # volume.
         qos_policy_group_info = None
     self._mark_qos_policy_group_for_deletion(qos_policy_group_info)
     if netapp_vol:
         self._update_stale_vols(volume=ssc_cmode.NetAppVolume(netapp_vol, self.vserver))
     msg = "Deleted LUN with name %(name)s and QoS info %(qos)s"
     LOG.debug(msg, {"name": volume["name"], "qos": qos_policy_group_info})
Exemple #22
0
    def unmanage(self, volume):
        """Removes the specified volume from Cinder management.

           Does not delete the underlying backend storage object. A log entry
           will be made to notify the Admin that the volume is no longer being
           managed.

           :param volume: Cinder volume to unmanage
        """
        try:
            qos_policy_group_info = na_utils.get_valid_qos_policy_group_info(
                volume)
            self.zapi_client.mark_qos_policy_group_for_deletion(
                qos_policy_group_info)
        except Exception:
            # Unmanage even if there was a problem deprovisioning the
            # associated qos policy group.
            pass

        super(NetAppCmodeNfsDriver, self).unmanage(volume)
Exemple #23
0
 def delete_volume(self, volume):
     """Driver entry point for destroying existing volumes."""
     lun = self.lun_table.get(volume['name'])
     netapp_vol = None
     if lun:
         netapp_vol = lun.get_metadata_property('Volume')
     super(NetAppBlockStorageCmodeLibrary, self).delete_volume(volume)
     try:
         qos_policy_group_info = na_utils.get_valid_qos_policy_group_info(
             volume)
     except exception.Invalid:
         # Delete even if there was invalid qos policy specified for the
         # volume.
         qos_policy_group_info = None
     self._mark_qos_policy_group_for_deletion(qos_policy_group_info)
     if netapp_vol:
         self._update_stale_vols(
             volume=ssc_cmode.NetAppVolume(netapp_vol, self.vserver))
     msg = 'Deleted LUN with name %(name)s and QoS info %(qos)s'
     LOG.debug(msg, {'name': volume['name'], 'qos': qos_policy_group_info})
Exemple #24
0
 def _do_qos_for_volume(self, volume, extra_specs, cleanup=True):
     try:
         qos_policy_group_info = na_utils.get_valid_qos_policy_group_info(
             volume, extra_specs)
         pool = volume_utils.extract_host(volume['host'], level='pool')
         qos_min_support = self.ssc_library.is_qos_min_supported(pool)
         qos_policy_group_is_adaptive = (
             volume_utils.is_boolean_str(
                 extra_specs.get('netapp:qos_policy_group_is_adaptive'))
             or na_utils.is_qos_policy_group_spec_adaptive(
                 qos_policy_group_info))
         self.zapi_client.provision_qos_policy_group(
             qos_policy_group_info, qos_min_support)
         self._set_qos_policy_group_on_volume(volume, qos_policy_group_info,
                                              qos_policy_group_is_adaptive)
     except Exception:
         with excutils.save_and_reraise_exception():
             LOG.error("Setting QoS for %s failed", volume['id'])
             if cleanup:
                 LOG.debug("Cleaning volume %s", volume['id'])
                 self._cleanup_volume_on_failure(volume)
Exemple #25
0
    def _is_share_vol_type_match(self, volume, share):
        """Checks if share matches volume type."""
        netapp_vol = self._get_vol_for_share(share)
        LOG.debug("Found volume %(vol)s for share %(share)s.",
                  {'vol': netapp_vol, 'share': share})
        extra_specs = na_utils.get_volume_extra_specs(volume)
        vols = ssc_cmode.get_volumes_for_specs(self.ssc_vols, extra_specs)
        return netapp_vol in vols

    def delete_volume(self, volume):
        """Deletes a logical volume."""
        share = volume['provider_location']
        self._delete_backing_file_for_volume(volume)
<<<<<<< HEAD
        try:
            qos_policy_group_info = na_utils.get_valid_qos_policy_group_info(
                volume)
            self.zapi_client.mark_qos_policy_group_for_deletion(
                qos_policy_group_info)
        except Exception:
            # Don't blow up here if something went wrong de-provisioning the
            # QoS policy for the volume.
            pass
=======
>>>>>>> refs/remotes/openstack/stable/kilo
        self._post_prov_deprov_in_ssc(share)

    def _delete_backing_file_for_volume(self, volume):
        """Deletes file on nfs share that backs a cinder volume."""
        try:
            LOG.debug('Deleting backing file for volume %s.', volume['id'])
            self._delete_volume_on_filer(volume)