From c8831576d96c8a17a0646ad76367e68f345b3616 Mon Sep 17 00:00:00 2001
From: r0zehnal0vak <k.rozehnalka@seznam.cz>
Date: Tue, 3 Jun 2025 10:34:09 +0200
Subject: [PATCH] fix gpumon metric generation and update image

---
 CHANGELOG.md                    | 5 +++++
 Dockerfile                      | 2 +-
 dependencies.yum.txt            | 3 +--
 src/metric-generators/gpumon.sh | 4 +++-
 4 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 96f90f4..5654ec7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 ## [Unreleased]
 
+## [1.4.0] - 2025-06-03
+### Changed
+- prevent failure when no passthrough vm_domain_file is found 
+- update base image version
+
 ## [1.3.4] - 2024-03-25
 ### Added
 - cephpingmon added as optional module (default behavior unchanged), add fping dependency
diff --git a/Dockerfile b/Dockerfile
index eb73492..6cd789f 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-FROM registry.gitlab.ics.muni.cz:443/cloud/container-registry/centos:7
+FROM quay.io/centos/centos:stream9
 
 ARG VERSION=unknown-version
 ARG BUILD_DATE=unknown-date
diff --git a/dependencies.yum.txt b/dependencies.yum.txt
index dab0d12..899e5eb 100644
--- a/dependencies.yum.txt
+++ b/dependencies.yum.txt
@@ -1,8 +1,7 @@
 jq
 bash
 gawk
-docker-client
-curl
+docker
 cronie
 smartmontools
 pciutils
diff --git a/src/metric-generators/gpumon.sh b/src/metric-generators/gpumon.sh
index 1c37b76..f0e5a0e 100755
--- a/src/metric-generators/gpumon.sh
+++ b/src/metric-generators/gpumon.sh
@@ -74,7 +74,9 @@ if [ -n "${GPU_DEVICES}" ]; then
           if lspci -v -s "${i_gpu_device_location}" | grep -qE 'Kernel driver in use: .+'; then
               i_gpu_attached=1
               i_vm_domain_file="$(find_gpu_passthough_vm_manifest "${i_gpu_device_location}")"
-              i_vm_domain_name="$(basename $(echo "${i_vm_domain_file}" | head -1) | sed 's/.xml//g')"
+              if [ -n "${i_vm_domain_file}" ]; then
+                  i_vm_domain_name="$(basename "$(echo "${i_vm_domain_file}" | head -1)" | sed 's/.xml//g')"
+              fi
           fi
           printf '%s{device="%s",vendor="%s",location="%s",revision="%s",domain="%s"} %d\n' "${METRIC_NAME}" \
             "${i_gpu_device_model}" "${i_gpu_device_vendor}" "${i_gpu_device_location}" \
-- 
GitLab