Migration state machine.

Registered by Tang Chen on 2015-09-26

In the current code, migration statuses (Migration.status) are represented with pure String. So are image statuses, snapshot statuses, and event statuses.

It has the following demerits:

1. When we grep the code for migration statuses, we could get lots of noisy info we don't want.

   eg. When we want to grep migration status 'error', all the other statuses will also come out.

2. Sometimes, we use '' to wrap a string, but sometimes using "". So usually we need to grep twice for more precise results.

   eg. Grep "'migrating'" and "\"migrating\"". I found that in some test files, " " is used, but in other files, ' ' is used.

3. People could spell the string incorrectly, or give a different word to represent the same meaning.

   eg. In the current code, we have three statuses representing the migration is over: finish, completed and done. I really cannot tell the differences among them. (About this, I could be wrong. Please correct me.)

Nikola Dipanov has posted two patches to fix this problem by introducing a state machine for migration status. These two patches are part of another BP.
https://review.openstack.org/#/c/197668/
https://review.openstack.org/#/c/197669/

And also, Joshua Harlow has posted a patch to introduce a state machine builder, which is a common functionality.
https://review.openstack.org/#/c/203284/
The usage example is here:
http://paste.openstack.org/show/384853/

So the solution turns out to be: reuse the common state machine builder, and create a state machine for migration status.

For now, the work is abandoned now because the original fix of another problem may by pending. But the fix of migration status is still needed. And it will make many other work easier. So I'd like to go on with it through this BP.

Blueprint information

Status:
Started
Approver:
John Garbutt
Priority:
Medium
Drafter:
Tang Chen
Direction:
Needs approval
Assignee:
Tang Chen
Definition:
Pending Approval
Series goal:
None
Implementation:
Started
Milestone target:
None
Started by
John Garbutt on 2016-01-15

Related branches

Sprints

Whiteboard

Gerrit topic: https://review.openstack.org/#q,topic:bp/live-migration-statuses,n,z

The above patches have been abandoned. And the BP has been updated. Please review this new BP.
Gerrit topic: https://review.openstack.org/#q,topic:bp/migration-state-machine,n,z

Addressed by: https://review.openstack.org/235169
    Migration state machine
    (Abandoned)

Pending Patches
==============

Addressed by: https://review.openstack.org/241476
    WIP: Implement status machine for live-migration.

Addressed by: https://review.openstack.org/241477
    WIP: Implement status machine for resize.

Addressed by: https://review.openstack.org/241478
    WIP: Implement status machine for evacuation.

Addressed by: https://review.openstack.org/241479
    WIP: Implement status machine for migration.

Addressed by: https://review.openstack.org/241480
    WIP: Use status machines to manage the migraiton status.

Deferred till Newton --johnthetubaguy 2nd March 2016

Addressed by: https://review.openstack.org/320849
    Use finite machine in migration process

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.