mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-09 14:03:20 +09:00
Feature #1224: Delete the snapshot attributes when the VMs leave the RUNNING state
This commit is contained in:
1 parent
1177d1fb6d
commit
ac87bd785c
4 files changed
+38
No files matched your search
@@ -974,6 +974,11 @@ public:
|
||||
*/
|
||||
void delete_active_snapshot();
|
||||
|
||||
/**
|
||||
* Deletes all SNAPSHOT attributes
|
||||
*/
|
||||
void delete_snapshots();
|
||||
|
||||
private:
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@@ -704,6 +704,9 @@ void LifeCycleManager::clean_up_vm(VirtualMachine * vm, bool dispose)
|
||||
}
|
||||
|
||||
vm->set_resched(false);
|
||||
|
||||
vm->delete_snapshots();
|
||||
|
||||
vmpool->update(vm);
|
||||
|
||||
vm->set_etime(the_time);
|
||||
|
||||
@@ -45,6 +45,8 @@ void LifeCycleManager::save_success_action(int vid)
|
||||
|
||||
vm->set_state(VirtualMachine::PROLOG_MIGRATE);
|
||||
|
||||
vm->delete_snapshots();
|
||||
|
||||
vmpool->update(vm);
|
||||
|
||||
vm->set_previous_etime(the_time);
|
||||
@@ -81,6 +83,10 @@ void LifeCycleManager::save_success_action(int vid)
|
||||
// SUSPENDED STATE
|
||||
//----------------------------------------------------
|
||||
|
||||
vm->delete_snapshots();
|
||||
|
||||
vmpool->update(vm);
|
||||
|
||||
vm->set_running_etime(the_time);
|
||||
|
||||
vm->set_etime(the_time);
|
||||
@@ -107,6 +113,8 @@ void LifeCycleManager::save_success_action(int vid)
|
||||
|
||||
vm->set_state(VirtualMachine::EPILOG_STOP);
|
||||
|
||||
vm->delete_snapshots();
|
||||
|
||||
vmpool->update(vm);
|
||||
|
||||
vm->set_epilog_stime(the_time);
|
||||
@@ -272,6 +280,8 @@ void LifeCycleManager::deploy_success_action(int vid)
|
||||
|
||||
vm->set_state(VirtualMachine::RUNNING);
|
||||
|
||||
vm->delete_snapshots();
|
||||
|
||||
vmpool->update(vm);
|
||||
|
||||
vm->log("LCM", Log::INFO, "New VM state is RUNNING");
|
||||
@@ -464,6 +474,8 @@ void LifeCycleManager::shutdown_success_action(int vid)
|
||||
|
||||
vm->set_state(VirtualMachine::EPILOG);
|
||||
|
||||
vm->delete_snapshots();
|
||||
|
||||
vmpool->update(vm);
|
||||
|
||||
vm->set_epilog_stime(the_time);
|
||||
@@ -484,6 +496,10 @@ void LifeCycleManager::shutdown_success_action(int vid)
|
||||
// POWEROFF STATE
|
||||
//----------------------------------------------------
|
||||
|
||||
vm->delete_snapshots();
|
||||
|
||||
vmpool->update(vm);
|
||||
|
||||
vm->set_running_etime(the_time);
|
||||
|
||||
vm->set_etime(the_time);
|
||||
@@ -859,6 +875,8 @@ void LifeCycleManager::cancel_success_action(int vid)
|
||||
|
||||
vm->set_state(VirtualMachine::EPILOG);
|
||||
|
||||
vm->delete_snapshots();
|
||||
|
||||
vmpool->update(vm);
|
||||
|
||||
vm->set_reason(History::CANCEL);
|
||||
@@ -987,6 +1005,8 @@ void LifeCycleManager::monitor_suspend_action(int vid)
|
||||
|
||||
vm->set_resched(false);
|
||||
|
||||
vm->delete_snapshots();
|
||||
|
||||
vmpool->update(vm);
|
||||
|
||||
vm->set_running_etime(the_time);
|
||||
@@ -1073,6 +1093,8 @@ void LifeCycleManager::failure_action(VirtualMachine * vm)
|
||||
|
||||
vm->set_resched(false);
|
||||
|
||||
vm->delete_snapshots();
|
||||
|
||||
vmpool->update(vm);
|
||||
|
||||
vm->set_etime(the_time);
|
||||
|
||||
@@ -1997,6 +1997,14 @@ void VirtualMachine::delete_active_snapshot()
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void VirtualMachine::delete_snapshots()
|
||||
{
|
||||
obj_template->erase("SNAPSHOT");
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int VirtualMachine::get_network_leases(string& estr)
|
||||
{
|
||||
int num_nics, rc;
|
||||
|
||||
Reference in new issue
Block a user