Change in ovirt-hosted-engine-ha[master]: Separate the state machine into machine, states with logic a...

msivak at redhat.com msivak at redhat.com
Wed Feb 19 16:24:24 UTC 2014


Martin Sivák has submitted this change and it was merged.

Change subject: Separate the state machine into machine, states with logic and communication
......................................................................


Separate the state machine into machine, states with logic and communication

The FSM is designed in such a way that each state is essentially
immutable and knows only about the world that was seen when the
state was created.

When consume is called it uses the remembered info and the new info
to determine where to go next and returns a new state instance.

This allows us to write unit tests for each state without having
to mock anything as all decisions are based only on passed immutable
structures.

This patch also kills some of the timers we used and replaces them
with separate states and universal check_timer decorator.

Change-Id: Icad82e819b653cd8b9210d0a71e0312fc6b20134
Signed-off-by: Martin Sivak <msivak at redhat.com>
---
M configure.ac
M ovirt_hosted_engine_ha/agent/Makefile.am
M ovirt_hosted_engine_ha/agent/agent.py
M ovirt_hosted_engine_ha/agent/hosted_engine.py
A ovirt_hosted_engine_ha/agent/state_data.py
A ovirt_hosted_engine_ha/agent/state_decorators.py
A ovirt_hosted_engine_ha/agent/state_machine.py
A ovirt_hosted_engine_ha/agent/states.py
M ovirt_hosted_engine_ha/lib/Makefile.am
A ovirt_hosted_engine_ha/lib/fsm/Makefile.am
A ovirt_hosted_engine_ha/lib/fsm/__init__.py
A ovirt_hosted_engine_ha/lib/fsm/machine.py
M ovirt_hosted_engine_ha/lib/metadata.py
M ovirt_hosted_engine_ha/lib/util.py
14 files changed, 1,565 insertions(+), 842 deletions(-)

Approvals:
  Sandro Bonazzola: Looks good to me, but someone else must approve
  Martin Sivák: Verified; Looks good to me, approved
  Greg Padgett: Looks good to me, approved



-- 
To view, visit http://gerrit.ovirt.org/24333
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Icad82e819b653cd8b9210d0a71e0312fc6b20134
Gerrit-PatchSet: 8
Gerrit-Project: ovirt-hosted-engine-ha
Gerrit-Branch: master
Gerrit-Owner: Martin Sivák <msivak at redhat.com>
Gerrit-Reviewer: Doron Fediuck <dfediuck at redhat.com>
Gerrit-Reviewer: Greg Padgett <gpadgett at redhat.com>
Gerrit-Reviewer: Jiří Moskovčák <jmoskovc at redhat.com>
Gerrit-Reviewer: Martin Sivák <msivak at redhat.com>
Gerrit-Reviewer: Sandro Bonazzola <sbonazzo at redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server



More information about the Engine-commits mailing list