diff options
| author | Jonathan Bauer | 2014-06-02 15:16:51 +0200 |
|---|---|---|
| committer | Jonathan Bauer | 2014-06-02 15:16:51 +0200 |
| commit | e05bb43b76e54349fc8e92b99ec834941487c320 (patch) | |
| tree | c0c1c8643293b50be8e40964e4655f530ef77bb8 | |
| parent | [pam] fix slxlog error when TEMP_HOME_DIR was previously created by a previou... (diff) | |
| download | tm-scripts-e05bb43b76e54349fc8e92b99ec834941487c320.tar.gz tm-scripts-e05bb43b76e54349fc8e92b99ec834941487c320.tar.xz tm-scripts-e05bb43b76e54349fc8e92b99ec834941487c320.zip | |
[vmchooser] error handling for vmstore mountage
| -rwxr-xr-x | remote/modules/vmchooser/data/opt/openslx/scripts/systemd-mount_vm_store | 15 |
1 files 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 |
