#NEWLINE# def get_storage_users( storage_path ) : #NEWLINE# #INDENT# 'Get a list of all the users of this storage path.' #NEWLINE# LOCK_PATH = os . path . join ( CONF . instances_path , 'locks' ) #NEWLINE# @ utils . synchronized ( 'storage-registry-lock' , external = True , lock_path = LOCK_PATH ) #NEWLINE# def do_get_storage_users( storage_path ) : #NEWLINE# #INDENT# d = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# id_path = os . path . join ( storage_path , 'compute_nodes' ) #NEWLINE# if os . path . exists ( id_path ) : #NEWLINE# #INDENT# with open ( id_path ) as f : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# d = jsonutils . loads ( f . read ( ) ) #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# LOG . warning ( _LW ( 'Cannot decode JSON from %(id_path)s' ) , { #NEWLINE# #INDENT# 'id_path' : id_path , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# recent_users = [ ] #NEWLINE# for node in d : #NEWLINE# #INDENT# if ( ( time . time ( ) - d [ node ] ) < TWENTY_FOUR_HOURS ) : #NEWLINE# #INDENT# recent_users . append ( node ) #NEWLINE# #UNINDENT# #UNINDENT# return recent_users #NEWLINE# #UNINDENT# return do_get_storage_users ( do_get_storage_users )