From 4d613410dbf73dd9f9d9e4dc75641298745e4538 Mon Sep 17 00:00:00 2001 From: Gil Bregman Date: Mon, 9 Oct 2023 07:38:54 -0400 Subject: [PATCH] Add nvmeof version and config file path to the log messages. Fixes #244 Signed-off-by: Gil Bregman --- Dockerfile | 2 ++ ceph-nvmeof.conf | 2 +- control/config.py | 1 + control/grpc.py | 5 +++++ tests/test_multi_gateway.py | 2 +- 5 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 38f23621..6547dd13 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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" \ diff --git a/ceph-nvmeof.conf b/ceph-nvmeof.conf index 449eb089..fd566468 100644 --- a/ceph-nvmeof.conf +++ b/ceph-nvmeof.conf @@ -17,7 +17,7 @@ state_update_notify = True state_update_interval_sec = 5 #min_controller_id = 1 #max_controller_id = 65519 -enable_spdk_discovery_controller = false +enable_spdk_discovery_controller = False [discovery] addr = 0.0.0.0 diff --git a/control/config.py b/control/config.py index cd6277a8..7bc35445 100644 --- a/control/config.py +++ b/control/config.py @@ -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) diff --git a/control/grpc.py b/control/grpc.py index 871ab56f..f85c39b8 100644 --- a/control/grpc.py +++ b/control/grpc.py @@ -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 @@ -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") diff --git a/tests/test_multi_gateway.py b/tests/test_multi_gateway.py index a96eaf57..96d768b9 100644 --- a/tests/test_multi_gateway.py +++ b/tests/test_multi_gateway.py @@ -20,7 +20,7 @@ def conn(config): configA.config["gateway"]["state_update_notify"] = str(update_notify) configA.config["gateway"]["min_controller_id"] = "1" configA.config["gateway"]["max_controller_id"] = "20000" - configA.config["gateway"]["enable_spdk_discovery_controller"] = "true" + configA.config["gateway"]["enable_spdk_discovery_controller"] = "True" configB = copy.deepcopy(configA) addr = configA.get("gateway", "addr") portA = configA.getint("gateway", "port")