#NEWLINE# def _numa_cell_supports_pagesize_request( host_cell , inst_cell ) : #NEWLINE# #INDENT# 'Determines whether the cell can accept the request.\n\n    :param host_cell: host cell to fit the instance cell onto\n    :param inst_cell: instance cell we want to fit\n\n    :raises: exception.MemoryPageSizeNotSupported if custom page\n             size not supported in host cell.\n\n    :returns: The page size able to be handled by host_cell\n    ' #NEWLINE# avail_pagesize = [ page . size_kb for page in host_cell . mempages ] #NEWLINE# avail_pagesize . sort ( reverse = True ) #NEWLINE# def verify_pagesizes( host_cell , inst_cell , avail_pagesize ) : #NEWLINE# #INDENT# inst_cell_mem = ( inst_cell . memory * units . Ki ) #NEWLINE# for pagesize in avail_pagesize : #NEWLINE# #INDENT# if host_cell . can_fit_hugepages ( pagesize , inst_cell_mem ) : #NEWLINE# #INDENT# return pagesize #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( inst_cell . pagesize == MEMPAGES_SMALL ) : #NEWLINE# #INDENT# return verify_pagesizes ( host_cell , inst_cell , avail_pagesize [ ( - 1 ) : ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( inst_cell . pagesize == MEMPAGES_LARGE ) : #NEWLINE# #INDENT# return verify_pagesizes ( host_cell , inst_cell , avail_pagesize [ : ( - 1 ) ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( inst_cell . pagesize == MEMPAGES_ANY ) : #NEWLINE# #INDENT# return verify_pagesizes ( host_cell , inst_cell , avail_pagesize ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return verify_pagesizes ( host_cell , inst_cell , [ inst_cell . pagesize ] )