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
@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):