Skip to content

Add log messages for huge pages count #379

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

Merged
merged 1 commit into from
Jan 18, 2024
Merged
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
8 changes: 6 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ ARG NVMEOF_NAME \
NVMEOF_GIT_MODIFIED_FILES \
SPDK_GIT_REPO \
SPDK_GIT_BRANCH \
SPDK_GIT_COMMIT
SPDK_GIT_COMMIT \
HUGEPAGES \
HUGEPAGES_DIR

ENV NVMEOF_VERSION="${NVMEOF_VERSION}" \
NVMEOF_GIT_REPO="${NVMEOF_GIT_REPO}" \
Expand All @@ -70,7 +72,9 @@ ENV NVMEOF_VERSION="${NVMEOF_VERSION}" \
NVMEOF_GIT_MODIFIED_FILES="${NVMEOF_GIT_MODIFIED_FILES}" \
SPDK_GIT_REPO="${SPDK_GIT_REPO}" \
SPDK_GIT_BRANCH="${SPDK_GIT_BRANCH}" \
SPDK_GIT_COMMIT="${SPDK_GIT_COMMIT}"
SPDK_GIT_COMMIT="${SPDK_GIT_COMMIT}" \
HUGEPAGES="${HUGEPAGES}" \
HUGEPAGES_DIR="${HUGEPAGES_DIR}"

# Generic labels
LABEL name="$NVMEOF_NAME" \
Expand Down
37 changes: 37 additions & 0 deletions control/grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,43 @@ def __init__(self, config, gateway_state, omap_lock, spdk_rpc_client) -> None:
git_spdk_commit = os.getenv("NVMEOF_GIT_COMMIT")
if git_spdk_commit:
self.logger.info(f"SPDK Git commit: {git_spdk_commit}")
hugepages_file = os.getenv("HUGEPAGES_DIR")
hugepages_file = hugepages_file.strip()
requested_hugepages_val = os.getenv("HUGEPAGES")
if requested_hugepages_val == None:
self.logger.warning("Can't get requested huge pages count")
else:
requested_hugepages_val = requested_hugepages_val.strip()
try:
requested_hugepages_val = int(requested_hugepages_val)
self.logger.info(f"Requested huge pages count is {requested_hugepages_val}")
except ValueError:
self.logger.warning(f"Requested huge pages count value {requested_hugepages_val} is not numeric")
requested_hugepages_val = None
if hugepages_file == None:
hugepages_file = "/sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages"
self.logger.warning("No huge pages file defined, will use /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages")
if os.access(hugepages_file, os.F_OK):
try:
hugepages_val = ""
with open(hugepages_file) as f:
hugepages_val = f.readline()
hugepages_val = hugepages_val.strip()
if hugepages_val:
try:
hugepages_val = int(hugepages_val)
self.logger.info(f"Actual huge pages count is {hugepages_val}")
except ValueError:
self.logger.warning(f"Actual huge pages count value {hugepages_val} is not numeric")
hugepages_val = ""
if requested_hugepages_val and hugepages_val != "" and requested_hugepages_val != hugepages_val:
self.logger.warning(f"The actual huge page count {hugepages_val} differs from the requested value of {requested_hugepages_val}")
else:
self.logger.warning(f"Can't read actual huge pages count value from {hugepages_file}")
except Exception as ex:
self.logger.exception(f"Can't read actual huge pages count value from {hugepages_file}")
else:
self.logger.warning(f"Can't find huge pages file {hugepages_file}")
self.config = config
config.dump_config_file(self.logger)
self.rpc_lock = threading.Lock()
Expand Down
4 changes: 4 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ services:
SPDK_GIT_REPO:
SPDK_GIT_BRANCH:
SPDK_GIT_COMMIT:
HUGEPAGES:
HUGEPAGES_DIR:
labels:
io.ceph.nvmeof:
volumes:
Expand Down Expand Up @@ -218,6 +220,8 @@ services:
SPDK_GIT_REPO:
SPDK_GIT_BRANCH:
SPDK_GIT_COMMIT:
HUGEPAGES:
HUGEPAGES_DIR:
labels:
io.ceph.nvmeof:
volumes:
Expand Down