'Reboots, shuts down or powers up the host.'

def _host_power_action(self, req, host_name, action):

    context = req.environ['nova.context']
    context.can(hosts_policies.BASE_POLICY_NAME)
    try:
        result = self.api.host_power_action(context, host_name, action)
    except NotImplementedError:
        common.raise_feature_not_supported()
    except (exception.HostNotFound, exception.HostMappingNotFound) as e:
        raise webob.exc.HTTPNotFound(explanation=e.format_message())
    except exception.ComputeServiceUnavailable as e:
        raise webob.exc.HTTPBadRequest(explanation=e.format_message())
    return {'host': host_name, 'power_action': result}
