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

Add more version and GIT repo information to log. Also show conf file content #267

Merged
merged 1 commit into from
Oct 17, 2023
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
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -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)."
Expand All @@ -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}"
Expand Down
16 changes: 13 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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" \
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
31 changes: 31 additions & 0 deletions control/grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down