Example #1
0
def volume_update_db(context, volume_id, host):
    '''Set the host and set the scheduled_at field of a volume.

    :returns: A Volume with the updated fields set properly.
    '''
    now = timeutils.utcnow()
    values = {'host': host, 'scheduled_at': now}
    return db.volume_update(context, volume_id, values)
Example #2
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)
Example #3
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)