rbdmap: drop init- prefix from logger tag

Since init-rbdmap is sysvinit-specific, tagging log lines "init-rbdmap" is
potentially misleading.

In systemd- and upstart-based systems, /usr/bin/rbdmap is run directly.

Signed-off-by: Nathan Cutler <ncutler@suse.com>
This commit is contained in:
Nathan Cutler 2016-03-19 06:27:13 +01:00
parent 27bbf3e63c
commit c3adc90c62

View File

@ -6,7 +6,7 @@ do_map() {
printenv RBDMAPFILE >/dev/null || local RBDMAPFILE=/etc/ceph/rbdmap
if [ ! -f "$RBDMAPFILE" ]; then
logger -p "daemon.warning" -t init-rbdmap "No $RBDMAPFILE found."
logger -p "daemon.warning" -t rbdmap "No $RBDMAPFILE found."
exit 0
fi
@ -23,7 +23,7 @@ do_map() {
DEV=rbd/$DEV
;;
esac
logger -p "daemon.debug" -t init-rbdmap "Mapping '${DEV}'"
logger -p "daemon.debug" -t rbdmap "Mapping '${DEV}'"
newrbd=""
MAP_RV=""
OIFS=$IFS
@ -41,22 +41,22 @@ do_map() {
newrbd="yes"
else
RET=$((${RET}+$?))
logger -p "daemon.warning" -t init-rbdmap "Failed to map '${DEV}"
logger -p "daemon.warning" -t rbdmap "Failed to map '${DEV}"
continue
fi
fi
logger -p "daemon.debug" -t init-rbdmap "Mapped '${DEV}' to '${MAP_RV}'"
logger -p "daemon.debug" -t rbdmap "Mapped '${DEV}' to '${MAP_RV}'"
if [ "$newrbd" ]; then
## Mount new rbd
MNT_RV=""
mount --fake /dev/rbd/$DEV >>/dev/null 2>&1 \
&& MNT_RV=$(mount -vn /dev/rbd/$DEV 2>&1)
[ -n "${MNT_RV}" ] && logger -p "daemon.debug" -t init-rbdmap "Mounted '${MAP_RV}' to '${MNT_RV}'"
[ -n "${MNT_RV}" ] && logger -p "daemon.debug" -t rbdmap "Mounted '${MAP_RV}' to '${MNT_RV}'"
## post-mapping
if [ -x "/etc/ceph/rbd.d/${DEV}" ]; then
logger -p "daemon.debug" -t init-rbdmap "Running post-map hook '/etc/ceph/rbd.d/${DEV}'"
logger -p "daemon.debug" -t rbdmap "Running post-map hook '/etc/ceph/rbd.d/${DEV}'"
/etc/ceph/rbd.d/${DEV} map "/dev/rbd/${DEV}"
fi
fi
@ -75,32 +75,32 @@ do_unmap() {
LL="${L##/dev/rbd/}"
if [ "$(readlink -f $L)" = "${DEV}" ] \
&& [ -x "/etc/ceph/rbd.d/${LL}" ]; then
logger -p "daemon.debug" -t init-rbdmap "Running pre-unmap hook for '${DEV}': '/etc/ceph/rbd.d/${LL}'"
logger -p "daemon.debug" -t rbdmap "Running pre-unmap hook for '${DEV}': '/etc/ceph/rbd.d/${LL}'"
/etc/ceph/rbd.d/${LL} unmap "$L"
break
fi
done
logger -p "daemon.debug" -t init-rbdmap "Unmapping '${DEV}'"
logger -p "daemon.debug" -t rbdmap "Unmapping '${DEV}'"
MNT=$(findmnt --mtab --source ${DEV} --noheadings | awk '{print $1'})
if [ -n "${MNT}" ]; then
logger -p "daemon.debug" -t init-rbdmap "Unmounting '${MNT}'"
logger -p "daemon.debug" -t rbdmap "Unmounting '${MNT}'"
umount "${MNT}" >>/dev/null 2>&1
fi
if mountpoint -q "${MNT}"; then
## Un-mounting failed.
logger -p "daemon.warning" -t init-rbdmap "Failed to unmount '${MNT}'"
logger -p "daemon.warning" -t rbdmap "Failed to unmount '${MNT}'"
RET=$((${RET}+1))
continue
fi
## Un-mapping.
rbd unmap $DEV >>/dev/null 2>&1
if [ $? -ne 0 ]; then
logger -p "daemon.warning" -t init-rbdmap "Failed to unmap '${MNT}'"
logger -p "daemon.warning" -t rbdmap "Failed to unmap '${MNT}'"
RET=$((${RET}+$?))
continue
fi
logger -p "daemon.debug" -t init-rbdmap "Unmapped '${DEV}'"
logger -p "daemon.debug" -t rbdmap "Unmapped '${DEV}'"
done
fi
exit ${RET}