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)
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)
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})
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)
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)
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 })
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)