'Returns whether memory can fit into hugepages size
:param pagesize: a page size in KibB
:param memory: a memory size asked to fit in KiB
:returns: whether memory can fit in hugepages
:raises: MemoryPageSizeNotSupported if page size not supported'

def can_fit_hugepages(self, pagesize, memory):

    for pages in self.mempages:
        if (pages.size_kb == pagesize):
            return ((memory <= pages.free_kb) and ((memory % pages.size_kb) == 0))
    raise exception.MemoryPageSizeNotSupported(pagesize=pagesize)
