示例#1
0
    def execute(self, context, volume, manage_existing_ref):
        driver_name = self.driver.__class__.__name__
        if not self.driver.initialized:
            LOG.error("Unable to manage existing volume. "
                      "Volume driver %s not initialized.", driver_name)
            flow_common.error_out(volume, _("Volume driver %s not "
                                            "initialized.") % driver_name,
                                  status='error_managing')
            raise exception.DriverNotInitialized()

        size = 0
        try:
            size = self.driver.manage_existing_get_size(volume,
                                                        manage_existing_ref)
        except Exception:
            with excutils.save_and_reraise_exception():
                reason = _("Volume driver %s get exception.") % driver_name
                flow_common.error_out(volume, reason,
                                      status='error_managing')

        return {'size': size,
                'volume_type_id': volume.volume_type_id,
                'volume_properties': volume,
                'volume_spec': {'status': volume.status,
                                'volume_name': volume.name,
                                'volume_id': volume.id}}
示例#2
0
    def revert(self, context, result, flow_failures, volume, **kwargs):
        # NOTE(dulek): Revert is occurring and manager need to know if
        # rescheduling happened. We're returning boolean flag that will
        # indicate that. It which will be available in flow engine store
        # through get_revert_result method.

        # If do not want to be rescheduled, just set the volume's status to
        # error and return.
        if not self.do_reschedule:
            common.error_out(volume)
            LOG.error("Volume %s: create failed", volume.id)
            return False

        # Check if we have a cause which can tell us not to reschedule and
        # set the volume's status to error.
        for failure in flow_failures.values():
            if failure.check(*self.no_reschedule_types):
                common.error_out(volume)
                LOG.error("Volume %s: create failed", volume.id)
                return False

        # Use a different context when rescheduling.
        if self.reschedule_context:
            cause = list(flow_failures.values())[0]
            context = self.reschedule_context
            try:
                self._pre_reschedule(volume)
                self._reschedule(context, cause, volume=volume, **kwargs)
                self._post_reschedule(volume)
                return True
            except exception.CinderException:
                LOG.exception("Volume %s: rescheduling failed", volume.id)

        return False
示例#3
0
    def revert(self, context, volume, result, **kwargs):
        if isinstance(result, ft.Failure) or not self.set_error:
            return

        reason = _('Volume create failed while extracting volume ref.')
        common.error_out(volume, reason)
        LOG.error("Volume %s: create failed", volume.id)
    def execute(self, context, volume, manage_existing_ref):
        driver_name = self.driver.__class__.__name__
        if not self.driver.initialized:
            LOG.error(_LE("Unable to manage existing volume. "
                          "Volume driver %s not initialized.") % driver_name)
            flow_common.error_out(volume, _("Volume driver %s not "
                                            "initialized.") % driver_name,
                                  status='error_managing')
            raise exception.DriverNotInitialized()

        size = 0
        try:
            size = self.driver.manage_existing_get_size(volume,
                                                        manage_existing_ref)
        except Exception:
            with excutils.save_and_reraise_exception():
                reason = _("Volume driver %s get exception.") % driver_name
                flow_common.error_out(volume, reason,
                                      status='error_managing')

        return {'size': size,
                'volume_type_id': volume.volume_type_id,
                'volume_properties': volume,
                'volume_spec': {'status': volume.status,
                                'volume_name': volume.name,
                                'volume_id': volume.id}}
示例#5
0
    def revert(self, context, result, flow_failures, volume, **kwargs):
        # NOTE(dulek): Revert is occurring and manager need to know if
        # rescheduling happened. We're returning boolean flag that will
        # indicate that. It which will be available in flow engine store
        # through get_revert_result method.

        # If do not want to be rescheduled, just set the volume's status to
        # error and return.
        if not self.do_reschedule:
            common.error_out(volume)
            LOG.error("Volume %s: create failed", volume.id)
            return False

        # Check if we have a cause which can tell us not to reschedule and
        # set the volume's status to error.
        for failure in flow_failures.values():
            if failure.check(*self.no_reschedule_types):
                common.error_out(volume)
                LOG.error("Volume %s: create failed", volume.id)
                return False

        # Use a different context when rescheduling.
        if self.reschedule_context:
            cause = list(flow_failures.values())[0]
            context = self.reschedule_context
            try:
                self._pre_reschedule(volume)
                self._reschedule(context, cause, volume=volume, **kwargs)
                self._post_reschedule(volume)
                return True
            except exception.CinderException:
                LOG.exception("Volume %s: rescheduling failed", volume.id)

        return False
示例#6
0
    def execute(self, context, volume_ref, manage_existing_ref):
        volume_id = volume_ref.id
        if not self.driver.initialized:
            driver_name = self.driver.__class__.__name__
            LOG.error(
                _LE("Unable to manage existing volume. "
                    "Volume driver %s not initialized.") % driver_name)
            flow_common.error_out(
                volume_ref,
                _("Volume driver %s not "
                  "initialized.") % driver_name)
            raise exception.DriverNotInitialized()

        size = self.driver.manage_existing_get_size(volume_ref,
                                                    manage_existing_ref)

        return {
            'size': size,
            'volume_type_id': volume_ref.volume_type_id,
            'volume_properties': volume_ref,
            'volume_spec': {
                'status': volume_ref.status,
                'volume_name': volume_ref.name,
                'volume_id': volume_id
            }
        }
示例#7
0
    def revert(self, context, volume, result, **kwargs):
        if isinstance(result, ft.Failure) or not self.set_error:
            return

        reason = _('Volume create failed while extracting volume ref.')
        common.error_out(volume, reason)
        LOG.error("Volume %s: create failed", volume.id)
示例#8
0
 def revert(self, context, result, flow_failures, volume, **kwargs):
     # Restore the source volume status and set the volume to error status.
     common.error_out(volume, status='error_managing')
     LOG.error(_LE("Volume %s: manage failed."), volume.id)
     exc_info = False
     if all(flow_failures[-1].exc_info):
         exc_info = flow_failures[-1].exc_info
     LOG.error(_LE('Unexpected build error:'), exc_info=exc_info)
 def revert(self, context, result, flow_failures, volume, **kwargs):
     # Restore the source volume status and set the volume to error status.
     common.error_out(volume, status='error_managing')
     LOG.error(_LE("Volume %s: manage failed."), volume.id)
     exc_info = False
     if all(flow_failures[-1].exc_info):
         exc_info = flow_failures[-1].exc_info
     LOG.error(_LE('Unexpected build error:'), exc_info=exc_info)
    def revert(self, context, result, flow_failures, volume, **kwargs):
        if isinstance(result, ft.Failure):
            return

        # Restore the source volume status and set the volume to error status.
        common.restore_source_status(context, self.db, kwargs)
        common.error_out(volume)
        LOG.error("Volume %s: create failed", volume.id)
        exc_info = False
        if all(flow_failures[-1].exc_info):
            exc_info = flow_failures[-1].exc_info
        LOG.error('Unexpected build error:', exc_info=exc_info)
    def execute(self, context, snapshot_ref, manage_existing_ref):
        if not self.driver.initialized:
            driver_name = (
                self.driver.configuration.safe_get('volume_backend_name'))
            LOG.error(
                _LE("Unable to manage existing snapshot. "
                    "Volume driver %s not initialized."), driver_name)
            flow_common.error_out(snapshot_ref,
                                  reason=_("Volume driver %s "
                                           "not initialized.") % driver_name)
            raise exception.DriverNotInitialized()

        size = self.driver.manage_existing_snapshot_get_size(
            snapshot=snapshot_ref, existing_ref=manage_existing_ref)

        return {'size': size, 'snapshot_properties': snapshot_ref}
    def execute(self, context, snapshot_ref, manage_existing_ref):
        if not self.driver.initialized:
            driver_name = (self.driver.configuration.
                           safe_get('volume_backend_name'))
            LOG.error("Unable to manage existing snapshot. "
                      "Volume driver %s not initialized.", driver_name)
            flow_common.error_out(snapshot_ref, reason=_("Volume driver %s "
                                                         "not initialized.") %
                                  driver_name)
            raise exception.DriverNotInitialized()

        size = self.driver.manage_existing_snapshot_get_size(
            snapshot=snapshot_ref,
            existing_ref=manage_existing_ref)

        return {'size': size,
                'snapshot_properties': snapshot_ref}
示例#13
0
 def execute(self, context, request_spec, filter_properties, volume):
     try:
         self.driver_api.schedule_create_volume(context, request_spec,
                                                filter_properties)
     except Exception as e:
         self.message_api.create(
             context,
             message_field.Action.SCHEDULE_ALLOCATE_VOLUME,
             resource_uuid=request_spec['volume_id'],
             exception=e)
         # An error happened, notify on the scheduler queue and log that
         # this happened and set the volume to errored out and reraise the
         # error *if* exception caught isn't NoValidBackend. Otherwise *do
         # not* reraise (since what's the point?)
         with excutils.save_and_reraise_exception(
                 reraise=not isinstance(e, exception.NoValidBackend)):
             try:
                 self._handle_failure(context, request_spec, e)
             finally:
                 common.error_out(volume, reason=e)
示例#14
0
 def execute(self, context, request_spec, filter_properties, volume):
     try:
         self.driver_api.schedule_create_volume(context, request_spec,
                                                filter_properties)
     except Exception as e:
         self.message_api.create(
             context,
             message_field.Action.SCHEDULE_ALLOCATE_VOLUME,
             resource_uuid=request_spec['volume_id'],
             exception=e)
         # An error happened, notify on the scheduler queue and log that
         # this happened and set the volume to errored out and reraise the
         # error *if* exception caught isn't NoValidBackend. Otherwise *do
         # not* reraise (since what's the point?)
         with excutils.save_and_reraise_exception(
                 reraise=not isinstance(e, exception.NoValidBackend)):
             try:
                 self._handle_failure(context, request_spec, e)
             finally:
                 common.error_out(volume, reason=e)
示例#15
0
 def execute(self, context, request_spec, filter_properties, volume):
     try:
         self.driver_api.schedule_create_volume(context, request_spec,
                                                filter_properties)
     except Exception as e:
         # An error happened, notify on the scheduler queue and log that
         # this happened and set the volume to errored out and reraise the
         # error *if* exception caught isn't NoValidHost. Otherwise *do not*
         # reraise (since what's the point?)
         with excutils.save_and_reraise_exception(
                 reraise=not isinstance(e, exception.NoValidHost)):
             if isinstance(e, exception.NoValidHost):
                 self.message_api.create(
                     context,
                     defined_messages.UNABLE_TO_ALLOCATE,
                     context.project_id,
                     resource_type=resource_types.VOLUME,
                     resource_uuid=request_spec['volume_id'])
             try:
                 self._handle_failure(context, request_spec, e)
             finally:
                 common.error_out(volume, reason=e)
示例#16
0
 def execute(self, context, request_spec, filter_properties, volume):
     try:
         self.driver_api.schedule_create_volume(context, request_spec,
                                                filter_properties)
     except Exception as e:
         # An error happened, notify on the scheduler queue and log that
         # this happened and set the volume to errored out and reraise the
         # error *if* exception caught isn't NoValidHost. Otherwise *do not*
         # reraise (since what's the point?)
         with excutils.save_and_reraise_exception(
                 reraise=not isinstance(e, exception.NoValidHost)):
             if isinstance(e, exception.NoValidHost):
                 self.message_api.create(
                     context,
                     defined_messages.UNABLE_TO_ALLOCATE,
                     context.project_id,
                     resource_type=resource_types.VOLUME,
                     resource_uuid=request_spec['volume_id'])
             try:
                 self._handle_failure(context, request_spec, e)
             finally:
                 common.error_out(volume, reason=e)
示例#17
0
 def revert(self, context, result, flow_failures, volume_ref, **kwargs):
     volume_id = volume_ref.id
     reason = _('Volume manage failed.')
     flow_common.error_out(volume_ref, reason=reason)
     LOG.error(_LE("Volume %s: manage failed."), volume_id)
示例#18
0
 def revert(self, context, result, flow_failures, volume, **kwargs):
     reason = _('Volume manage failed.')
     flow_common.error_out(volume, reason=reason,
                           status='error_managing')
     LOG.error(_LE("Volume %s: manage failed."), volume.id)
示例#19
0
 def revert(self, context, result, flow_failures, volume, **kwargs):
     reason = _('Volume manage failed.')
     flow_common.error_out(volume, reason=reason,
                           status='error_managing')
     LOG.error("Volume %s: manage failed.", volume.id)
    def revert(self, context, snapshot_id, result, **kwargs):
        if isinstance(result, ft.Failure):
            return

        flow_common.error_out(result)
        LOG.error(_LE("Snapshot %s: create failed"), result.id)
    def revert(self, context, snapshot_id, result, **kwargs):
        if isinstance(result, ft.Failure):
            return

        flow_common.error_out(result)
        LOG.error("Snapshot %s: create failed", result.id)