'Sets the compute host\'s ability to accept new instances.'

def _set_host_enabled(self, enabled):

    ctx = context.get_admin_context()
    service = objects.Service.get_by_compute_host(ctx, CONF.host)
    service.disabled = (not enabled)
    service.disabled_reason = 'set    by    vmwareapi    host_state'
    service.save()
    self._auto_service_disabled = service.disabled
