Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DPDK: Raise and catch hugepage size err #3594

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions lisa/tools/hugepages.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
from enum import Enum
from typing import Any, Set

from assertpy import assert_that

from lisa.executable import Tool
from lisa.tools.echo import Echo
from lisa.tools.free import Free
Expand Down Expand Up @@ -84,10 +82,12 @@ def _enable_hugepages(
)
total_request_pages = request_space_kb // hugepage_size_kb.value
pages_per_numa_node = total_request_pages // numa_nodes
assert_that(pages_per_numa_node).described_as(
"Must request huge page count > 0. Verify this system has enough "
"free memory to allocate ~2GB of hugepages"
).is_greater_than(0)
if pages_per_numa_node <= 0:
raise NotEnoughMemoryException(
"Must request huge page count > 0. Verify this system has enough "
"free memory to allocate ~2GB of hugepages"
)

for i in range(numa_nodes):
# nr_hugepages will be written with the number calculated
# based on 2MB hugepages if not specified, subject to change
Expand Down
5 changes: 4 additions & 1 deletion microsoft/testsuites/dpdk/dpdkutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,10 @@ def initialize_node_resources(

# init and enable hugepages (required by dpdk)
hugepages = node.tools[Hugepages]
hugepages.init_hugepages(hugepage_size, minimum_gb=4)
try:
hugepages.init_hugepages(hugepage_size, minimum_gb=4)
except NotEnoughMemoryException as err:
raise SkippedException(err)

assert_that(len(node.nics)).described_as(
"Test needs at least 1 NIC on the test node."
Expand Down
Loading