handler: show unit logs on error

This will tremendously help debugging daemons that fail on restart by
showing the systemd unit logs.

Signed-off-by: Sébastien Han <seb@redhat.com>
pull/3372/head
Sébastien Han 2018-11-27 10:45:05 +01:00 committed by mergify[bot]
parent 83a67648d8
commit a9b337ba66
7 changed files with 14 additions and 7 deletions

View File

@ -21,5 +21,6 @@ while [ $RETRIES -ne 0 ]; do
let RETRIES=RETRIES-1 let RETRIES=RETRIES-1
done done
# If we reach this point, it means the socket is not present. # If we reach this point, it means the socket is not present.
echo "Socket file ${SOCKET} could not be found, which means the Metadata Server is not running." echo "Socket file ${SOCKET} could not be found, which means the Metadata Server is not running. Showing ceph-mds unit logs now:"
journalctl -u ceph-mds@${MDS_NAME}
exit 1 exit 1

View File

@ -22,5 +22,6 @@ while [ $RETRIES -ne 0 ]; do
let RETRIES=RETRIES-1 let RETRIES=RETRIES-1
done done
# If we reach this point, it means the socket is not present. # If we reach this point, it means the socket is not present.
echo "Socket file ${SOCKET} could not be found, which means ceph manager is not running." echo "Socket file ${SOCKET} could not be found, which means ceph manager is not running. Showing ceph-mgr unit logs now:"
journalctl -u ceph-mgr@${MGR_NAME}
exit 1 exit 1

View File

@ -38,5 +38,6 @@ while [ $COUNT -ne 0 ]; do
let COUNT=COUNT-1 let COUNT=COUNT-1
done done
# If we reach this point, it means the socket is not present. # If we reach this point, it means the socket is not present.
echo "Socket file ${SOCKET} could not be found, which means the monitor is not running." echo "Socket file ${SOCKET} could not be found, which means the monitor is not running. Showing ceph-mon unit logs now:"
journalctl -u ceph-mon@{{ ansible_hostname }}
exit 1 exit 1

View File

@ -18,7 +18,8 @@ while [ $RETRIES -ne 0 ]; do
let RETRIES=RETRIES-1 let RETRIES=RETRIES-1
done done
# If we reach this point, it means the pid is not present. # If we reach this point, it means the pid is not present.
echo "PID file ${PID} could not be found, which means Ganesha is not running." echo "PID file ${PID} could not be found, which means Ganesha is not running. Showing $NFS_NAME unit logs now:"
journalctl -u $NFS_NAME
exit 1 exit 1
{% else %} {% else %}
systemctl restart nfs-ganesha systemctl restart nfs-ganesha

View File

@ -87,6 +87,7 @@ for unit in $(systemctl list-units | grep -E "loaded * active" | grep -oE "ceph-
let COUNT=COUNT-1 let COUNT=COUNT-1
done done
# If we reach this point, it means the socket is not present. # If we reach this point, it means the socket is not present.
echo "Socket file ${SOCKET} could not be found, which means the osd daemon is not running." echo "Socket file ${SOCKET} could not be found, which means the osd daemon is not running. Showing ceph-osd unit logs now:"
journalctl -u "${unit}"
exit 1 exit 1
done done

View File

@ -21,5 +21,6 @@ while [ $RETRIES -ne 0 ]; do
let RETRIES=RETRIES-1 let RETRIES=RETRIES-1
done done
# If we reach this point, it means the socket is not present. # If we reach this point, it means the socket is not present.
echo "Socket file ${SOCKET} could not be found, which means rbd mirror is not running." echo "Socket file ${SOCKET} could not be found, which means rbd mirror is not running. Showing ceph-rbd-mirror unit logs now:"
journalctl -u ceph-rbd-mirror@rbd-mirror.${RBD_MIRROR_NAME}
exit 1 exit 1

View File

@ -46,5 +46,6 @@ while [ $COUNT -ne 0 ]; do
sleep $DELAY sleep $DELAY
let COUNT=COUNT-1 let COUNT=COUNT-1
done done
echo "Socket file ${SOCKET} could not be found, which means Rados Gateway is not running." echo "Socket file ${SOCKET} could not be found, which means Rados Gateway is not running. Showing ceph-rgw unit logs now:"
journalctl -u ceph-radosgw@rgw.${RGW_NAME}
exit 1 exit 1