def _nova_detach(nova_volume_manager, cinder_volume_manager, server_id, cinder_volume):
 try:
  nova_volume_manager.delete_server_volume(server_id=server_id, attachment_id=cinder_volume.id)
 except NovaNotFound:
  raise UnattachedVolume(cinder_volume.id)
 wait_for_volume_state(volume_manager=cinder_volume_manager, expected_volume=cinder_volume, desired_state=u'available', transient_states=(u'in-use', u'detaching'))

def _nova_detach ( nova_volume_manager , cinder_volume_manager , server_id , cinder_volume ) : try : nova_volume_manager . delete_server_volume ( server_id = server_id , attachment_id = cinder_volume . id ) except NovaNotFound : raise UnattachedVolume ( cinder_volume . id ) wait_for_volume_state ( volume_manager = cinder_volume_manager , expected_volume = cinder_volume , desired_state = u'available' , transient_states = ( u'in-use' , u'detaching' ) )
detach a cinder volume from a nova host and block until the volume has detached .