Skip to content

Commit

Permalink
Add nvmeof version and config file path to the log messages.
Browse files Browse the repository at this point in the history
Fixes ceph#244

Signed-off-by: Gil Bregman <[email protected]>
  • Loading branch information
gbregman committed Oct 9, 2023
1 parent ee92f6c commit 7c1302e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ ARG NVMEOF_NAME \
NVMEOF_GIT_BRANCH \
NVMEOF_GIT_COMMIT

ENV NVMEOF_VERSION="${NVMEOF_VERSION}"

# Generic labels
LABEL name="$NVMEOF_NAME" \
version="$NVMEOF_VERSION" \
Expand Down
1 change: 1 addition & 0 deletions control/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class GatewayConfig:
config: Config parser object
"""
def __init__(self, conffile):
self.filepath = conffile
with open(conffile) as f:
self.config = configparser.ConfigParser()
self.config.read_file(f)
Expand Down
5 changes: 5 additions & 0 deletions control/grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import uuid
import random
import logging
import os

import spdk.rpc.bdev as rpc_bdev
import spdk.rpc.nvmf as rpc_nvmf
Expand All @@ -38,7 +39,11 @@ class GatewayService(pb2_grpc.GatewayServicer):
def __init__(self, config, gateway_state, spdk_rpc_client) -> None:
"""Constructor"""
self.logger = logging.getLogger(__name__)
ver = os.getenv("NVMEOF_VERSION")
if ver:
self.logger.info(f"Using NVMeoF gateway version {ver}")
self.config = config
self.logger.info(f"Using configuration file {config.filepath}")
self.gateway_state = gateway_state
self.spdk_rpc_client = spdk_rpc_client
self.gateway_name = self.config.get("gateway", "name")
Expand Down

0 comments on commit 7c1302e

Please sign in to comment.