[openstack-dev] [nova][compute] propose to use a table to deal with the vm_state when _init_instance in compute

Eli Qiao taget at linux.vnet.ibm.com
Tue Nov 4 07:56:13 UTC 2014


? 2014?11?04? 15:19, Chen CH Ji ??:
>
> +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!
>
hi Kevin
thanks for supporting.

yeah, I am considering vm_state first, it is much easier to start up, 
all of them will  return.
  I need to heard more from others to see if we need a spec to do it.
>
> Kevin (Chen) Ji ? ?
>
> Engineer, zVM Development, CSTL
> Notes: Chen CH Ji/China/IBM at IBMCN   Internet: jichenjc at cn.ibm.com
> Phone: +86-10-82454158
> Address: 3/F Ring Building, ZhongGuanCun Software Park, Haidian 
> District, Beijing 100193, PRC
>
> Inactive hide details for Eli Qiao ---11/04/2014 03:13:26 PM---hello 
> all: in current _init_instance function in compute managerEli Qiao 
> ---11/04/2014 03:13:26 PM---hello all: in current _init_instance 
> function in compute manager,
>
> From: Eli Qiao <taget at linux.vnet.ibm.com>
> To: "OpenStack Development Mailing List (not for usage questions)" 
> <openstack-dev at lists.openstack.org>
> 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
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
>
>
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

-- 
Thanks,
Eli (Li Yong) Qiao

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20141104/509c246e/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 105 bytes
Desc: not available
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20141104/509c246e/attachment.gif>


More information about the OpenStack-dev mailing list