centralize all migration status together

Bug #1549558 reported by lvmxh
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Triaged
Low
Unassigned

Bug Description

now the migration status in nova is hard-code.

They are defined arbitrary.
Such as, we need a "cancelled" status, then we defined it where where want.

1. firstly
this is not a good program style.

2. this is error prone.
such as we need a list of in-progress status migrations.
we need to do the follow command to summarize all migration status firstly.
this is easy to missing some status.

$ git grep "mig.*status"
......
nova/compute/api.py: migration.status = 'confirming'
nova/compute/api.py: mig.status = 'finished'
nova/compute/api.py: if migration.status != 'running':
nova/compute/api.py: state=migration.status,
nova/compute/manager.py: # decorated function, migration status should be set to
nova/compute/manager.py: # 'error', without checking current migration status.
nova/compute/manager.py: status = migration.status
nova/compute/manager.py: migration.status = 'error'
......

lvmxh (shaohef)
Changed in nova:
assignee: nobody → lvmxh (shaohef)
Revision history for this message
lvmxh (shaohef) wrote :

we need to clean up these migration status.

an ideal solution

we define a new file such as status.py

def class MigeationStatus(Object):
       ERROR='error'
       RUNNING="running"
.......

This is just a simple.

Then clean up all files using migration.status hard code.

$ git grep "mig.*status" | grep .py |awk '{print $1}' |sort | uniq
nova/api/openstack/compute/server_migrations.py:
nova/compute/api.py:
nova/compute/manager.py:
nova/compute/resource_tracker.py:
nova/conductor/manager.py:
nova/conductor/tasks/live_migrate.py:
nova/db/api.py:
nova/db/api.py:def
nova/db/sqlalchemy/api.py:def
nova/db/sqlalchemy/migrate_repo/versions/216_havana.py:
nova/db/sqlalchemy/models.py:
nova/objects/migration.py:
nova/tests/functional/api_sample_tests/test_server_migrations.py:
nova/tests/unit/api/openstack/compute/test_server_migrations.py:
nova/tests/unit/compute/test_compute.py:
nova/tests/unit/compute/test_compute_api.py:
nova/tests/unit/compute/test_compute_mgr.py:
nova/tests/unit/compute/test_resource_tracker.py:
nova/tests/unit/conductor/tasks/test_live_migrate.py:
nova/tests/unit/conductor/test_conductor.py:
nova/tests/unit/db/test_db_api.py:
nova/tests/unit/objects/test_migration.py:
nova/virt/libvirt/driver.py:

Revision history for this message
Sean Dague (sdague) wrote :

If done, this should be like nova/compute files arch.py, task_states.py, vm_states.py

Changed in nova:
status: New → Triaged
importance: Undecided → Low
tags: added: live-migration refactor
Revision history for this message
John Garbutt (johngarbutt) wrote :

well, an enum field in the object makes good sense to me.

Revision history for this message
Sarafraj Singh (sarafraj-singh) wrote :

Shaohef,
Are you working on the fix? Please change status to Inprogress if you are, otherwise change Assigned to ->nobody.

Sean Dague (sdague)
Changed in nova:
assignee: lvmxh (shaohef) → nobody
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.