summaryrefslogtreecommitdiff
path: root/nova/volume/cinder.py
diff options
context:
space:
mode:
authorIldiko Vancsa <ildiko.vancsa@gmail.com>2017-03-16 15:37:58 +0100
committerIldiko Vancsa <ildiko.vancsa@gmail.com>2017-07-20 22:32:52 +0200
commit363146cbcb4d9e8b0da3f7f26745579367815aac (patch)
tree7ef6f1f2e4f33b90940a56ffc78403d1fb71e1f1 /nova/volume/cinder.py
parentc18d5c6325616b025fbe6b1086fe5eabe557209f (diff)
downloadnova-363146cbcb4d9e8b0da3f7f26745579367815aac.tar.gz
Remove check_detach
As part of cleaning up the Nova code base around the Cinder interaction snippets check_attach was recently removed as Cinder keeps track of the volume state and performs the necessary checks. To move forward with the code clean up the other half of these checks check_detach is proposed for removal due to the same reason. As we are now introducing the new Cinder attach/detach API in Nova it is important to make it as straight forward as possible and use this as an opportunity to clean up the code and remove the parts we don't need anymore. As part of this activity we are working on to be able to support volume multi-attach, which will be easier if each service has their own set of responsibilities. This patch also handles error translation by catching InvalidInput exception and raising InvalidVolume to match the former error handling. check_detach could also raise VolumeUnattached exception which was added in preparation to multi-attach support. In case of normal attach we will hit InvalidVolume before VolumeUnattached, therefore it is safe to remove that for now. VolumeUnattached is also fully removed from the code now to stop the status check on volumes on the Nova side completely. Change-Id: If63dbd236ce0970ea245707cacb2664e3fdbdfd1
Diffstat (limited to 'nova/volume/cinder.py')
-rw-r--r--nova/volume/cinder.py18
1 files changed, 0 insertions, 18 deletions
diff --git a/nova/volume/cinder.py b/nova/volume/cinder.py
index 0dcfc1e6e0..5ce0f37ae7 100644
--- a/nova/volume/cinder.py
+++ b/nova/volume/cinder.py
@@ -337,24 +337,6 @@ class API(object):
'vol_zone': volume['availability_zone']}
raise exception.InvalidVolume(reason=msg)
- def check_detach(self, context, volume, instance=None):
- # TODO(vish): abstract status checking?
- if volume['status'] == "available":
- msg = _("volume %s already detached") % volume['id']
- raise exception.InvalidVolume(reason=msg)
-
- if volume['attach_status'] == 'detached':
- msg = _("Volume must be attached in order to detach.")
- raise exception.InvalidVolume(reason=msg)
-
- # NOTE(ildikov):Preparation for multiattach support, when a volume
- # can be attached to multiple hosts and/or instances,
- # so just check the attachment specific to this instance
- if instance is not None and instance.uuid not in volume['attachments']:
- # TODO(ildikov): change it to a better exception, when enable
- # multi-attach.
- raise exception.VolumeUnattached(volume_id=volume['id'])
-
@translate_volume_exception
def reserve_volume(self, context, volume_id):
cinderclient(context).volumes.reserve(volume_id)