def restore_snapshots():
 logging.info('Restoring Cassandra snapshots.')
 for directory in CASSANDRA_DATA_SUBDIRS:
  data_dir = '{0}/{1}/{2}/'.format(APPSCALE_DATA_DIR, 'cassandra', directory)
  logging.debug('Restoring in dir {0}'.format(data_dir))
  for (path, _, filenames) in os.walk(data_dir):
   for filename in filenames:
    logging.debug('Restoring: {0}'.format(filename))
    if (not filename):
     logging.warn('skipping...')
     continue
    full_path = '{0}/{1}'.format(path, filename)
    new_full_path = '{0}/../../{1}'.format(path, filename)
    logging.debug('{0} -> {1}'.format(full_path, new_full_path))
    if (not backup_recovery_helper.rename(full_path, new_full_path)):
     logging.error('Error while moving Cassandra snapshot in place. Aborting restore...')
     return False
 logging.info('Done restoring Cassandra snapshots.')
 return True

def restore_snapshots ( ) : logging . info ( 'Restoring Cassandra snapshots.' ) for directory in CASSANDRA_DATA_SUBDIRS : data_dir = '{0}/{1}/{2}/' . format ( APPSCALE_DATA_DIR , 'cassandra' , directory ) logging . debug ( 'Restoring in dir {0}' . format ( data_dir ) ) for ( path , _ , filenames ) in os . walk ( data_dir ) : for filename in filenames : logging . debug ( 'Restoring: {0}' . format ( filename ) ) if ( not filename ) : logging . warn ( 'skipping...' ) continue full_path = '{0}/{1}' . format ( path , filename ) new_full_path = '{0}/../../{1}' . format ( path , filename ) logging . debug ( '{0} -> {1}' . format ( full_path , new_full_path ) ) if ( not backup_recovery_helper . rename ( full_path , new_full_path ) ) : logging . error ( 'Error while moving Cassandra snapshot in place. Aborting restore...' ) return False logging . info ( 'Done restoring Cassandra snapshots.' ) return True
restore snapshot into correct directories .