summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornidhimittalhada <nidhimittal19@gmail.com>2017-07-03 14:42:41 +0530
committernidhimittalhada <nidhimittal19@gmail.com>2017-07-26 10:40:14 +0530
commit4760157375819d689a9f3dc5c1e69e48ba23e546 (patch)
tree2173b9fdb89b46d02ab60b9b54b6a3a7913ce324
parent44e650a4ed183af9fa977af192355450afd4f1b7 (diff)
downloadpython-cinderclient-4760157375819d689a9f3dc5c1e69e48ba23e546.tar.gz
python-cinderclient doc unclear on Volume.attach
In 'attach' method, documentation vaguely says "Set attachment metadata." Actually, this method should not be called directly by API users when attempting to attach a Cinder volume to a Nova instance, else the Nova and Cinder databases will become inconsistent. Instead attach function exists solely for use by consumers of Cinder services such as Nova, so that they can inform Cinder that they're now using one of Cinder's volumes. Hence correcting the doc text for attach function. Change-Id: I34af39f857b6b918de1129f5d210326b3e84d8e1 Closes-Bug: #1611613
-rw-r--r--cinderclient/v2/volumes.py25
1 files changed, 23 insertions, 2 deletions
diff --git a/cinderclient/v2/volumes.py b/cinderclient/v2/volumes.py
index 02b86ee..b4e950b 100644
--- a/cinderclient/v2/volumes.py
+++ b/cinderclient/v2/volumes.py
@@ -33,7 +33,17 @@ class Volume(base.Resource):
return self.manager.update(self, **kwargs)
def attach(self, instance_uuid, mountpoint, mode='rw', host_name=None):
- """Set attachment metadata.
+ """Inform Cinder that the given volume is attached to the given instance.
+
+ Calling this method will not actually ask Cinder to attach
+ a volume, but to mark it on the DB as attached. If the volume
+ is not actually attached to the given instance, inconsistent
+ data will result.
+
+ The right flow of calls is :
+ 1- call reserve
+ 2- call initialize_connection
+ 3- call attach
:param instance_uuid: uuid of the attaching instance.
:param mountpoint: mountpoint on the attaching instance or host.
@@ -44,7 +54,18 @@ class Volume(base.Resource):
host_name)
def detach(self):
- """Clear attachment metadata."""
+ """Inform Cinder that the given volume is detached from the given instance.
+
+ Calling this method will not actually ask Cinder to detach
+ a volume, but to mark it on the DB as detached. If the volume
+ is not actually detached from the given instance, inconsistent
+ data will result.
+
+ The right flow of calls is :
+ 1- call reserve
+ 2- call initialize_connection
+ 3- call detach
+ """
return self.manager.detach(self)
def reserve(self, volume):