mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-11 05:17:41 +03:00
feature #1099: VM info is set in history records in a separate function
This commit is contained in:
parent
1c4fca1ce2
commit
de3cd97468
@ -428,15 +428,28 @@ public:
|
||||
history->stime=_stime;
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets VM info (with monitoring info) in the history record
|
||||
*/
|
||||
void set_vm_info()
|
||||
{
|
||||
obj_template->to_xml(history->vm_info);
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets VM info (with monitoring info) in the previous history record
|
||||
*/
|
||||
void set_previous_vm_info()
|
||||
{
|
||||
obj_template->to_xml(previous_history->vm_info);
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets end time of a VM.
|
||||
* @param _etime time when the VM finished
|
||||
*/
|
||||
void set_etime(time_t _etime)
|
||||
{
|
||||
string xml;
|
||||
history->vm_info = obj_template->to_xml(xml);
|
||||
|
||||
history->etime=_etime;
|
||||
};
|
||||
|
||||
@ -446,9 +459,6 @@ public:
|
||||
*/
|
||||
void set_previous_etime(time_t _etime)
|
||||
{
|
||||
string xml;
|
||||
previous_history->vm_info = obj_template->to_xml(xml);
|
||||
|
||||
previous_history->etime=_etime;
|
||||
};
|
||||
|
||||
|
@ -615,6 +615,7 @@ void LifeCycleManager::clean_up_vm(VirtualMachine * vm)
|
||||
vmpool->update(vm);
|
||||
|
||||
vm->set_etime(the_time);
|
||||
vm->set_vm_info();
|
||||
vm->set_reason(History::USER);
|
||||
|
||||
vm->get_requirements(cpu,mem,disk);
|
||||
@ -650,6 +651,7 @@ void LifeCycleManager::clean_up_vm(VirtualMachine * vm)
|
||||
vmpool->update_history(vm);
|
||||
|
||||
vm->set_previous_etime(the_time);
|
||||
vm->set_previous_vm_info();
|
||||
vm->set_previous_running_etime(the_time);
|
||||
vm->set_previous_reason(History::USER);
|
||||
vmpool->update_previous_history(vm);
|
||||
@ -680,6 +682,7 @@ void LifeCycleManager::clean_up_vm(VirtualMachine * vm)
|
||||
vmpool->update_history(vm);
|
||||
|
||||
vm->set_previous_etime(the_time);
|
||||
vm->set_previous_vm_info();
|
||||
vm->set_previous_running_etime(the_time);
|
||||
vm->set_previous_reason(History::USER);
|
||||
vmpool->update_previous_history(vm);
|
||||
|
@ -49,6 +49,8 @@ void LifeCycleManager::save_success_action(int vid)
|
||||
|
||||
vm->set_previous_etime(the_time);
|
||||
|
||||
vm->set_previous_vm_info();
|
||||
|
||||
vm->set_previous_running_etime(the_time);
|
||||
|
||||
vm->set_previous_reason(History::USER);
|
||||
@ -84,6 +86,8 @@ void LifeCycleManager::save_success_action(int vid)
|
||||
|
||||
vm->set_etime(the_time);
|
||||
|
||||
vm->set_vm_info();
|
||||
|
||||
vm->set_reason(History::STOP_RESUME);
|
||||
|
||||
vmpool->update_history(vm);
|
||||
@ -162,6 +166,8 @@ void LifeCycleManager::save_failure_action(int vid)
|
||||
|
||||
vm->set_etime(the_time);
|
||||
|
||||
vm->set_vm_info();
|
||||
|
||||
vm->set_reason(History::ERROR);
|
||||
|
||||
vmpool->update_history(vm);
|
||||
@ -172,6 +178,8 @@ void LifeCycleManager::save_failure_action(int vid)
|
||||
|
||||
vm->set_previous_etime(the_time);
|
||||
|
||||
vm->set_previous_vm_info();
|
||||
|
||||
vm->set_previous_running_etime(the_time);
|
||||
|
||||
vm->set_previous_reason(History::USER);
|
||||
@ -251,6 +259,8 @@ void LifeCycleManager::deploy_success_action(int vid)
|
||||
|
||||
vm->set_previous_etime(the_time);
|
||||
|
||||
vm->set_previous_vm_info();
|
||||
|
||||
vm->set_previous_running_etime(the_time);
|
||||
|
||||
vm->set_previous_reason(History::USER);
|
||||
@ -304,10 +314,14 @@ void LifeCycleManager::deploy_failure_action(int vid)
|
||||
|
||||
vm->set_etime(the_time);
|
||||
|
||||
vm->set_vm_info();
|
||||
|
||||
vm->set_reason(History::ERROR);
|
||||
|
||||
vm->set_previous_etime(the_time);
|
||||
|
||||
vm->set_previous_vm_info();
|
||||
|
||||
vm->set_previous_running_etime(the_time);
|
||||
|
||||
vm->set_previous_reason(History::USER);
|
||||
@ -554,6 +568,8 @@ void LifeCycleManager::epilog_success_action(int vid)
|
||||
|
||||
vm->set_etime(the_time);
|
||||
|
||||
vm->set_vm_info();
|
||||
|
||||
vmpool->update_history(vm);
|
||||
|
||||
vm->get_requirements(cpu,mem,disk);
|
||||
@ -727,6 +743,8 @@ void LifeCycleManager::monitor_suspend_action(int vid)
|
||||
|
||||
vm->set_etime(the_time);
|
||||
|
||||
vm->set_vm_info();
|
||||
|
||||
vm->set_reason(History::STOP_RESUME);
|
||||
|
||||
vmpool->update_history(vm);
|
||||
@ -799,6 +817,8 @@ void LifeCycleManager::failure_action(VirtualMachine * vm)
|
||||
|
||||
vm->set_etime(the_time);
|
||||
|
||||
vm->set_vm_info();
|
||||
|
||||
vm->set_reason(History::ERROR);
|
||||
|
||||
vmpool->update_history(vm);
|
||||
|
Loading…
Reference in New Issue
Block a user