'Sets the specified host\'s ability to accept new instances.
:param enabled: a boolean - if False no new VMs will be able to start
on the host.'

def _set_enabled_status(self, context, host_name, enabled):

    if enabled:
        LOG.info('Enabling    host    %s.', host_name)
    else:
        LOG.info('Disabling    host    %s.', host_name)
    try:
        result = self.api.set_host_enabled(context, host_name, enabled)
    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())
    if (result not in ('enabled', 'disabled')):
        raise webob.exc.HTTPBadRequest(explanation=result)
    return result
