diff --git a/include/Mad.h b/include/Mad.h index 70ae7ffe21..3c783fa682 100644 --- a/include/Mad.h +++ b/include/Mad.h @@ -26,6 +26,8 @@ #include +#include "Log.h" + using namespace std; /** @@ -89,6 +91,32 @@ protected: write(os); }; + /** + * Sets the log message type as specify by the driver. + * @param first character of the type string + * @return the message type + */ + Log::MessageType log_type(const char r) + { + Log::MessageType lt; + + switch (r) + { + case 'E': + lt = Log::ERROR; + break; + case 'I': + lt = Log::INFO; + break; + case 'D': + lt = Log::DEBUG; + break; + default: + lt = Log::INFO; + } + + return lt; + } private: friend class MadManager; @@ -141,7 +169,7 @@ private: * @return 0 on success */ int reload(); - + /** * Implements the driver specific protocol, this function should trigger * actions on the associated manager. diff --git a/src/tm/TransferManagerDriver.cc b/src/tm/TransferManagerDriver.cc index 86dd932759..6cefa4f9ae 100644 --- a/src/tm/TransferManagerDriver.cc +++ b/src/tm/TransferManagerDriver.cc @@ -79,7 +79,7 @@ void TransferManagerDriver::protocol( is.clear(); getline(is,info); - NebulaLog::log("TM",Log::INFO, info.c_str()); + NebulaLog::log("TM",log_type(result[0]), info.c_str()); } return; @@ -142,8 +142,14 @@ void TransferManagerDriver::protocol( getline(is,info); os.str(""); - os << "Error excuting image transfer script: " << info; - + os << "Error excuting image transfer script"; + + if (info[0] != '-') + { + os << ": " << info; + vm->set_error_message(os.str()); + } + vm->log("TM",Log::ERROR,os); switch (vm->get_lcm_state()) @@ -171,7 +177,7 @@ void TransferManagerDriver::protocol( string info; getline(is,info); - vm->log("TM",Log::INFO,info.c_str()); + vm->log("TM",log_type(result[0]),info.c_str()); } vm->unlock(); diff --git a/src/vmm/VirtualMachineManagerDriver.cc b/src/vmm/VirtualMachineManagerDriver.cc index cb7d2707d2..38f5e489bc 100644 --- a/src/vmm/VirtualMachineManagerDriver.cc +++ b/src/vmm/VirtualMachineManagerDriver.cc @@ -252,28 +252,6 @@ static void log_error(VirtualMachine* vm, vm->log("VMM",Log::ERROR,os); } -static Log::MessageType log_type(const char r) -{ - Log::MessageType lt; - - switch (r) - { - case 'E': - lt = Log::ERROR; - break; - case 'I': - lt = Log::INFO; - break; - case 'D': - lt = Log::DEBUG; - break; - default: - lt = Log::INFO; - } - - return lt; -} - /* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */