+1, a good idea, it will make it more clear. from implementation perspective we need to pay attention that some status will pass through and some will just return
Best Regards! Kevin (Chen) Ji 纪 晨 Engineer, zVM Development, CSTL Notes: Chen CH Ji/China/IBM@IBMCN Internet: [email protected] Phone: +86-10-82454158 Address: 3/F Ring Building, ZhongGuanCun Software Park, Haidian District, Beijing 100193, PRC From: Eli Qiao <[email protected]> To: "OpenStack Development Mailing List (not for usage questions)" <[email protected]> Date: 11/04/2014 03:13 PM Subject: [openstack-dev] [nova][compute] propose to use a table to deal with the vm_state when _init_instance in compute hello all: in current _init_instance function in compute manager, there's flood 'and' 'or' logic, to check the vm_state and task_state when initialize a instance during service list, this lead hard to read and hard to maintain, so I propose a new way to handle this. we can create a vm_state_table, by look up the table we can find the action we need to do for the instance, from this table , you can clearly see what vm_state and task_state should take the action. for example: {vm_states list :{task_states list: action}}, each entry stands for an action, and we walk though the tuple so the table should be like this: vm_state_table = ( {vm_states.SOFT_DELETE :{'ALL': ACTION_NONE}}, {vm_states.ERROR: {('NOT_IN',[task_states.RESIZE_MIGRATING, task_states.DELETING]): ACTION_NONE}}, {vm_states.DELETED: {'ALL': _complete_partial_deletion}}, {vm_states.BUILDING: {'ALL': ACTION_ERROR}}, {'ALL': {('IN',[task_states.SCHEDULING, task_states.BLOCK_DEVICE_MAPPING, task_states.NETWORKING, task_states.SPAWNING)]: ACTION_ERROR}}, {('IN',[vm_states.ACTIVE, vm_states.STOPPED]: {('IN', [task_states.REBUILDING, task_states.REBUILD_BLOCK_DEVICE_MAPPING, task_states.REBUILD_SPAWNING]): ACTION_ERROR}}, {('NOT_IN',[vm_states.ERROR]): {('IN', [task_states.IMAGE_SNAPSHOT_PENDING, task_states.IMAGE_PENDING_UPLOAD, task_states.IMAGE_UPLOADING, task_states.IMAGE_SNAPSHOT]): _post_interrupted_snapshot_cleanup}} ) what do you think, do we need a bp for this? -- Thanks, Eli (Li Yong) Qiao_______________________________________________ OpenStack-dev mailing list [email protected] http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
_______________________________________________ OpenStack-dev mailing list [email protected] http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
