<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="Generator" content="Microsoft Word 12 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:SimSun;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:SimSun;
panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
text-align:justify;
text-justify:inter-ideograph;
font-size:10.5pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:windowtext;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="ZH-CN" link="blue" vlink="purple" style="text-justify-trim:punctuation">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US">This situation also appears in other methods of cinder.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D">Is it right?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" align="left" style="text-align:left"><b><span style="font-size:10.0pt;font-family:SimSun">发件人<span lang="EN-US">:</span></span></b><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun"> Zhangyanzi [mailto:zhangyanzi@huawei.com]
<br>
</span><b><span style="font-size:10.0pt;font-family:SimSun">发送时间<span lang="EN-US">:</span></span></b><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun"> 2013</span><span style="font-size:10.0pt;font-family:SimSun">年<span lang="EN-US">10</span>月<span lang="EN-US">31</span>日<span lang="EN-US">
10:20<br>
</span><b>收件人<span lang="EN-US">:</span></b><span lang="EN-US"> openstack@lists.openstack.org<br>
</span><b>抄送<span lang="EN-US">:</span></b><span lang="EN-US"> gfidente@redhat.com<br>
</span><b>主题<span lang="EN-US">:</span></b><span lang="EN-US"> [Openstack] cinder reserve unreserve volume dispose different fot the same situation<o:p></o:p></span></span></p>
</div>
</div>
<p class="MsoNormal" align="left" style="text-align:left"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">In reserve volume:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-indent:26.25pt"><span lang="EN-US">def reserve_volume(self, context, volume):<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> </span><span style="font-family:SimSun">…………</span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> if volume['status'] == 'available':<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> self.update(context, volume, {"status": "attaching"})<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> else:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> msg = _("Volume status must be available to reserve")<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> LOG.error(msg)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> raise exception.InvalidVolume(reason=msg)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">In unserve volume:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> def unreserve_volume(self, context, volume):<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> if volume['status'] == "attaching":<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> self.update(context, volume, {"status": "available"})<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Why not raise exception in unreserve_volume, when volume['status']!= "attaching"<o:p></o:p></span></p>
</div>
</body>
</html>