summaryrefslogtreecommitdiff
path: root/nova/volume
diff options
context:
space:
mode:
authorMatt Riedemann <mriedem.os@gmail.com>2017-05-31 14:02:43 -0400
committerMatt Riedemann <mriedem.os@gmail.com>2017-06-08 10:30:53 -0400
commiteb69813f2ede3303c1d9f47c8cd527bf03b84050 (patch)
tree4b0da23a050a42571ff63f36c6fd6d09a128b047 /nova/volume
parentd655179182b708aa8566b810b77951e1cb3aab19 (diff)
downloadnova-eb69813f2ede3303c1d9f47c8cd527bf03b84050.tar.gz
Use 3.27 microversion when creating new style volume attachments
Now that we have version discovery support we can explicitly request 3.27 when creating a new-style volume attachment. If the 3.27 microversion is not available, CinderAPIVersionNotAvailable will be raised back up to the caller, indicating an old-style attachment needs to be made. The same is done when updating or deleting new-style attachments. A TODO is left inline for update and delete since we should be able to assume that if we're updating or deleting a new style attachment, which is keyed off the BlockDeviceMapping.attachment_id field, that 3.27 is available and we can save ourselves a GET / call to Cinder. Part of blueprint cinder-new-attach-apis Change-Id: Icf8cda2c34dda9e7b56a586353842dd035b115cd
Diffstat (limited to 'nova/volume')
-rw-r--r--nova/volume/cinder.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/nova/volume/cinder.py b/nova/volume/cinder.py
index b2fa315128..cdb8474040 100644
--- a/nova/volume/cinder.py
+++ b/nova/volume/cinder.py
@@ -556,7 +556,7 @@ class API(object):
getattr(attachment, 'connection_info', None)
"""
try:
- return cinderclient(context).attachments.create(
+ return cinderclient(context, '3.27').attachments.create(
volume_id, connector, instance_id)
except cinder_exception.ClientException as ex:
with excutils.save_and_reraise_exception():
@@ -581,7 +581,8 @@ class API(object):
representing the updated volume attachment.
"""
try:
- return cinderclient(context).attachments.update(
+ # TODO(mriedem): consider skipping the microversion discovery
+ return cinderclient(context, '3.27').attachments.update(
attachment_id, connector)
except cinder_exception.ClientException as ex:
with excutils.save_and_reraise_exception():
@@ -594,8 +595,9 @@ class API(object):
@translate_attachment_exception
def attachment_delete(self, context, attachment_id):
try:
+ # TODO(mriedem): consider skipping the microversion discovery
cinderclient(
- context).attachments.delete(attachment_id)
+ context, '3.27').attachments.delete(attachment_id)
except cinder_exception.ClientException as ex:
with excutils.save_and_reraise_exception():
LOG.error(('Delete attachment failed for attachment '