Sandro Bonazzola has posted comments on this change.
Change subject: WIP agent: update logic and use state machine
......................................................................
Patch Set 2:
(5 comments)
....................................................
File ovirt_hosted_engine_ha/agent/hosted_engine.py
Line 638: def _handle_entry(self):
Line 639: """
Line 640: ENTRY state. Determine current vm state and switch
appropriately.
Line 641: """
Line 642: local_host_id = self._local_state['host-id']
what about using a tuple (state, bool) and just use 1 return ?
Line 643: if self._all_host_stats[local_host_id]['engine-status'][:5]
== 'vm-up':
Line 644: return self.States.ON, False
Line 645: else:
Line 646: return self.States.OFF, False
Line 660: self._log.info("Engine vm unexpectedly running
locally,"
Line 661: " monitoring vm")
Line 662: # FIXME maintenance bit should prevent this
transition; in
Line 663: # fact, it should trigger STOP and then IDLE or
similar
Line 664: return self.States.ON, False
also here
Line 665: else:
Line 666: self._log.info(
Line 667: "Engine vm is running on host %s (id %d)",
Line 668: self._all_host_stats[engine_host_id]['hostname'],
Line 697: self._local_state['last-engine-retry'] = time.time()
Line 698: self._local_state['engine-retries'] += 1
Line 699: # TODO mail for error (each time, or after n retries?)
Line 700: # OFF handler will retry based on host score
Line 701: return self.States.OFF, True
also here
Line 702: else:
Line 703: self._local_state['last-engine-retry'] = 0
Line 704: self._local_state['engine-retries'] = 0
Line 705: return self.States.ON, True
Line 733: def _handle_on(self):
Line 734: """
Line 735: ON state. See if the VM was stopped or needs to be stopped.
Line 736: """
Line 737: local_host_id = self._local_state['host-id']
also here
Line 738: if self._cur_stats['best-engine-status'][:5] != 'vm-up':
Line 739: self._log.error("Engine vm died unexpectedly")
Line 740: return self.States.OFF, False
Line 741: elif self._cur_stats['best-engine-status-host-id'] !=
local_host_id:
Line 742: self._log.error("Engine vm unexpectedly running on other
host")
Line 743: return self.States.OFF, True
Line 744:
Line 745: # FIXME migration if other hosts are found to be
significantly better
Line 746: # TODO check for health, just just liveness
just just
Line 747: self._log.info("Engine vm running on localhost")
Line 748: return self.States.ON, True
Line 749:
Line 750: def _handle_stop(self):
--
To view, visit http://gerrit.ovirt.org/18051
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Iad9906d50a5fffb4c9f362b43f0064bf6be4dbde
Gerrit-PatchSet: 2
Gerrit-Project: ovirt-hosted-engine-ha
Gerrit-Branch: master
Gerrit-Owner: Greg Padgett <[email protected]>
Gerrit-Reviewer: Oved Ourfali <[email protected]>
Gerrit-Reviewer: Sandro Bonazzola <[email protected]>
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches