]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Remove check_{attach,detach} from volumes API
authorNikola Dipanov <ndipanov@redhat.com>
Fri, 25 Apr 2014 16:39:43 +0000 (18:39 +0200)
committerNikola Dipanov <ndipanov@redhat.com>
Mon, 2 Jun 2014 15:37:24 +0000 (17:37 +0200)
These methods are not called from anywhere and are likely just a relic
from splitting Cinder out from Nova. Moreover their usage from the API
should really be discouraged as they are inherently racy (the result is
immediately outdated since it is not atomic with anything that might
follow).

Partial-bug: #1302774
Change-Id: I5d79b22b2a1d3c9be429a13d094328fc2075fcd2

cinder/tests/policy.json
cinder/volume/api.py

index 4347c2c8f5ba75e3df019a52674f736865c85187..608755f162661a07d7be9992b0f30ea4112ff136 100644 (file)
@@ -20,8 +20,6 @@
     "volume:unreserve_volume": [],
     "volume:begin_detaching": [],
     "volume:roll_detaching": [],
-    "volume:check_attach": [],
-    "volume:check_detach": [],
     "volume:initialize_connection": [],
     "volume:terminate_connection": [],
     "volume:create_snapshot": [],
index 33e5dc8a4bdf068345a689c8465e134a70cfaa93..a44513d076b5bf18fce7bb93812e9fabae59188a 100644 (file)
@@ -343,23 +343,6 @@ class API(base.Base):
             snapshots = results
         return snapshots
 
-    @wrap_check_policy
-    def check_attach(self, volume):
-        # TODO(vish): abstract status checking?
-        if volume['status'] != "available":
-            msg = _("status must be available")
-            raise exception.InvalidVolume(reason=msg)
-        if volume['attach_status'] == "attached":
-            msg = _("already attached")
-            raise exception.InvalidVolume(reason=msg)
-
-    @wrap_check_policy
-    def check_detach(self, volume):
-        # TODO(vish): abstract status checking?
-        if volume['status'] != "in-use":
-            msg = _("status must be in-use to detach")
-            raise exception.InvalidVolume(reason=msg)
-
     @wrap_check_policy
     def reserve_volume(self, context, volume):
         #NOTE(jdg): check for Race condition bug 1096983