<div dir="ltr">I think cinder allow detach volume when it's under migration, but the volume status will not become 'detaching' or 'available'.<div><br></div><div>See the code of begin_detaching in cinder:</div><div><br></div><div><div> # If we are in the middle of a volume migration, we don't want the user</div><div> # to see that the volume is 'detaching'. Having 'migration_status' set</div><div> # will have the same effect internally.</div><div> if volume['migration_status']:</div><div> return</div></div><div><br></div><div>The volume status should be updated correctly when migration is finish.</div><div><br></div><div>There is a routine in _migrate_volume_generic to update the new volume status after driver.copy_volume_data is done.<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-08-10 13:09 GMT+08:00 liuxinguo <span dir="ltr"><<a href="mailto:liuxinguo@huawei.com" target="_blank">liuxinguo@huawei.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="ZH-CN" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span lang="EN-US">Detach a volume when it's under migration, volume status is still “in-use”:<u></u><u></u></span></p>
<p style="margin-left:18.0pt">
<u></u><span lang="EN-US"><span>1.<span style="font:7.0pt "Times New Roman"">
</span></span></span><u></u><span lang="EN-US">create vol-1<u></u><u></u></span></p>
<p style="margin-left:18.0pt">
<u></u><span lang="EN-US"><span>2.<span style="font:7.0pt "Times New Roman"">
</span></span></span><u></u><span lang="EN-US">attach vol-1 to a vm<u></u><u></u></span></p>
<p style="margin-left:18.0pt">
<u></u><span lang="EN-US"><span>3.<span style="font:7.0pt "Times New Roman"">
</span></span></span><u></u><span lang="EN-US">migrate vol-1<u></u><u></u></span></p>
<p style="margin-left:18.0pt">
<u></u><span lang="EN-US"><span>4.<span style="font:7.0pt "Times New Roman"">
</span></span></span><u></u><span lang="EN-US">when vol-1 is under migration, detach vol-1<u></u><u></u></span></p>
<p style="margin-left:18.0pt">
<u></u><span lang="EN-US"><span>5.<span style="font:7.0pt "Times New Roman"">
</span></span></span><u></u><span lang="EN-US">after vol-1 is detached, command “cinder list” show that the Status of vol-1 is still “in-use”.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">If 'migration_status' of the volume is not None, detach process won’t update the status of the volume to 'available':<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:black"> volume_ref = _volume_get(context, volume_id, session=session)</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""><u></u><u></u></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:black">
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:blue">if</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:black">
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:blue">not</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:black"> remain_attachment:</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""><u></u><u></u></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:black">
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:silver"># Hide status update from user if we're performing volume migration</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""><u></u><u></u></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:black"> </span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:silver">#
or uploading it to image</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""><u></u><u></u></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:black">
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:blue">if</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:black"> (</span><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:red">not
volume_ref[<i>'migration_status'</i>]</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:black">
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:blue">and</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""><u></u><u></u></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:black">
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:blue">not</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:black"> (volume_ref[</span><i><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:#00aa00">'status'</span></i><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:black">]
== </span><i><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:#00aa00">'uploading'</span></i><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:black">)):</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New""><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:black"> volume_ref[</span><i><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:#00aa00">'status'</span></i><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:black">]
= </span><i><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:#00aa00">'available'</span></i><span lang="EN-US"><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">So how to deal with this? Dose it means that we should not detach a volume when it’s under migration?<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Thanks for any input! <u></u><u></u></span></p>
</div>
</div>
<br>__________________________________________________________________________<br>
OpenStack Development Mailing List (not for usage questions)<br>
Unsubscribe: <a href="http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe" rel="noreferrer" target="_blank">OpenStack-dev-request@lists.openstack.org?subject:unsubscribe</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><pre>Best Wishes For You!</pre></div>
</div>