<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    <div class="moz-cite-prefix">于 2014年11月04日 15:19, Chen CH Ji 写道:<br>
    </div>
    <blockquote
cite="mid:OFBB7D36A1.8FE1F0FB-ON48257D86.0027FFF9-48257D86.0028A83E@cn.ibm.com"
      type="cite">
      <p><font face="sans-serif" size="2">+1,</font><br>
        <br>
        <font face="sans-serif" size="2">a good idea, it will make it
          more clear. </font><br>
        <font face="sans-serif" size="2">from implementation perspective
          we need to pay attention that some status will pass through
          and some will just return </font><br>
        <br>
        <font face="sans-serif" size="2">Best Regards! <br>
          <br>
        </font></p>
    </blockquote>
    <font size="2">hi Kevin<br>
      thanks for supporting. <br>
      <br>
      yeah, I am considering vm_state first, it is much easier to start
      up, all of them will  return.<br>
       I need to heard more from others to see if we need a spec to do
      it.<br>
    </font>
    <blockquote
cite="mid:OFBB7D36A1.8FE1F0FB-ON48257D86.0027FFF9-48257D86.0028A83E@cn.ibm.com"
      type="cite">
      <p><font face="sans-serif" size="2">
          Kevin (Chen) Ji 纪 晨<br>
          <br>
          Engineer, zVM Development, CSTL<br>
          Notes: Chen CH Ji/China/IBM@IBMCN   Internet:
          <a class="moz-txt-link-abbreviated" href="mailto:jichenjc@cn.ibm.com">jichenjc@cn.ibm.com</a><br>
          Phone: +86-10-82454158<br>
          Address: 3/F Ring Building, ZhongGuanCun Software Park,
          Haidian District, Beijing 100193, PRC </font><br>
        <br>
        <img src="cid:part1.08040800.04080008@linux.vnet.ibm.com"
          alt="Inactive hide details for Eli Qiao ---11/04/2014 03:13:26
          PM---hello all: in current _init_instance function in compute
          manager" border="0" height="16" width="16"><font
          color="#424282" face="sans-serif" size="2">Eli Qiao
          ---11/04/2014 03:13:26 PM---hello all: in current
          _init_instance function in compute manager,</font><br>
        <br>
        <font color="#5F5F5F" face="sans-serif" size="1">From: </font><font
          face="sans-serif" size="1">Eli Qiao
          <a class="moz-txt-link-rfc2396E" href="mailto:taget@linux.vnet.ibm.com"><taget@linux.vnet.ibm.com></a></font><br>
        <font color="#5F5F5F" face="sans-serif" size="1">To: </font><font
          face="sans-serif" size="1">"OpenStack Development Mailing List
          (not for usage questions)"
          <a class="moz-txt-link-rfc2396E" href="mailto:openstack-dev@lists.openstack.org"><openstack-dev@lists.openstack.org></a></font><br>
        <font color="#5F5F5F" face="sans-serif" size="1">Date: </font><font
          face="sans-serif" size="1">11/04/2014 03:13 PM</font><br>
        <font color="#5F5F5F" face="sans-serif" size="1">Subject: </font><font
          face="sans-serif" size="1">[openstack-dev] [nova][compute]
          propose to use a table to deal with the vm_state when
          _init_instance in compute</font><br>
      </p>
      <hr style="color:#8091A5; " align="left" noshade="noshade"
        size="2" width="100%"><br>
      <br>
      <br>
      <font face="sans-serif" size="3">hello all:<br>
        in current _init_instance function in compute manager, <br>
        there's flood 'and' 'or' logic, to check the vm_state and
        task_state when initialize a instance during service list,<br>
        this lead hard to read and hard to maintain, so I propose a new
        way to handle this.<br>
        <br>
        we can create a vm_state_table, by look up the table  we can
        find the action we need to do for the instance,<br>
        from this table , you can clearly see what vm_state and
        task_state should take the action.<br>
        <br>
        for example:<br>
        {vm_states list :{task_states list: action}},<br>
        <br>
        each entry stands for an action,<br>
        and we walk though the tuple<br>
        so the table should be like this:<br>
        <br>
        vm_state_table = (<br>
           {vm_states.SOFT_DELETE :{'ALL': ACTION_NONE}},<br>
           {vm_states.ERROR:  {('NOT_IN',[task_states.RESIZE_MIGRATING,<br>
                                                           
         task_states.DELETING]): ACTION_NONE}},<br>
           {vm_states.DELETED: {'ALL': _complete_partial_deletion}},<br>
           {vm_states.BUILDING: {'ALL': ACTION_ERROR}},<br>
           {'ALL': {('IN',[task_states.SCHEDULING,<br>
                               task_states.BLOCK_DEVICE_MAPPING,<br>
                               task_states.NETWORKING,<br>
                               task_states.SPAWNING)]: ACTION_ERROR}},<br>
           {('IN',[vm_states.ACTIVE, vm_states.STOPPED]: {('IN',
        [task_states.REBUILDING,<br>
                                                                       
                               
        task_states.REBUILD_BLOCK_DEVICE_MAPPING,<br>
                                                                       
                                task_states.REBUILD_SPAWNING]):
        ACTION_ERROR}},<br>
           {('NOT_IN',[vm_states.ERROR]): {('IN',
        [task_states.IMAGE_SNAPSHOT_PENDING,<br>
                                                                     
         task_states.IMAGE_PENDING_UPLOAD,<br>
                                                                     
         task_states.IMAGE_UPLOADING,<br>
                                                                     
         task_states.IMAGE_SNAPSHOT]):
        _post_interrupted_snapshot_cleanup}}<br>
        )<br>
        <br>
        what do you think, do we need a bp for this? <br>
      </font><br>
      <tt><font size="3">-- <br>
          Thanks,<br>
          Eli (Li Yong) Qiao</font></tt><tt><font size="2">_______________________________________________<br>
          OpenStack-dev mailing list<br>
          <a class="moz-txt-link-abbreviated" href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a><br>
        </font></tt><tt><font size="2"><a moz-do-not-send="true"
            href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a></font></tt><tt><font
          size="2"><br>
        </font></tt><br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
OpenStack-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a>
<a class="moz-txt-link-freetext" href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Thanks,
Eli (Li Yong) Qiao</pre>
  </body>
</html>