From bf5d39277e7c02df3994f3a5019b60f7a64f9b07 Mon Sep 17 00:00:00 2001 From: Zhiteng Huang Date: Tue, 7 Jul 2015 16:31:32 +0800 Subject: [PATCH] Update volume status AFTER terminate_connection is done 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 | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/cinder/volume/api.py b/cinder/volume/api.py index af64a6353..db44c9f84 100644 --- a/cinder/volume/api.py +++ b/cinder/volume/api.py @@ -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): -- 2.45.2