def wait_for_backup_status(client, backup_id, status):
 body = client.show_backup(backup_id)['backup']
 backup_status = body['status']
 start = int(time.time())
 while (backup_status != status):
  time.sleep(client.build_interval)
  body = client.show_backup(backup_id)['backup']
  backup_status = body['status']
  if ((backup_status == 'error') and (backup_status != status)):
   raise lib_exc.VolumeBackupException(backup_id=backup_id)
  if ((int(time.time()) - start) >= client.build_timeout):
   message = ('Volume backup %s failed to reach %s status (current %s) within the required time (%s s).' % (backup_id, status, backup_status, client.build_timeout))
   raise lib_exc.TimeoutException(message)

def wait_for_backup_status ( client , backup_id , status ) : body = client . show_backup ( backup_id ) [ 'backup' ] backup_status = body [ 'status' ] start = int ( time . time ( ) ) while ( backup_status != status ) : time . sleep ( client . build_interval ) body = client . show_backup ( backup_id ) [ 'backup' ] backup_status = body [ 'status' ] if ( ( backup_status == 'error' ) and ( backup_status != status ) ) : raise lib_exc . VolumeBackupException ( backup_id = backup_id ) if ( ( int ( time . time ( ) ) - start ) >= client . build_timeout ) : message = ( 'Volume backup %s failed to reach %s status (current %s) within the required time (%s s).' % ( backup_id , status , backup_status , client . build_timeout ) ) raise lib_exc . TimeoutException ( message )
waits for a backup to reach a given status .