#NEWLINE# def LookupSpaceInfoByStorageType( storage_space_info , storage_type ) : #NEWLINE# #INDENT# 'Looks up the storage space info for a given storage type.\n\n  Note that this lookup can be ambiguous if storage space reporting for several\n  units of the same storage type was requested. This function is only supposed\n  to be used for legacy code in situations where it actually is unambiguous.\n\n  @type storage_space_info: list of dicts\n  @param storage_space_info: result of C{GetNodeInfo}\n  @type storage_type: string\n  @param storage_type: a storage type, which is included in the storage_units\n    list\n  @rtype: tuple\n  @return: returns the element of storage_space_info that matches the given\n    storage type\n\n  ' #NEWLINE# result = None #NEWLINE# for unit_info in storage_space_info : #NEWLINE# #INDENT# if ( unit_info [ 'type' ] == storage_type ) : #NEWLINE# #INDENT# if ( result is None ) : #NEWLINE# #INDENT# result = unit_info #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# logging . warning ( "Storage space information requested for ambiguous storage type '%s'." , storage_type ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return result