'Calculate action dictionary dependent on provided fields'

def _perform_action(self, req, id, body, actions):

    context = req.environ['nova.context']
    context.can(services_policies.BASE_POLICY_NAME)
    try:
        action = actions[id]
    except KeyError:
        msg = _('Unknown    action')
        raise webob.exc.HTTPNotFound(explanation=msg)
    return action(body, context)
