예제 #1
0
파일: manager.py 프로젝트: sombrafam/cinder
    def _set_volume_state_and_notify(self, method, updates, context, ex,
                                     request_spec, msg=None):
        # TODO(harlowja): move into a task that just does this later.
        if not msg:
            msg = (_("Failed to schedule_%(method)s: %(ex)s") %
                   {'method': method, 'ex': ex})
        LOG.error(msg)

        volume_state = updates['volume_state']
        properties = request_spec.get('volume_properties', {})

        volume_id = request_spec.get('volume_id', None)

        if volume_id:
            db.volume_update(context, volume_id, volume_state)

        payload = dict(request_spec=request_spec,
                       volume_properties=properties,
                       volume_id=volume_id,
                       state=volume_state,
                       method=method,
                       reason=ex)

        notifier.notify(context, notifier.publisher_id("scheduler"),
                        'scheduler.' + method, notifier.ERROR, payload)
예제 #2
0
    def _set_volume_state_and_notify(self, method, updates, context, ex,
                                     request_spec):
        # TODO(harlowja): move into a task that just does this later.

        LOG.error(
            _("Failed to schedule_%(method)s: %(ex)s") % {
                'method': method,
                'ex': ex
            })

        volume_state = updates['volume_state']
        properties = request_spec.get('volume_properties', {})

        volume_id = request_spec.get('volume_id', None)

        if volume_id:
            db.volume_update(context, volume_id, volume_state)

        payload = dict(request_spec=request_spec,
                       volume_properties=properties,
                       volume_id=volume_id,
                       state=volume_state,
                       method=method,
                       reason=ex)

        notifier.notify(context, notifier.publisher_id("scheduler"),
                        'scheduler.' + method, notifier.ERROR, payload)
예제 #3
0
 def _notify_failure(cause):
     """When scheduling fails send out a event that it failed."""
     topic = "scheduler.create_volume"
     payload = {
         'request_spec': request_spec,
         'volume_properties': request_spec.get('volume_properties', {}),
         'volume_id': volume_id,
         'state': 'error',
         'method': 'create_volume',
         'reason': cause,
     }
     try:
         publisher_id = notifier.publisher_id("scheduler")
         notifier.notify(context, publisher_id, topic, notifier.ERROR,
                         payload)
     except exception.CinderException:
         LOG.exception(_("Failed notifying on %(topic)s "
                         "payload %(payload)s") % {'topic': topic,
                                                   'payload': payload})
예제 #4
0
파일: manager.py 프로젝트: artofwar/stack
    def _set_volume_state_and_notify(self, method, updates, context, ex,
                                     request_spec):
        LOG.warning(_("Failed to schedule_%(method)s: %(ex)s") % locals())

        volume_state = updates['volume_state']
        properties = request_spec.get('volume_properties', {})

        volume_id = request_spec.get('volume_id', None)

        if volume_id:
            db.volume_update(context, volume_id, volume_state)

        payload = dict(request_spec=request_spec,
                       volume_properties=properties,
                       volume_id=volume_id,
                       state=volume_state,
                       method=method,
                       reason=ex)

        notifier.notify(context, notifier.publisher_id("scheduler"),
                        'scheduler.' + method, notifier.ERROR, payload)
예제 #5
0
    def _set_volume_state_and_notify(self, method, updates, context, ex,
                                     request_spec):
        LOG.error(_("Failed to schedule_%(method)s: %(ex)s") % locals())

        volume_state = updates['volume_state']
        properties = request_spec.get('volume_properties', {})

        volume_id = request_spec.get('volume_id', None)

        if volume_id:
            db.volume_update(context, volume_id, volume_state)

        payload = dict(request_spec=request_spec,
                       volume_properties=properties,
                       volume_id=volume_id,
                       state=volume_state,
                       method=method,
                       reason=ex)

        notifier.notify(context, notifier.publisher_id("scheduler"),
                        'scheduler.' + method, notifier.ERROR, payload)
예제 #6
0
 def _notify_failure(cause):
     """When scheduling fails send out a event that it failed."""
     topic = "scheduler.create_volume"
     payload = {
         'request_spec': request_spec,
         'volume_properties': request_spec.get('volume_properties', {}),
         'volume_id': volume_id,
         'state': 'error',
         'method': 'create_volume',
         'reason': cause,
     }
     try:
         publisher_id = notifier.publisher_id("scheduler")
         notifier.notify(context, publisher_id, topic, notifier.ERROR,
                         payload)
     except exception.CinderException:
         LOG.exception(
             _("Failed notifying on %(topic)s "
               "payload %(payload)s") % {
                   'topic': topic,
                   'payload': payload
               })
예제 #7
0
파일: manager.py 프로젝트: ugvddm/cinder
    def _set_volume_state_and_notify(self, method, updates, context, ex, request_spec):
        # TODO(harlowja): move into a task that just does this later.

        LOG.error(_("Failed to schedule_%(method)s: %(ex)s") % {"method": method, "ex": ex})

        volume_state = updates["volume_state"]
        properties = request_spec.get("volume_properties", {})

        volume_id = request_spec.get("volume_id", None)

        if volume_id:
            db.volume_update(context, volume_id, volume_state)

        payload = dict(
            request_spec=request_spec,
            volume_properties=properties,
            volume_id=volume_id,
            state=volume_state,
            method=method,
            reason=ex,
        )

        notifier.notify(context, notifier.publisher_id("scheduler"), "scheduler." + method, notifier.ERROR, payload)