diff --git a/include/VirtualMachine.h b/include/VirtualMachine.h index f3fcb49e48..07126a33f1 100644 --- a/include/VirtualMachine.h +++ b/include/VirtualMachine.h @@ -974,6 +974,11 @@ public: */ void delete_active_snapshot(); + /** + * Deletes all SNAPSHOT attributes + */ + void delete_snapshots(); + private: // ------------------------------------------------------------------------- diff --git a/src/lcm/LifeCycleActions.cc b/src/lcm/LifeCycleActions.cc index d0827f8491..39d5f70524 100644 --- a/src/lcm/LifeCycleActions.cc +++ b/src/lcm/LifeCycleActions.cc @@ -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); diff --git a/src/lcm/LifeCycleStates.cc b/src/lcm/LifeCycleStates.cc index f447f29fa1..4d013ea5db 100644 --- a/src/lcm/LifeCycleStates.cc +++ b/src/lcm/LifeCycleStates.cc @@ -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); diff --git a/src/vm/VirtualMachine.cc b/src/vm/VirtualMachine.cc index fca51ff6e1..81cbb459cb 100644 --- a/src/vm/VirtualMachine.cc +++ b/src/vm/VirtualMachine.cc @@ -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;