def stub_set_host_enabled(context, host_name, enabled):
    results = {True: "enabled", False: "disabled"}
    if host_name == "notimplemented":
        # The vm driver for this host doesn't support this feature
        raise NotImplementedError()
    elif host_name == "dummydest":
        # The host does not exist
        raise exception.ComputeHostNotFound(host=host_name)
    elif host_name == "service_not_available":
        # The service is not available
        raise exception.ComputeServiceUnavailable(host=host_name)
    elif host_name == "host_c2":
        # Simulate a failure
        return results[not enabled]
    else:
        # Do the right thing
        return results[enabled]
Simulates three possible behaviours for VM drivers or compute
dataset/ETHPy150Open openstack/nova/nova/tests/unit/api/openstack/compute/test_hosts.py/stub_set_host_enabled