diff --git a/src/scheduler/include/VirtualMachineXML.h b/src/scheduler/include/VirtualMachineXML.h index ac805c479f..bec5b0caf4 100644 --- a/src/scheduler/include/VirtualMachineXML.h +++ b/src/scheduler/include/VirtualMachineXML.h @@ -289,6 +289,13 @@ public: */ void log(const string &st); + /** + * Clears the VM's USER_TEMPLATE/SCHED_MESSAGE attribute + * @return true if the template was modified, false if SCHED_MESSAGE did not + * need to be deleted + */ + bool clear_log(); + protected: /** diff --git a/src/scheduler/src/pool/VirtualMachinePoolXML.cc b/src/scheduler/src/pool/VirtualMachinePoolXML.cc index 083f5757f3..72b5415ced 100644 --- a/src/scheduler/src/pool/VirtualMachinePoolXML.cc +++ b/src/scheduler/src/pool/VirtualMachinePoolXML.cc @@ -130,6 +130,13 @@ int VirtualMachinePoolXML::dispatch(int vid, int hid, int dsid, bool resched) co { xmlrpc_c::value deploy_result; + VirtualMachineXML* vm = get(vid); + + if (vm != 0 && vm->clear_log()) + { + update(vm); + } + try { if (resched == true) diff --git a/src/scheduler/src/pool/VirtualMachineXML.cc b/src/scheduler/src/pool/VirtualMachineXML.cc index 3c4518e31b..4d80a8725e 100644 --- a/src/scheduler/src/pool/VirtualMachineXML.cc +++ b/src/scheduler/src/pool/VirtualMachineXML.cc @@ -399,6 +399,30 @@ void VirtualMachineXML::log(const string &st) /* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */ +bool VirtualMachineXML::clear_log() +{ + string st; + + if (user_template == 0) + { + return false; + } + + user_template->get("SCHED_MESSAGE", st); + + if (st.empty()) + { + return false; + } + + user_template->erase("SCHED_MESSAGE"); + + return true; +} + +/* -------------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------- */ + int VirtualMachineXML::parse_action_name(string& action_st) { one_util::tolower(action_st);