1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-30 22:50:10 +03:00

im/monitor_ds.sh skip broken symlinks

Most probably my test setup is too weird but if you have
/var/lib/one/datastores shared on all hosts and want to have 
SYSTEM datastore with TM_MAD on one of the hosts, I am doing the following:

mkdir -p /var/lib/one-local/102
ln -s /var/lib/one/local/102 /var/lib/one/datastores/102

This way I have "local" datastore nested in "shared" filesystem.

In the above scenario on all other hosts the symlink is dead.

The proposed patch test the is the $dir directory and continue only if it is indeed directory.
This commit is contained in:
Anton Todorov 2016-06-09 17:07:13 +03:00
parent af9f06e0dc
commit 64d68496aa

View File

@ -44,6 +44,8 @@ for ds in $dirs; do
dir=$DATASTORE_LOCATION/$ds
test -d "$dir" || continue
USED_MB=$(df -B1M -P $dir 2>/dev/null | tail -n 1 | awk '{print $3}')
TOTAL_MB=$(df -B1M -P $dir 2>/dev/null | tail -n 1 | awk '{print $2}')
FREE_MB=$(df -B1M -P $dir 2>/dev/null | tail -n 1 | awk '{print $4}')