]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Change check-detach to reject more states
authorDuncan Thomas <duncan.thomas@hp.com>
Wed, 10 Jul 2013 18:28:39 +0000 (19:28 +0100)
committerDuncan Thomas <duncan.thomas@hp.com>
Wed, 10 Jul 2013 18:32:18 +0000 (19:32 +0100)
Change check_detach is reject anything other than 'in-use', rather than
just rejecting 'available'.

Fixes bug #1199922

Change-Id: I3180540ca7bb699a3494ca4eea1389ae8a117df0

cinder/volume/api.py

index 32f415c3f78e75f87ca464364758cbaf6f361941..fdb4169f70937b524c29aac05f9d58f314787d52 100644 (file)
@@ -501,8 +501,8 @@ class API(base.Base):
     @wrap_check_policy
     def check_detach(self, context, volume):
         # TODO(vish): abstract status checking?
-        if volume['status'] == "available":
-            msg = _("already detached")
+        if volume['status'] != "in-use":
+            msg = _("status must be in-use to detach")
             raise exception.InvalidVolume(reason=msg)
 
     @wrap_check_policy