def write_stored_info(target, field=None, value=None):
 if (not field):
  return
 info_file = get_info_filename(target)
 LOG.info(_('Writing stored info to %s'), info_file)
 fileutils.ensure_tree(os.path.dirname(info_file))
 lock_name = ('info-%s' % os.path.split(target)[(-1)])
 lock_path = os.path.join(CONF.instances_path, 'locks')
 @lockutils.synchronized(lock_name, 'nova-', external=True, lock_path=lock_path)
 def write_file(info_file, field, value):
  d = {}
  if os.path.exists(info_file):
   with open(info_file, 'r') as f:
    d = _read_possible_json(f.read(), info_file)
  d[field] = value
  d[('%s-timestamp' % field)] = time.time()
  with open(info_file, 'w') as f:
   f.write(json.dumps(d))
 write_file(info_file, field, value)

def write_stored_info ( target , field = None , value = None ) : if ( not field ) : return info_file = get_info_filename ( target ) LOG . info ( _ ( 'Writing stored info to %s' ) , info_file ) fileutils . ensure_tree ( os . path . dirname ( info_file ) ) lock_name = ( 'info-%s' % os . path . split ( target ) [ ( - 1 ) ] ) lock_path = os . path . join ( CONF . instances_path , 'locks' ) @ lockutils . synchronized ( lock_name , 'nova-' , external = True , lock_path = lock_path ) def write_file ( info_file , field , value ) : d = { } if os . path . exists ( info_file ) : with open ( info_file , 'r' ) as f : d = _read_possible_json ( f . read ( ) , info_file ) d [ field ] = value d [ ( '%s-timestamp' % field ) ] = time . time ( ) with open ( info_file , 'w' ) as f : f . write ( json . dumps ( d ) ) write_file ( info_file , field , value )
write information about an image .