def _validate_sequenced_vhds(staging_path):
 seq_num = 0
 filenames = os.listdir(staging_path)
 for filename in filenames:
  if (not filename.endswith('.vhd')):
   continue
  if (filename == 'swap.vhd'):
   continue
  vhd_path = os.path.join(staging_path, ('%d.vhd' % seq_num))
  if (not os.path.exists(vhd_path)):
   raise Exception(('Corrupt image. Expected seq number: %d. Files: %s' % (seq_num, filenames)))
  seq_num += 1

def _validate_sequenced_vhds ( staging_path ) : seq_num = 0 filenames = os . listdir ( staging_path ) for filename in filenames : if ( not filename . endswith ( '.vhd' ) ) : continue if ( filename == 'swap.vhd' ) : continue vhd_path = os . path . join ( staging_path , ( '%d.vhd' % seq_num ) ) if ( not os . path . exists ( vhd_path ) ) : raise Exception ( ( 'Corrupt image. Expected seq number: %d. Files: %s' % ( seq_num , filenames ) ) ) seq_num += 1
this check ensures that the vhds in the staging area are sequenced properly from 0 to n-1 with no gaps .