]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Update volume status AFTER terminate_connection is done
authorZhiteng Huang <zhithuang@ebaysf.com>
Tue, 7 Jul 2015 08:31:32 +0000 (16:31 +0800)
committerZhiteng Huang <zhithuang@ebaysf.com>
Wed, 26 Aug 2015 09:05:57 +0000 (17:05 +0800)
Current volume API terminate_connection() updates volume's status in
DB before volume driver finishes terminate_connection().  In cases
where volume driver needs some time complete terminate_connection(),
it means volume becomes 'available' before volume driver done cleaning
up.  This fix changes the order of 'unreserve_volume' (updating DB)
and driver's terminate_connection to make sure when volume is marked
'available' the client has done cleaning connection.

Note that terminate_connection volume RPC API is a synchronized call,
but volume manager/driver doesn't return any value to caller.  What's
more, when volume API extension calls volume terminate_connection API,
it doesn't expect return values, so this change removes unnecessary
return values from volume API.

Closes-bug: #1488857

Change-Id: If79f7ce9a7d238b41be4c6befa0f3cac30ab06a3

cinder/volume/api.py

index af64a635329d84e9f138e7cb97984e7945ccf1d9..db44c9f849b6e7423c96949e425aa4e3a0fdacc8 100644 (file)
@@ -636,14 +636,13 @@ class API(base.Base):
 
     @wrap_check_policy
     def terminate_connection(self, context, volume, connector, force=False):
-        self.unreserve_volume(context, volume)
-        results = self.volume_rpcapi.terminate_connection(context,
-                                                          volume,
-                                                          connector,
-                                                          force)
+        self.volume_rpcapi.terminate_connection(context,
+                                                volume,
+                                                connector,
+                                                force)
         LOG.info(_LI("Terminate volume connection completed successfully."),
                  resource=volume)
-        return results
+        self.unreserve_volume(context, volume)
 
     @wrap_check_policy
     def accept_transfer(self, context, volume, new_user, new_project):