<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<STYLE type=text/css> <!--@import url(scrollbar.css); --></STYLE>

<META content="text/html; charset=utf-8" http-equiv=Content-Type>
<STYLE>                   BLOCKQUOTE{margin-Top: 0px; margin-Bottom: 0px; margin-Left: 2em}                       body{FONT-SIZE:12.1pt; COLOR:#001; FONT-FAMILY:宋体,serif;}           </STYLE>

<META name=GENERATOR content="MSHTML 10.00.9200.16521"><BASE 
target=_blank></HEAD>
<BODY 
style="BORDER-LEFT-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; MARGIN: 12px; LINE-HEIGHT: 1.3; BORDER-TOP-WIDTH: 0px" 
marginheight="0" marginwidth="0"><STATIONERY>
<DIV><FONT color=#000000 size=3 face=宋体>Hi all,</FONT></DIV>
<DIV><FONT color=#000000 size=3></FONT> </DIV>
<DIV><FONT color=#000000 size=3>I have a question about fixing a race condition 
issue between deleting and soft reboot,</FONT></DIV>
<DIV><FONT color=#000000 size=3>the issue is that:</FONT></DIV>
<DIV><FONT color=#000000 size=3>1. If we soft reboot an instance, and then 
delete it, the instance may not be deleted and stand on deleting task state, 
this is because the bug below,</FONT></DIV>
<DIV><A 
href="https://bugs.launchpad.net/nova/+bug/1111213">https://bugs.launchpad.net/nova/+bug/1111213</A></DIV>
<DIV>and I have fixed this bug yet several months ago(just for libvirt 
driver).</DIV>
<DIV>2. The other issue is, if the instance is rebooted just before deleting the 
files under instance dir, then it may become to a running deleted one, and 
this bug is at below:</DIV>
<DIV><A 
href="https://bugs.launchpad.net/nova/+bug/1246181">https://bugs.launchpad.net/nova/+bug/1246181</A></DIV>
<DIV>I want to fix it now, and I need your advice.</DIV>
<DIV>The commit is here: <A 
href="https://review.openstack.org/#/c/54477/">https://review.openstack.org/#/c/54477/</A> , 
you can post your advice on gerrit or mail to me.</DIV>
<DIV> </DIV>
<DIV>The ways to fix bug #2 may be these(just for libvirt driver in my 
mind):</DIV>
<DIV>1. Add a lock to reboot operation like the deleting operation, so the 
reboot operation and the delete operation will be done in sequence. </DIV>
<DIV>But on the other hand, the soft reboot operation may cost 120s if the 
instance doesn't support graceful shutdown, I think it is too long for a user to 
delete an instance, so this may not be the best way.</DIV>
<DIV>2. Check the instance state at the last of _cleanup method in libvirt 
driver, and if it is still running, destroy it again.</DIV>
<DIV>This way is usable but both Nikola Dipanov and I don't like this 'ugly' 
way.</DIV>
<DIV>3. Check the instance vm state and task state in nova db before booting in 
reboot, if it is deleted/deleting, stop the reboot process, this will access db 
at driver level, it is a 'ugly' way, too.</DIV>
<DIV> </DIV>
<DIV>Nikola suggests that 'maybe we can leverage task/vm states and refactor how 
reboot is done so we can back out of a reboot on a delete', but I think we 
should let user delete an instance at any time and any state, so the delete 
operation during 'soft reboot' may not be forbidden.</DIV>
<DIV> </DIV>
<DIV>Thanks and waiting for your voice!</DIV>
<DIV> </DIV>
<DIV align=left><FONT color=#c0c0c0 size=2 
face=Verdana>2013-11-04</FONT></DIV><FONT size=2 face=Verdana>
<HR id=SignNameHR style="HEIGHT: 2px; WIDTH: 122px" align=left SIZE=2>
</FONT>
<DIV><FONT color=#c0c0c0 size=2 face=Verdana><SPAN 
id=_FlashSignName>Wangpan</SPAN></FONT></DIV></STATIONERY></BODY></HTML>