Merge "CI: improve get_logs.sh"

This commit is contained in:
Zuul 2024-08-20 06:56:02 +00:00 committed by Gerrit Code Review
commit 5081197e58

View File

@ -16,10 +16,10 @@ copy_logs() {
exit 1
fi
cp -rnL ${VOLUMES_DIR}/kolla_logs/_data/* ${LOG_DIR}/kolla/
cp -rnL /etc/kolla/* ${LOG_DIR}/kolla_configs/
[ -d ${VOLUMES_DIR}/kolla_logs/_data ] && cp -rnL ${VOLUMES_DIR}/kolla_logs/_data/* ${LOG_DIR}/kolla/
[ -d /etc/kolla ] && cp -rnL /etc/kolla/* ${LOG_DIR}/kolla_configs/
# Don't save the IPA images.
rm ${LOG_DIR}/kolla_configs/config/ironic/ironic-agent.{kernel,initramfs}
rm -f ${LOG_DIR}/kolla_configs/config/ironic/ironic-agent.{kernel,initramfs}
mkdir ${LOG_DIR}/system_configs/
cp -rL /etc/{hostname,hosts,host.conf,resolv.conf,nsswitch.conf,systemd} ${LOG_DIR}/system_configs/
# copy docker configs if used
@ -39,10 +39,6 @@ copy_logs() {
if [ "$CONTAINER_ENGINE" = "docker" ]; then
journalctl --no-pager -u containerd.service > ${LOG_DIR}/system_logs/containerd.log
fi
else
if [ "$CONTAINER_ENGINE" = "docker" ]; then
cp /var/log/upstart/docker.log ${LOG_DIR}/system_logs/docker.log
fi
fi
cp -r /etc/sudoers.d ${LOG_DIR}/system_logs/
@ -103,21 +99,22 @@ copy_logs() {
ps -eo user,pid,ppid,lwp,%cpu,%mem,size,rss,cmd > ${LOG_DIR}/system_logs/ps.txt
# container engine related information
(${CONTAINER_ENGINE} info &&
[ `command -v ${CONTAINER_ENGINE}` ] &&
( ${CONTAINER_ENGINE} info &&
${CONTAINER_ENGINE} images &&
${CONTAINER_ENGINE} ps -a &&
${CONTAINER_ENGINE} network ls &&
${CONTAINER_ENGINE} inspect $(${CONTAINER_ENGINE} ps -aq)) > ${LOG_DIR}/system_logs/${CONTAINER_ENGINE}-info.txt
# save dbus services
dbus-send --system --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.ListNames > ${LOG_DIR}/system_logs/dbus-services.txt
[ `command -v dbus-send` ] && dbus-send --system --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.ListNames > ${LOG_DIR}/system_logs/dbus-services.txt
# cephadm related logs
if [ `command -v cephadm` ]; then
mkdir -p ${LOG_DIR}/ceph
sudo cp /etc/ceph/ceph.conf ${LOG_DIR}/ceph
sudo cp /var/run/ceph/*/cluster.yml ${LOG_DIR}/ceph/cluster.yml
sudo cp /var/log/ceph/cephadm.log* ${LOG_DIR}/ceph/
[ -d /etc/ceph ] && sudo cp /etc/ceph/ceph.conf ${LOG_DIR}/ceph
[ -d /var/run/ceph ] && sudo cp /var/run/ceph/*/cluster.yml ${LOG_DIR}/ceph/cluster.yml
[ -d /var/log/ceph ] && sudo cp /var/log/ceph/cephadm.log* ${LOG_DIR}/ceph/
sudo cephadm shell -- ceph --connect-timeout 5 -s > ${LOG_DIR}/ceph/ceph_s.txt
sudo cephadm shell -- ceph --connect-timeout 5 osd tree > ${LOG_DIR}/ceph/ceph_osd_tree.txt
fi