From e05bb43b76e54349fc8e92b99ec834941487c320 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Mon, 2 Jun 2014 15:16:51 +0200 Subject: [vmchooser] error handling for vmstore mountage --- .../data/opt/openslx/scripts/systemd-mount_vm_store | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/remote/modules/vmchooser/data/opt/openslx/scripts/systemd-mount_vm_store b/remote/modules/vmchooser/data/opt/openslx/scripts/systemd-mount_vm_store index 0915169c..c15a9504 100755 --- a/remote/modules/vmchooser/data/opt/openslx/scripts/systemd-mount_vm_store +++ b/remote/modules/vmchooser/data/opt/openslx/scripts/systemd-mount_vm_store @@ -2,17 +2,26 @@ . /opt/openslx/config || exit 1 -[ -z "$SLX_VM_NFS" ] && slxlog "mount-vmstore" "No SLX_VM_NFS given in /opt/openslx/config!" && exit 1 +[ -z "$SLX_VM_NFS" ] && slxlog "mount-vmstore-config" "No SLX_VM_NFS given in /opt/openslx/config!" && exit 1 +[ "x${SLX_VM_NFS}" = "xdnbd3" ] && exit 0 # create target directory mkdir -p /mnt/vmstore # check if it is a CIFS-share or NFS-share # no bash, so this is a bit ugly... +TMP_LOG=$(mktemp) if [ "${SLX_VM_NFS#//}" = "${SLX_VM_NFS}" ]; then # doesn't start with '//' -> assume NFS - mount -t nfs -o ro,async,nolock "$SLX_VM_NFS" /mnt/vmstore + mount -t nfs -o ro,async,nolock "$SLX_VM_NFS" /mnt/vmstore > "${TEMP_LOG}" + RET=$? else # starts with '//' -> assume CIFS - mount -t cifs -o guest,ro,file_mode=0644,dir_mode=0755 "$SLX_VM_NFS" /mnt/vmstore + mount -t cifs -o guest,ro,file_mode=0644,dir_mode=0755 "$SLX_VM_NFS" /mnt/vmstore > "${TEMP_LOG}" + RET=$? +fi + +# check for errors +if [ $RET -ne 0 ]; then + slxlog "mount-vmstore-exec" "Mount of '$SLX_VM_NFS' failed with '$RET'." "${TEMP_LOG}" fi -- cgit v1.2.3-55-g7522