]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: run kcli commands in libvritd group 68178/head
authorNizamudeen A <nia@redhat.com>
Thu, 2 Apr 2026 10:55:19 +0000 (16:25 +0530)
committerNizamudeen A <nia@redhat.com>
Thu, 2 Apr 2026 10:56:49 +0000 (16:26 +0530)
Also https://github.com/ceph/ceph-build/pull/2562/
Signed-off-by: Nizamudeen A <nia@redhat.com>
src/pybind/mgr/dashboard/ci/cephadm/run-cephadm-e2e-tests.sh
src/pybind/mgr/dashboard/ci/cephadm/start-cluster.sh
src/pybind/mgr/dashboard/ci/cephadm/utils.sh [new file with mode: 0644]

index e6b860b556951d72ee9aaff6ef54d95e2cde2730..07ef408d4bbde02b43a6e1cad519d50668aee106 100755 (executable)
@@ -1,4 +1,5 @@
 #!/usr/bin/env bash
+source "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
 
 set -ex
 
@@ -9,7 +10,7 @@ set -ex
 : ${DASHBOARD_PORT:='8443'}
 
 get_vm_ip () {
-    local ip=$(kcli info vm "$1" -f ip -v | grep -Eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')
+    local ip=$(with_libvirt "kcli info vm \"$1\" -f ip -v" | grep -Eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')
     echo -n $ip
 }
 
index 4e3f887d20f9c23073ede91c18ad0cf6862c73e9..8d8adb1e89e0d6e140204d2b922165ed49854993 100755 (executable)
@@ -1,4 +1,5 @@
 #!/usr/bin/env bash
+source "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
 
 set -eEx
 
@@ -12,16 +13,16 @@ on_error() {
         echo "Saving MGR logs:"
         echo
         mkdir -p ${CEPH_DEV_FOLDER}/logs
-        kcli ssh -u root -- ceph-node-00 'cephadm logs -n \$(cephadm ls | grep -Eo "mgr\.ceph[0-9a-z.-]+" | head -n 1) -- --no-tail --no-pager' > ${CEPH_DEV_FOLDER}/logs/mgr.cephadm.log
+        with_libvirt "kcli ssh -u root -- ceph-node-00 'cephadm logs -n \$(cephadm ls | grep -Eo "mgr\.ceph[0-9a-z.-]+" | head -n 1) -- --no-tail --no-pager' > ${CEPH_DEV_FOLDER}/logs/mgr.cephadm.log"
         for vm_id in {0..3}
         do
             local vm="ceph-node-0${vm_id}"
             echo "Saving journalctl from VM ${vm}:"
             echo
-            kcli ssh -u root -- ${vm} 'journalctl --no-tail --no-pager -t cloud-init' > ${CEPH_DEV_FOLDER}/logs/journal.ceph-node-0${vm_id}.log || true
+            with_libvirt "kcli ssh -u root -- ${vm} 'journalctl --no-tail --no-pager -t cloud-init' > ${CEPH_DEV_FOLDER}/logs/journal.ceph-node-0${vm_id}.log || true"
             echo "Saving container logs:"
             echo
-            kcli ssh -u root -- ${vm} 'podman logs --names --since 30s \$(podman ps -aq)' > ${CEPH_DEV_FOLDER}/logs/container.ceph-node-0${vm_id}.log || true
+            with_libvirt "kcli ssh -u root -- ${vm} 'podman logs --names --since 30s \$(podman ps -aq)' > ${CEPH_DEV_FOLDER}/logs/container.ceph-node-0${vm_id}.log || true"
         done
         echo "TEST FAILED."
     fi
@@ -43,7 +44,7 @@ for arg in "$@"; do
   esac
 done
 
-kcli delete plan -y ceph || true
+with_libvirt "kcli delete plan -y ceph || true"
 
 # Build dashboard frontend (required to start the module).
 cd ${CEPH_DEV_FOLDER}/src/pybind/mgr/dashboard/frontend
@@ -61,32 +62,32 @@ npm run build ${FRONTEND_BUILD_OPTS} &
 cd ${CEPH_DEV_FOLDER}
 : ${VM_IMAGE:='fedora42'}
 : ${VM_IMAGE_URL:='https://download.fedoraproject.org/pub/fedora/linux/releases/42/Cloud/x86_64/images/Fedora-Cloud-Base-Generic-42-1.1.x86_64.qcow2'}
-kcli download image -p ceph-dashboard -u ${VM_IMAGE_URL} ${VM_IMAGE}
-kcli delete plan -y ceph || true
+with_libvirt "kcli download image -p ceph-dashboard -u ${VM_IMAGE_URL} ${VM_IMAGE}"
+with_libvirt "kcli delete plan -y ceph || true"
 # Compile cephadm locally for the shared_ceph_folder to pick it up
 cd ${CEPH_DEV_FOLDER}/src/cephadm
 ./build.sh ${CEPH_DEV_FOLDER}/src/cephadm/cephadm
 cd ${CEPH_DEV_FOLDER}
-kcli create plan -f src/pybind/mgr/dashboard/ci/cephadm/ceph_cluster.yml \
+with_libvirt "kcli create plan -f src/pybind/mgr/dashboard/ci/cephadm/ceph_cluster.yml \
     -P ceph_dev_folder=${CEPH_DEV_FOLDER} \
-    ${EXTRA_PARAMS} ceph
+    ${EXTRA_PARAMS} ceph"
 
 : ${CLUSTER_DEBUG:=0}
 : ${DASHBOARD_CHECK_INTERVAL:=10}
-while [[ -z $(kcli ssh -u root -- ceph-node-00 'journalctl --no-tail --no-pager -t cloud-init' | grep "kcli boot finished") ]]; do
+while [[ -z $(with_libvirt "kcli ssh -u root -- ceph-node-00 'journalctl --no-tail --no-pager -t cloud-init' | grep "kcli boot finished"") ]]; do
     sleep ${DASHBOARD_CHECK_INTERVAL}
-    kcli list vm
+    with_libvirt "kcli list vm"
     if [[ ${CLUSTER_DEBUG} != 0 ]]; then
-        kcli ssh -u root -- ceph-node-00 'podman ps -a'
-        kcli ssh -u root -- ceph-node-00 'podman logs --names --since 30s \$(podman ps -aq)'
+        with_libvirt "kcli ssh -u root -- ceph-node-00 'podman ps -a'"
+        with_libvirt "kcli ssh -u root -- ceph-node-00 'podman logs --names --since 30s \$(podman ps -aq)'"
     fi
-    kcli ssh -u root -- ceph-node-00 'journalctl -n 100 --no-pager -t cloud-init'
+    with_libvirt "kcli ssh -u root -- ceph-node-00 'journalctl -n 100 --no-pager -t cloud-init'"
 done
 
-kcli ssh -u root ceph-node-00 'cephadm shell "ceph config set mgr mgr/prometheus/exclude_perf_counters false"'
+with_libvirt "kcli ssh -u root ceph-node-00 'cephadm shell "ceph config set mgr mgr/prometheus/exclude_perf_counters false"'"
 
 get_prometheus_running_count() {
-    echo $(kcli ssh -u root ceph-node-00 'cephadm shell "ceph orch ls --service_name=prometheus --format=json"' | jq -r '.[] | .status.running')
+    echo $(with_libvirt "kcli ssh -u root ceph-node-00 'cephadm shell "ceph orch ls --service_name=prometheus --format=json"' | jq -r '.[] | .status.running'")
 }
 
 # check if the prometheus daemon is running on jenkins node
@@ -111,8 +112,8 @@ if [[ -n "${JENKINS_HOME}" ]]; then
 
     # grafana ip address is set to the fqdn by default.
     # kcli is not working with that, so setting the IP manually.
-    kcli ssh -u root ceph-node-00 'cephadm shell "ceph dashboard set-alertmanager-api-host http://192.168.100.100:9093"'
-    kcli ssh -u root ceph-node-00 'cephadm shell "ceph dashboard set-prometheus-api-host http://192.168.100.100:9095"'
-    kcli ssh -u root ceph-node-00 'cephadm shell "ceph dashboard set-grafana-api-url https://192.168.100.100:3000"'
-    kcli ssh -u root ceph-node-00 'cephadm shell "ceph orch apply node-exporter --placement 'count:2'"'
+    with_libvirt "kcli ssh -u root ceph-node-00 'cephadm shell "ceph dashboard set-alertmanager-api-host http://192.168.100.100:9093"'"
+    with_libvirt "kcli ssh -u root ceph-node-00 'cephadm shell "ceph dashboard set-prometheus-api-host http://192.168.100.100:9095"'"
+    with_libvirt "kcli ssh -u root ceph-node-00 'cephadm shell "ceph dashboard set-grafana-api-url https://192.168.100.100:3000"'"
+    with_libvirt "kcli ssh -u root ceph-node-00 'cephadm shell "ceph orch apply node-exporter --placement 'count:2"'"'
 fi
diff --git a/src/pybind/mgr/dashboard/ci/cephadm/utils.sh b/src/pybind/mgr/dashboard/ci/cephadm/utils.sh
new file mode 100644 (file)
index 0000000..136b108
--- /dev/null
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+
+with_libvirt() {
+    if [[ -n "${JENKINS_HOME}" ]]; then
+        sg libvirt -c "$1"
+    else
+        eval "$1"
+    fi
+}