def register_storage_use(storage_path, hostname):
 LOCK_PATH = os.path.join(CONF.instances_path, 'locks')
 @utils.synchronized('storage-registry-lock', external=True, lock_path=LOCK_PATH)
 def do_register_storage_use(storage_path, hostname):
  d = {}
  id_path = os.path.join(storage_path, 'compute_nodes')
  if os.path.exists(id_path):
   with open(id_path) as f:
    try:
     d = jsonutils.loads(f.read())
    except ValueError:
     LOG.warning(_LW('Cannot decode JSON from %(id_path)s'), {'id_path': id_path})
  d[hostname] = time.time()
  with open(id_path, 'w') as f:
   f.write(jsonutils.dumps(d))
 return do_register_storage_use(storage_path, hostname)

def register_storage_use ( storage_path , hostname ) : LOCK_PATH = os . path . join ( CONF . instances_path , 'locks' ) @ utils . synchronized ( 'storage-registry-lock' , external = True , lock_path = LOCK_PATH ) def do_register_storage_use ( storage_path , hostname ) : d = { } id_path = os . path . join ( storage_path , 'compute_nodes' ) if os . path . exists ( id_path ) : with open ( id_path ) as f : try : d = jsonutils . loads ( f . read ( ) ) except ValueError : LOG . warning ( _LW ( 'Cannot decode JSON from %(id_path)s' ) , { 'id_path' : id_path } ) d [ hostname ] = time . time ( ) with open ( id_path , 'w' ) as f : f . write ( jsonutils . dumps ( d ) ) return do_register_storage_use ( storage_path , hostname )
identify the id of this instance storage .