def wait_for_volume_retype(client, volume_id, new_volume_type):
 body = client.show_volume(volume_id)['volume']
 current_volume_type = body['volume_type']
 start = int(time.time())
 while (current_volume_type != new_volume_type):
  time.sleep(client.build_interval)
  body = client.show_volume(volume_id)['volume']
  current_volume_type = body['volume_type']
  if ((int(time.time()) - start) >= client.build_timeout):
   message = ('Volume %s failed to reach %s volume type (current %s) within the required time (%s s).' % (volume_id, new_volume_type, current_volume_type, client.build_timeout))
   raise exceptions.TimeoutException(message)

def wait_for_volume_retype ( client , volume_id , new_volume_type ) : body = client . show_volume ( volume_id ) [ 'volume' ] current_volume_type = body [ 'volume_type' ] start = int ( time . time ( ) ) while ( current_volume_type != new_volume_type ) : time . sleep ( client . build_interval ) body = client . show_volume ( volume_id ) [ 'volume' ] current_volume_type = body [ 'volume_type' ] if ( ( int ( time . time ( ) ) - start ) >= client . build_timeout ) : message = ( 'Volume %s failed to reach %s volume type (current %s) within the required time (%s s).' % ( volume_id , new_volume_type , current_volume_type , client . build_timeout ) ) raise exceptions . TimeoutException ( message )
waits for a volume to have a new volume type .