From 4d00e2bf321f07e75e5890095b219ff3d8696cd6 Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Thu, 27 Jun 2013 18:07:58 +0200 Subject: [PATCH] feature #1613: Update Datastore information. Minor monitor fixes --- src/datastore_mad/remotes/fs/monitor | 14 +++++--- src/image/ImageManagerDriver.cc | 53 ++++++++++++++++++++++++---- 2 files changed, 56 insertions(+), 11 deletions(-) diff --git a/src/datastore_mad/remotes/fs/monitor b/src/datastore_mad/remotes/fs/monitor index 2ac5a049ac..69b76dc3c9 100755 --- a/src/datastore_mad/remotes/fs/monitor +++ b/src/datastore_mad/remotes/fs/monitor @@ -50,14 +50,20 @@ BASE_PATH="${XPATH_ELEMENTS[0]}" # ------------ Compute datastore usage ------------- -USED_MB=`du -sLm $BASE_PATH | cut -f1` -TOTAL_MB=`df -B1M --output=size $BASE_PATH | tail -1` -FREE_MB=`df -B1M --output=avail $BASE_PATH | tail -1` +if [ ! -d $BASE_PATH ]; then + error_message "Directory $BASE_PATH does not exists" + exit -1 +fi -MONITOR_DATA=</dev/null | cut -f1` +TOTAL_MB=`df -B1M --output=size $BASE_PATH 2>/dev/null | tail -1` +FREE_MB=`df -B1M --output=avail $BASE_PATH 2>/dev/null | tail -1` + +MONITOR_DATA=$(cat <get(id, true); + + if (ds == 0 ) + { + return; + } + + ds_name = ds->get_name(); + + ds->update_monitor(total, free, used); + + dspool->update(ds); + + ds->unlock(); + + oss << "Datastore " << ds_name << " (" << id << ") successfully monitored."; + + NebulaLog::log("ImM", Log::INFO, oss); + + return; } /* -------------------------------------------------------------------------- */ @@ -612,7 +651,7 @@ void ImageManagerDriver::protocol(const string& message) const int id; oss << "Message received: " << message; - NebulaLog::log("ImG", Log::DEBUG, oss); + NebulaLog::log("ImG", Log::DDEBUG, oss); // --------------------- Parse the driver message --------------------------