<html><body>
<p><tt><font size="2">John Griffith <john.griffith@solidfire.com> wrote on 03/09/2013 12:09:41 AM:<br>
<br>
> From: John Griffith <john.griffith@solidfire.com></font></tt><br>
<tt><font size="2">> To: OpenStack Development Mailing List <openstack-dev@lists.openstack.org>, </font></tt><br>
<tt><font size="2">> Date: 03/09/2013 12:22 AM</font></tt><br>
<tt><font size="2">> Subject: Re: [openstack-dev] [Cinder] test_preattach_status_volume <br>
> test failure</font></tt><br>
<tt><font size="2">> <br>
> <br>
</font></tt><br>
<tt><font size="2">> On Fri, Mar 8, 2013 at 1:07 AM, Michael J Fork <mjfork@us.ibm.com> wrote:</font></tt><br>
<tt><font size="2">> After updating the Cinder oslo rpc libraries to the latest (see <br>
> <a href="https://review.openstack.org/#/c/23822/">https://review.openstack.org/#/c/23822/</a>), Cinder <br>
> test_preattach_status_volume fails with the following:<br>
> <br>
> ======================================================================<br>
> FAIL: Ensure volume goes into pre-attaching state<br>
> ----------------------------------------------------------------------<br>
> Traceback (most recent call last):<br>
>   File "/mnt/home/openstack/dev/cinder/cinder/tests/test_volume.py",<br>
> line 308, in test_preattach_status_volume<br>
>     self.assertEqual(vol['status'], "available")<br>
> <br>
> and the test<br>
> <br>
>     def test_preattach_status_volume(self):<br>
>         """Ensure volume goes into pre-attaching state"""<br>
>         instance_uuid = '12345678-1234-5678-1234-567812345678'<br>
>         mountpoint = "/dev/sdf"<br>
>         volume = db.volume_create(self.context, {'size': 1,<br>
>                                                  'status': 'available'})<br>
>         volume_id = volume['id']<br>
> <br>
>         volume_api = cinder.volume.api.API()<br>
>         volume_api.attach(self.context, volume, instance_uuid, mountpoint)<br>
> <br>
>         vol = db.volume_get(self.context, volume_id)<br>
>         self.assertEqual(vol['status'], "available")<br>
>         self.assertEqual(vol['attach_status'], None)<br>
>         self.assertEqual(vol['instance_uuid'], None)<br>
> <br>
> I would expect volume_api.attach call to set the state to "in-use" <br>
> (as the error shows it was) vs still being "available". Is this a <br>
> legitimate bug that needs fixed or is the error caused by something <br>
> in the oslo update?<br>
> <br>
> Thanks.<br>
> <br>
> Michael<br>
> <br>
> -------------------------------------------------<br>
> Michael Fork<br>
> Architect, OpenStack Development<br>
> IBM Systems & Technology Group</font></tt><br>
<tt><font size="2">> <br>
> _______________________________________________<br>
> OpenStack-dev mailing list<br>
> OpenStack-dev@lists.openstack.org<br>
> <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
</font></tt><br>
<tt><font size="2">> There's a bug in here (although I suspect it's a bug in the unit <br>
> test code), just haven't figured out how the oslo change exposed it.<br>
>  The status should be "in-use" as you pointed out, if you run the <br>
> test individually or even just test_volume:VolumeTestCase, it <br>
> passes.  So there's something wonky in the test setup somewhere.</font></tt><br>
<br>
<tt><font size="2">I did some digging, and it looks like a subsequent refactoring (<a href="https://github.com/openstack/cinder/commit/2331d3336a6adf4fc13a3b187e91a5d1b1f7c723">https://github.com/openstack/cinder/commit/2331d3336a6adf4fc13a3b187e91a5d1b1f7c723</a>) of the original commit (<a href="https://github.com/openstack/cinder/commit/e27b171883c1b87b8d2fdf0994947d4b93e640d9">https://github.com/openstack/cinder/commit/e27b171883c1b87b8d2fdf0994947d4b93e640d9</a>) modified the code path here but didn't retain the original purpose of this test (which was to ensure the "attaching" state was set with an instance UUID on the way to being "attached").  However, I don't know the right way to fix.  Looking at attach_volume in </font></tt><tt><font size="2">cinder/volume/manager.py, I can see the volume_update call right before attach)volume on the driver is called.  This test needs to be inserted right after volume_update.  How is that best done?</font></tt><br>
<tt><font size="2"> <br>
> _______________________________________________<br>
> OpenStack-dev mailing list<br>
> OpenStack-dev@lists.openstack.org<br>
> <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
</font></tt><br>
<font size="2" face="sans-serif">Michael<br>
<br>
-------------------------------------------------<br>
Michael Fork<br>
Architect, OpenStack Development<br>
IBM Systems & Technology Group</font><br>
</body></html>