diff options
| author | Simon Rettberg | 2015-10-16 16:07:27 +0200 |
|---|---|---|
| committer | Simon Rettberg | 2015-10-16 16:07:27 +0200 |
| commit | 373aaf9a25762a0ec4adc02c1cbf7167a0c0645e (patch) | |
| tree | 8581dca6fa9a213acddd51a3c899cfd210c2c61d /remote | |
| parent | [kernel.inc] copy firmware from both the system and the build directory, prio... (diff) | |
| download | tm-scripts-373aaf9a25762a0ec4adc02c1cbf7167a0c0645e.tar.gz tm-scripts-373aaf9a25762a0ec4adc02c1cbf7167a0c0645e.tar.xz tm-scripts-373aaf9a25762a0ec4adc02c1cbf7167a0c0645e.zip | |
[run-virt] Remote error logging if mounting vmstore fails
Diffstat (limited to 'remote')
| -rwxr-xr-x | remote/modules/run-virt/data/opt/openslx/scripts/systemd-mount_vm_store | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/remote/modules/run-virt/data/opt/openslx/scripts/systemd-mount_vm_store b/remote/modules/run-virt/data/opt/openslx/scripts/systemd-mount_vm_store index 5e1ebf43..4559e1e3 100755 --- a/remote/modules/run-virt/data/opt/openslx/scripts/systemd-mount_vm_store +++ b/remote/modules/run-virt/data/opt/openslx/scripts/systemd-mount_vm_store @@ -2,19 +2,38 @@ . /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-missing" "No SLX_VM_NFS given in /opt/openslx/config!" && exit 1 # create target directory mkdir -p /mnt/vmstore +OUTFILE=$(mktemp) + # check if it is a CIFS-share or NFS-share # no bash, so this is a bit ugly... 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 + /opt/openslx/bin/timeout -t 10 -s 9 mount -v -t nfs -o ro,async,nolock "$SLX_VM_NFS" /mnt/vmstore + RET=$? else # starts with '//' -> assume CIFS export USER="$SLX_VM_NFS_USER" export PASSWD="$SLX_VM_NFS_PASSWD" - mount -t cifs -o ro,file_mode=0644,dir_mode=0755,uid=0,gid=0,forceuid,forcegid,sec=ntlm,nounix "$SLX_VM_NFS" /mnt/vmstore + /opt/openslx/bin/timeout -t 10 -s 9 mount -v -t cifs -o ro,file_mode=0644,dir_mode=0755,uid=0,gid=0,forceuid,forcegid,sec=ntlm,nounix "$SLX_VM_NFS" /mnt/vmstore + unset USER + unset PASSWD + RET=$? +fi > "$OUTFILE" 2>&1 + +if [ $RET -ne 0 ]; then + if [ -s "$OUTFILE" ]; then + slxlog "mount-vmstore-fail" "Mounting '$SLX_VM_NFS' failed. VMs will not boot." "$OUTFILE" + sleep 1 + else + slxlog "mount-vmstore-fail" "Mounting '$SLX_VM_NFS' failed. VMs will not boot." + fi fi + +rm -f -- "$OUTFILE" +exit $RET + |
