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

Feature #3737: Clear VM sched message when the VM is deployed

This commit is contained in:
Carlos Martín 2015-04-22 17:07:40 +02:00
parent e8c90520d4
commit 410286fc17
3 changed files with 38 additions and 0 deletions

View File

@ -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:
/**

View File

@ -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)

View File

@ -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);