From da3f7bde5a980c6bd142433186866052626af7a8 Mon Sep 17 00:00:00 2001 From: Gil Bregman Date: Tue, 17 Oct 2023 06:58:11 -0400 Subject: [PATCH] Add more version and GIT repo information to log. Also show conf file content. Fixes #262 Signed-off-by: Gil Bregman --- .env | 2 +- Dockerfile | 16 +++++++++++++--- Makefile | 4 +++- control/grpc.py | 31 +++++++++++++++++++++++++++++++ docker-compose.yaml | 2 ++ 5 files changed, 50 insertions(+), 5 deletions(-) diff --git a/.env b/.env index d952581e..1b6ce4b6 100644 --- a/.env +++ b/.env @@ -18,6 +18,7 @@ HUGEPAGES_DIR="/sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages" NVMEOF_VERSION="${VERSION}" NVMEOF_CONFIG="./ceph-nvmeof.conf" NVMEOF_SPDK_VERSION="${SPDK_VERSION}" +NVMEOF_CEPH_VERSION="${CEPH_VERSION}" NVMEOF_NAME="ceph-nvmeof" NVMEOF_SUMMARY="Ceph NVMe over Fabrics Gateway" NVMEOF_DESCRIPTION="Service to provide block storage on top of Ceph for platforms (e.g.: VMWare) without native Ceph support (RBD), replacing existing approaches (iSCSI) with a newer and more versatile standard (NVMe-oF)." @@ -29,7 +30,6 @@ NVMEOF_IO_PORT=4420 NVMEOF_GW_PORT=5500 NVMEOF_DISC_PORT=8009 NVMEOF_EXPOSE_SERVICES="${NVMEOF_IO_PORT}/tcp:nvme,${NVMEOF_GW_PORT}/tcp:grpc,${NVMEOF_DISC_PORT}/tcp:nvme-disc" -NVMEOF_GIT_REPO="https://github.com/ceph/ceph-nvmeof.git" # NVMe-oF CLI MVMEOF_CLI_VERSION="${VERSION}" diff --git a/Dockerfile b/Dockerfile index 6547dd13..c001fc4e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -52,9 +52,19 @@ ARG NVMEOF_NAME \ BUILD_DATE \ NVMEOF_GIT_REPO \ NVMEOF_GIT_BRANCH \ - NVMEOF_GIT_COMMIT - -ENV NVMEOF_VERSION="${NVMEOF_VERSION}" + NVMEOF_GIT_COMMIT \ + NVMEOF_SPDK_VERSION \ + NVMEOF_CEPH_VERSION \ + NVMEOF_GIT_MODIFIED_FILES + +ENV NVMEOF_VERSION="${NVMEOF_VERSION}" \ + NVMEOF_GIT_REPO="${NVMEOF_GIT_REPO}" \ + NVMEOF_GIT_BRANCH="${NVMEOF_GIT_BRANCH}" \ + NVMEOF_GIT_COMMIT="${NVMEOF_GIT_COMMIT}" \ + BUILD_DATE="${BUILD_DATE}" \ + NVMEOF_SPDK_VERSION="${NVMEOF_SPDK_VERSION}" \ + NVMEOF_CEPH_VERSION="${NVMEOF_CEPH_VERSION}" \ + NVMEOF_GIT_MODIFIED_FILES="${NVMEOF_GIT_MODIFIED_FILES}" # Generic labels LABEL name="$NVMEOF_NAME" \ diff --git a/Makefile b/Makefile index db01c41a..dcba0c29 100644 --- a/Makefile +++ b/Makefile @@ -24,12 +24,14 @@ setup: ## Configure huge-pages (requires sudo/root password) build pull logs: SVC ?= spdk bdevperf nvmeof nvmeof-devel nvmeof-cli discovery ceph +build: export NVMEOF_GIT_REPO != git remote get-url origin build: export NVMEOF_GIT_BRANCH != git name-rev --name-only HEAD build: export NVMEOF_GIT_COMMIT != git rev-parse HEAD build: export SPDK_GIT_REPO != git -C spdk remote get-url origin build: export SPDK_GIT_BRANCH != git -C spdk name-rev --name-only HEAD build: export SPDK_GIT_COMMIT != git rev-parse HEAD:spdk -build: export BUILD_DATE != date -u +"%Y-%m-%dT%H:%M:%SZ" +build: export BUILD_DATE != date -u +"%Y-%m-%d %H:%M:%S %Z" +build: export NVMEOF_GIT_MODIFIED_FILES != git status -s | grep -e "^ *M" | sed 's/^ *M //' | xargs up: ## Launch services up: SVC ?= ceph nvmeof ## Services diff --git a/control/grpc.py b/control/grpc.py index 2bb285b1..22b1b068 100644 --- a/control/grpc.py +++ b/control/grpc.py @@ -43,8 +43,39 @@ def __init__(self, config, gateway_state, spdk_rpc_client) -> None: ver = os.getenv("NVMEOF_VERSION") if ver: self.logger.info(f"Using NVMeoF gateway version {ver}") + spdk_ver = os.getenv("NVMEOF_SPDK_VERSION") + if spdk_ver: + self.logger.info(f"Using SPDK version {spdk_ver}") + ceph_ver = os.getenv("NVMEOF_CEPH_VERSION") + if ceph_ver: + self.logger.info(f"Using Ceph version {ceph_ver}") + build_date = os.getenv("BUILD_DATE") + if build_date: + self.logger.info(f"NVMeoF gateway built on: {build_date}") + git_rep = os.getenv("NVMEOF_GIT_REPO") + if git_rep: + self.logger.info(f"NVMeoF gateway Git repository: {git_rep}") + git_branch = os.getenv("NVMEOF_GIT_BRANCH") + if git_branch: + self.logger.info(f"NVMeoF gateway Git branch: {git_branch}") + git_commit = os.getenv("NVMEOF_GIT_COMMIT") + if git_commit: + self.logger.info(f"NVMeoF gateway Git commit: {git_commit}") + git_modified = os.getenv("NVMEOF_GIT_MODIFIED_FILES") + if git_modified: + self.logger.info(f"NVMeoF gateway uncommitted modified files: {git_modified}") self.config = config self.logger.info(f"Using configuration file {config.filepath}") + try: + with open(config.filepath) as f: + self.logger.info(f"Configuration file content:") + self.logger.info(f"============================================================================") + for line in f: + line = line.rstrip() + self.logger.info(f"{line}") + self.logger.info(f"============================================================================") + except Exception: + pass self.rpc_lock = threading.Lock() self.gateway_state = gateway_state self.spdk_rpc_client = spdk_rpc_client diff --git a/docker-compose.yaml b/docker-compose.yaml index 2a6828c2..926eb3cc 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -97,6 +97,8 @@ services: NVMEOF_GIT_REPO: NVMEOF_GIT_BRANCH: NVMEOF_GIT_COMMIT: + NVMEOF_GIT_MODIFIED_FILES: + NVMEOF_CEPH_VERSION: labels: io.ceph.nvmeof: volumes: