From: Nikola Dipanov Date: Fri, 25 Apr 2014 16:39:43 +0000 (+0200) Subject: Remove check_{attach,detach} from volumes API X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=27fe5638caed1544220943b07895c8afc70dab32;p=openstack-build%2Fcinder-build.git Remove check_{attach,detach} from volumes API 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 --- diff --git a/cinder/tests/policy.json b/cinder/tests/policy.json index 4347c2c8f..608755f16 100644 --- a/cinder/tests/policy.json +++ b/cinder/tests/policy.json @@ -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": [], diff --git a/cinder/volume/api.py b/cinder/volume/api.py index 33e5dc8a4..a44513d07 100644 --- a/cinder/volume/api.py +++ b/cinder/volume/api.py @@ -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