def try_start_testing(self, host_id, claim_id): with self._lock: host = self._hostlist.get_by_id(host_id) if host: if host.get_state() == FSMStates.AF_TESTING: log.msg('Host already in Start Testing state') return event = HostEvent(FSMEvents.AE_START_TESTING, claim_id) host.send_event(event)
def reclaim_host(self, host_id, claim_id): with self._lock: host = self._hostlist.get_by_id(host_id) if host: reclaim_event = HostEvent(FSMEvents.AE_RECLAIM, claim_id) accepted = host.send_event(reclaim_event) if accepted: return host return None
def schedule(self, host_id, claim_id, test_script): with self._lock: host = self._hostlist.get_by_id(host_id) if host: schedule_event = HostEvent(FSMEvents.AE_SCHEDULE_TEST, test_script) accepted = host.send_event(schedule_event) if accepted: return host return None
def execution_done(self, hostname): with self._lock: host = self._hostlist.get_by_hostname(hostname) if host: event = HostEvent(FSMEvents.AE_STOP_TESTING) host.send_event(event)
def set_alive(self, alive): super(DynamicHost, self).set_alive(alive) with self._lock: if alive == HostAlive.HA_ALIVE: self._fsm.execute(HostEvent(FSMEvents.AE_WAKE))
def decrease_age(self): super(DynamicHost, self).decrease_age() with self._lock: if self._age == 0: self._fsm.execute(HostEvent(FSMEvents.AE_DEMISE))