diff --git a/include/DispatchManager.h b/include/DispatchManager.h index 595be030ef..9b6e98a9f5 100644 --- a/include/DispatchManager.h +++ b/include/DispatchManager.h @@ -49,7 +49,6 @@ public: UNDEPLOY_SUCCESS, /**< Send by LCM when a VM is undeployed and saved*/ POWEROFF_SUCCESS, /**< Send by LCM when a VM is powered off */ DONE, /**< Send by LCM when a VM is shut down*/ - FAILED, /**< Send by LCM when one of the execution steps fails*/ RESUBMIT, /**< Send by LCM when a VM is ready for resubmission*/ FINALIZE }; @@ -425,8 +424,6 @@ private: void done_action(int vid); - void failed_action(int vid); - void resubmit_action(int vid); }; diff --git a/include/LifeCycleManager.h b/include/LifeCycleManager.h index ad3143bb20..a6a56c37e5 100644 --- a/include/LifeCycleManager.h +++ b/include/LifeCycleManager.h @@ -51,7 +51,6 @@ public: SHUTDOWN_FAILURE, /**< Sent by the VMM when a shutdown action fails */ CANCEL_SUCCESS, /**< Sent by the VMM when a cancel action succeeds */ CANCEL_FAILURE, /**< Sent by the VMM when a cancel action fails */ - MONITOR_FAILURE, /**< Sent by the VMM when a VM has failed while active */ MONITOR_SUSPEND, /**< Sent by the VMM when a VM is paused while active */ MONITOR_DONE, /**< Sent by the VMM when a Host cannot be monitored*/ MONITOR_POWEROFF, /**< Sent by the VMM when a VM is not found */ @@ -193,8 +192,6 @@ private: void cancel_failure_action(int vid); - void monitor_failure_action(int vid); - void monitor_suspend_action(int vid); void monitor_done_action(int vid); @@ -271,8 +268,6 @@ private: void poweroff_action(int vid, bool hard); - void failure_action(VirtualMachine * vm); - void restart_action(int vid); void retry_action(int vid); diff --git a/include/VirtualMachine.h b/include/VirtualMachine.h index e739135059..0e832802f3 100644 --- a/include/VirtualMachine.h +++ b/include/VirtualMachine.h @@ -58,7 +58,7 @@ public: STOPPED = 4, SUSPENDED = 5, DONE = 6, - FAILED = 7, + //FAILED = 7, POWEROFF = 8, UNDEPLOYED = 9 }; @@ -74,7 +74,6 @@ public: else if ( st == "STOPPED" ) { state = STOPPED; } else if ( st == "SUSPENDED" ) { state = SUSPENDED; } else if ( st == "DONE" ) { state = DONE; } - else if ( st == "FAILED" ) { state = FAILED; } else if ( st == "POWEROFF" ) { state = POWEROFF; } else if ( st == "UNDEPLOYED" ) { state = UNDEPLOYED; } else {return -1;} @@ -93,7 +92,6 @@ public: case STOPPED : st = "STOPPED"; break; case SUSPENDED : st = "SUSPENDED"; break; case DONE : st = "DONE"; break; - case FAILED : st = "FAILED"; break; case POWEROFF : st = "POWEROFF"; break; case UNDEPLOYED: st = "UNDEPLOYED"; break; } @@ -120,7 +118,7 @@ public: EPILOG = 11, SHUTDOWN = 12, CANCEL = 13, - FAILURE = 14, + //FAILURE = 14, CLEANUP_RESUBMIT = 15, UNKNOWN = 16, HOTPLUG = 17, @@ -169,7 +167,6 @@ public: else if ( st == "EPILOG") { state = EPILOG; } else if ( st == "SHUTDOWN") { state = SHUTDOWN; } else if ( st == "CANCEL") { state = CANCEL; } - else if ( st == "FAILURE") { state = FAILURE; } else if ( st == "CLEANUP_RESUBMIT") { state = CLEANUP_RESUBMIT; } else if ( st == "UNKNOWN") { state = UNKNOWN; } else if ( st == "HOTPLUG") { state = HOTPLUG; } @@ -221,7 +218,6 @@ public: case EPILOG: st = "EPILOG"; break; case SHUTDOWN: st = "SHUTDOWN"; break; case CANCEL: st = "CANCEL"; break; - case FAILURE: st = "FAILURE"; break; case CLEANUP_RESUBMIT: st = "CLEANUP_RESUBMIT"; break; case UNKNOWN: st = "UNKNOWN"; break; case HOTPLUG: st = "HOTPLUG"; break; diff --git a/share/etc/oned.conf b/share/etc/oned.conf index 5bbe408e7f..d32b5578a8 100644 --- a/share/etc/oned.conf +++ b/share/etc/oned.conf @@ -589,7 +589,6 @@ DATASTORE_MAD = [ # - SHUTDOWN, after the VM is shutdown # - STOP, after the VM is stopped (including VM image transfers) # - DONE, after the VM is deleted or shutdown -# - FAILED, when the VM enters the failed state # - CUSTOM, user defined specific STATE and LCM_STATE combination # of states to trigger the hook. # command : path is relative to $ONE_LOCATION/var/remotes/hook @@ -688,26 +687,6 @@ HM_MAD = [ # arguments = "$ID -m -p 5", # remote = "no" ] #------------------------------------------------------------------------------- -# These two hooks can be used to automatically delete or resubmit VMs that reach -# the "failed" state. This way, the administrator doesn't have to interact -# manually to release its resources or retry the deployment. -# -# -# Only one of them should be uncommented. -#------------------------------------------------------------------------------- -# -#VM_HOOK = [ -# name = "on_failure_delete", -# on = "FAILED", -# command = "/usr/bin/env onevm delete", -# arguments = "$ID" ] -# -#VM_HOOK = [ -# name = "on_failure_recreate", -# on = "FAILED", -# command = "/usr/bin/env onevm delete --recreate", -# arguments = "$ID" ] -#------------------------------------------------------------------------------- #******************************************************************************* # Auth Manager Configuration diff --git a/src/dm/DispatchManager.cc b/src/dm/DispatchManager.cc index bf8e4ca602..a96761bae1 100644 --- a/src/dm/DispatchManager.cc +++ b/src/dm/DispatchManager.cc @@ -89,10 +89,6 @@ void DispatchManager::trigger(Actions action, int _vid) aname = "DONE"; break; - case FAILED: - aname = "FAILED"; - break; - case RESUBMIT: aname = "RESUBMIT"; break; @@ -146,10 +142,6 @@ void DispatchManager::do_action(const string &action, void * arg) { done_action(vid); } - else if (action == "FAILED") - { - failed_action(vid); - } else if (action == "RESUBMIT") { resubmit_action(vid); diff --git a/src/dm/DispatchManagerActions.cc b/src/dm/DispatchManagerActions.cc index b19f2a4ea6..afbd626347 100644 --- a/src/dm/DispatchManagerActions.cc +++ b/src/dm/DispatchManagerActions.cc @@ -930,11 +930,6 @@ int DispatchManager::finalize( finalize_cleanup(vm); break; - case VirtualMachine::FAILED: - tm->trigger(TransferManager::EPILOG_DELETE,vid); - finalize_cleanup(vm); - break; - case VirtualMachine::STOPPED: case VirtualMachine::UNDEPLOYED: tm->trigger(TransferManager::EPILOG_DELETE_STOP,vid); @@ -971,7 +966,6 @@ int DispatchManager::resubmit(int vid) Nebula& nd = Nebula::instance(); LifeCycleManager * lcm = nd.get_lcm(); - TransferManager * tm = nd.get_tm(); vm = vmpool->get(vid,true); @@ -998,17 +992,6 @@ int DispatchManager::resubmit(int vid) case VirtualMachine::PENDING: break; - case VirtualMachine::FAILED: //Cleanup VM host files - vm->log("DiM", Log::INFO, "New VM state is CLEANUP."); - - vm->set_state(VirtualMachine::CLEANUP_RESUBMIT); - vm->set_state(VirtualMachine::ACTIVE); - - vmpool->update(vm); - - tm->trigger(TransferManager::EPILOG_DELETE,vid); - break; - case VirtualMachine::HOLD: // Move the VM to PENDING in any of these case VirtualMachine::STOPPED: case VirtualMachine::UNDEPLOYED: diff --git a/src/dm/DispatchManagerStates.cc b/src/dm/DispatchManagerStates.cc index f9b5451169..818c95640a 100644 --- a/src/dm/DispatchManagerStates.cc +++ b/src/dm/DispatchManagerStates.cc @@ -261,39 +261,6 @@ void DispatchManager::done_action(int vid) /* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */ -void DispatchManager::failed_action(int vid) -{ - VirtualMachine * vm; - - vm = vmpool->get(vid,true); - - if ( vm == 0 ) - { - return; - } - - if (vm->get_lcm_state() == VirtualMachine::FAILURE) - { - - vm->set_state(VirtualMachine::LCM_INIT); - - vm->set_state(VirtualMachine::FAILED); - - vm->set_exit_time(time(0)); - - vmpool->update(vm); - - vm->log("DiM", Log::INFO, "New VM state is FAILED"); - - vm->unlock(); - } - - return; -} - -/* -------------------------------------------------------------------------- */ -/* -------------------------------------------------------------------------- */ - void DispatchManager::resubmit_action(int vid) { VirtualMachine * vm; diff --git a/src/lcm/LifeCycleActions.cc b/src/lcm/LifeCycleActions.cc index 9df6e2013a..1d1fe7b5df 100644 --- a/src/lcm/LifeCycleActions.cc +++ b/src/lcm/LifeCycleActions.cc @@ -31,8 +31,8 @@ void LifeCycleManager::deploy_action(int vid) if ( vm->get_state() == VirtualMachine::ACTIVE ) { - time_t thetime = time(0); - int cpu,mem,disk; + time_t thetime = time(0); + int cpu,mem,disk; Nebula& nd = Nebula::instance(); TransferManager * tm = nd.get_tm(); @@ -46,37 +46,6 @@ void LifeCycleManager::deploy_action(int vid) vm->get_requirements(cpu,mem,disk); - if (hpool->add_capacity(vm->get_hid(),vm->get_oid(),cpu,mem,disk) == -1) - { - //The host has been deleted, move VM to FAILURE - - vm->log("LCM", Log::ERROR, "deploy_action, Host has been removed."); - - vm->set_state(VirtualMachine::FAILURE); - - vm->set_resched(false); - - map empty; - vm->update_info(0, 0, -1, -1, empty); - - vmpool->update(vm); - - vm->set_stime(thetime); - vm->set_etime(thetime); - - vm->set_vm_info(); - - vm->set_reason(History::ERROR); - - vmpool->update_history(vm); - - vm->unlock(); - - nd.get_dm()->trigger(DispatchManager::FAILED, vid); - - return; - } - vm_state = VirtualMachine::PROLOG; tm_action = TransferManager::PROLOG; @@ -109,7 +78,15 @@ void LifeCycleManager::deploy_action(int vid) //---------------------------------------------------- - tm->trigger(tm_action,vid); + if (hpool->add_capacity(vm->get_hid(),vm->get_oid(),cpu,mem,disk) == -1) + { + //The host has been deleted, move VM to FAILURE + this->trigger(LifeCycleManager::PROLOG_FAILURE, vid); + } + else + { + tm->trigger(tm_action, vid); + } } else { @@ -791,7 +768,6 @@ void LifeCycleManager::retry_action(int vid) case VirtualMachine::EPILOG: case VirtualMachine::EPILOG_STOP: case VirtualMachine::EPILOG_UNDEPLOY: - case VirtualMachine::FAILURE: case VirtualMachine::HOTPLUG: case VirtualMachine::HOTPLUG_NIC: case VirtualMachine::HOTPLUG_SNAPSHOT: @@ -934,7 +910,6 @@ void LifeCycleManager::delete_action(int vid) Nebula& nd = Nebula::instance(); DispatchManager * dm = nd.get_dm(); - TransferManager * tm = nd.get_tm(); int image_id = -1; @@ -957,18 +932,10 @@ void LifeCycleManager::delete_action(int vid) switch(vm->get_lcm_state()) { case VirtualMachine::CLEANUP_RESUBMIT: + vm->set_state(VirtualMachine::CLEANUP_DELETE); + vmpool->update(vm); + case VirtualMachine::CLEANUP_DELETE: - vm->set_state(VirtualMachine::CLEANUP_DELETE); - vmpool->update(vm); - - dm->trigger(DispatchManager::DONE, vid); - break; - - case VirtualMachine::FAILURE: - vm->set_state(VirtualMachine::CLEANUP_DELETE); - vmpool->update(vm); - - tm->trigger(TransferManager::EPILOG_DELETE,vid); dm->trigger(DispatchManager::DONE, vid); break; @@ -1005,7 +972,6 @@ void LifeCycleManager::clean_action(int vid) Nebula& nd = Nebula::instance(); DispatchManager * dm = nd.get_dm(); - TransferManager * tm = nd.get_tm(); int image_id = -1; @@ -1034,13 +1000,6 @@ void LifeCycleManager::clean_action(int vid) dm->trigger(DispatchManager::RESUBMIT, vid); break; - case VirtualMachine::FAILURE: - vm->set_state(VirtualMachine::CLEANUP_RESUBMIT); - vmpool->update(vm); - - tm->trigger(TransferManager::EPILOG_DELETE,vid); - break; - default: clean_up_vm(vm, false, image_id); break; @@ -1253,7 +1212,6 @@ void LifeCycleManager::clean_up_vm(VirtualMachine * vm, bool dispose, int& imag case VirtualMachine::LCM_INIT: case VirtualMachine::CLEANUP_RESUBMIT: case VirtualMachine::CLEANUP_DELETE: - case VirtualMachine::FAILURE: break; } } @@ -1290,10 +1248,6 @@ void LifeCycleManager::recover(VirtualMachine * vm, bool success) vmpool->update(vm); return; - case VirtualMachine::FAILURE: - dm->trigger(DispatchManager::FAILED,vm->get_oid()); - return; - //---------------------------------------------------------------------- // Recover through re-triggering LCM events //---------------------------------------------------------------------- diff --git a/src/lcm/LifeCycleManager.cc b/src/lcm/LifeCycleManager.cc index 3247b09c97..a5486d7d00 100644 --- a/src/lcm/LifeCycleManager.cc +++ b/src/lcm/LifeCycleManager.cc @@ -101,10 +101,6 @@ void LifeCycleManager::trigger(Actions action, int _vid) aname = "CANCEL_FAILURE"; break; - case MONITOR_FAILURE: - aname = "MONITOR_FAILURE"; - break; - case MONITOR_SUSPEND: aname = "MONITOR_SUSPEND"; break; @@ -330,10 +326,6 @@ void LifeCycleManager::do_action(const string &action, void * arg) { cancel_failure_action(vid); } - else if (action == "MONITOR_FAILURE") - { - monitor_failure_action(vid); - } else if (action == "MONITOR_SUSPEND") { monitor_suspend_action(vid); diff --git a/src/lcm/LifeCycleStates.cc b/src/lcm/LifeCycleStates.cc index 03243ba0ba..b2a12fb7db 100644 --- a/src/lcm/LifeCycleStates.cc +++ b/src/lcm/LifeCycleStates.cc @@ -1229,37 +1229,6 @@ void LifeCycleManager::cancel_failure_action(int vid) /* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */ -void LifeCycleManager::monitor_failure_action(int vid) -{ - VirtualMachine * vm; - - time_t the_time = time(0); - - vm = vmpool->get(vid,true); - - if ( vm == 0 ) - { - return; - } - - if ( vm->get_lcm_state() == VirtualMachine::RUNNING || - vm->get_lcm_state() == VirtualMachine::UNKNOWN ) - { - vm->set_running_etime(the_time); - - failure_action(vm); - } - else - { - vm->log("LCM",Log::ERROR,"monitor_failure_action, VM in a wrong state"); - } - - vm->unlock(); -} - -/* -------------------------------------------------------------------------- */ -/* -------------------------------------------------------------------------- */ - void LifeCycleManager::monitor_suspend_action(int vid) { VirtualMachine * vm; @@ -1451,49 +1420,6 @@ void LifeCycleManager::monitor_poweron_action(int vid) /* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */ -void LifeCycleManager::failure_action(VirtualMachine * vm) -{ - Nebula& nd = Nebula::instance(); - DispatchManager * dm = nd.get_dm(); - - time_t the_time = time(0); - int cpu,mem,disk; - - //---------------------------------------------------- - // LCM FAILURE STATE - //---------------------------------------------------- - - vm->set_state(VirtualMachine::FAILURE); - - vm->set_resched(false); - - vm->delete_snapshots(); - - map empty; - vm->update_info(0, 0, -1, -1, empty); - - vmpool->update(vm); - - vm->set_etime(the_time); - - vm->set_vm_info(); - - vm->set_reason(History::ERROR); - - vmpool->update_history(vm); - - vm->get_requirements(cpu,mem,disk); - - hpool->del_capacity(vm->get_hid(), vm->get_oid(), cpu, mem, disk); - - //--- VM to FAILED. Remote host cleanup upon VM deletion --- - - dm->trigger(DispatchManager::FAILED,vm->get_oid()); -} - -/* -------------------------------------------------------------------------- */ -/* -------------------------------------------------------------------------- */ - void LifeCycleManager::attach_success_action(int vid) { VirtualMachine * vm; diff --git a/src/rm/RequestManagerPoolInfoFilter.cc b/src/rm/RequestManagerPoolInfoFilter.cc index e94be8e39d..d42df81cd0 100644 --- a/src/rm/RequestManagerPoolInfoFilter.cc +++ b/src/rm/RequestManagerPoolInfoFilter.cc @@ -96,7 +96,7 @@ void VirtualMachinePoolInfo::request_execute( ostringstream state_filter; if (( state < VirtualMachinePoolInfo::ALL_VM ) || - ( state > VirtualMachine::FAILED )) + ( state > VirtualMachine::UNDEPLOYED )) { failure_response(XML_RPC_API, request_error("Incorrect filter_flag, state",""), diff --git a/src/rm/RequestManagerVirtualMachine.cc b/src/rm/RequestManagerVirtualMachine.cc index 6133069f75..477aaf8085 100644 --- a/src/rm/RequestManagerVirtualMachine.cc +++ b/src/rm/RequestManagerVirtualMachine.cc @@ -1812,7 +1812,6 @@ void VirtualMachineResize::request_execute(xmlrpc_c::paramList const& paramList, case VirtualMachine::INIT: case VirtualMachine::PENDING: case VirtualMachine::HOLD: - case VirtualMachine::FAILED: case VirtualMachine::UNDEPLOYED: break; @@ -1931,7 +1930,6 @@ void VirtualMachineResize::request_execute(xmlrpc_c::paramList const& paramList, case VirtualMachine::INIT: case VirtualMachine::PENDING: case VirtualMachine::HOLD: - case VirtualMachine::FAILED: case VirtualMachine::POWEROFF: case VirtualMachine::UNDEPLOYED: ret = vm->resize(ncpu, nmemory, nvcpu, error_str); diff --git a/src/tm/TransferManagerDriver.cc b/src/tm/TransferManagerDriver.cc index be08803486..1a5d8f8dc9 100644 --- a/src/tm/TransferManagerDriver.cc +++ b/src/tm/TransferManagerDriver.cc @@ -95,8 +95,7 @@ void TransferManagerDriver::protocol(const string& message) const return; } - if ( vm->get_lcm_state() == VirtualMachine::FAILURE || - vm->get_lcm_state() == VirtualMachine::LCM_INIT ) + if ( vm->get_lcm_state() == VirtualMachine::LCM_INIT ) { os.str(""); os << "Ignored: " << message; diff --git a/src/vm/VirtualMachine.cc b/src/vm/VirtualMachine.cc index ef41a13855..a3da1187f2 100644 --- a/src/vm/VirtualMachine.cc +++ b/src/vm/VirtualMachine.cc @@ -2496,9 +2496,10 @@ void VirtualMachine::release_disk_images() { int iid; int save_as_id; - int rc; int num_disks; + bool img_error; + vector disks; ImageManager * imagem; @@ -2519,18 +2520,16 @@ void VirtualMachine::release_disk_images() continue; } - rc = disk->vector_value("IMAGE_ID", iid); + img_error = state != ACTIVE || lcm_state != EPILOG; - if ( rc == 0 ) + if ( disk->vector_value("IMAGE_ID", iid) == 0 ) { - imagem->release_image(oid, iid, (state == FAILED)); + imagem->release_image(oid, iid, img_error); } - rc = disk->vector_value("SAVE_AS", save_as_id); - - if ( rc == 0 ) + if ( disk->vector_value("SAVE_AS", save_as_id) == 0 ) { - imagem->release_image(oid, save_as_id, (state != ACTIVE || lcm_state != EPILOG)); + imagem->release_image(oid, save_as_id, img_error); } } } diff --git a/src/vm/VirtualMachinePool.cc b/src/vm/VirtualMachinePool.cc index fd57083ce8..a7af29e4c1 100644 --- a/src/vm/VirtualMachinePool.cc +++ b/src/vm/VirtualMachinePool.cc @@ -165,14 +165,6 @@ VirtualMachinePool::VirtualMachinePool( VirtualMachine::LCM_INIT, VirtualMachine::DONE); add_hook(hook); } - else if ( on == "FAILED" ) - { - VirtualMachineStateHook * hook; - - hook = new VirtualMachineStateHook(name, cmd, arg, remote, - VirtualMachine::LCM_INIT, VirtualMachine::FAILED); - add_hook(hook); - } else if ( on == "UNKNOWN" ) { VirtualMachineStateHook * hook; diff --git a/src/vmm/VirtualMachineManagerDriver.cc b/src/vmm/VirtualMachineManagerDriver.cc index 5dbbfe94c2..187e73e95b 100644 --- a/src/vmm/VirtualMachineManagerDriver.cc +++ b/src/vmm/VirtualMachineManagerDriver.cc @@ -234,8 +234,7 @@ void VirtualMachineManagerDriver::protocol(const string& message) const return; } - if ( vm->get_lcm_state() == VirtualMachine::FAILURE || - vm->get_lcm_state() == VirtualMachine::LCM_INIT ) + if ( vm->get_lcm_state() == VirtualMachine::LCM_INIT ) { os.str(""); os << "Ignored: " << message; @@ -695,7 +694,7 @@ void VirtualMachineManagerDriver::process_poll( case 'e': //Failed vm->log("VMM",Log::INFO,"VM running but monitor state is ERROR."); - lcm->trigger(LifeCycleManager::MONITOR_FAILURE, vm->get_oid()); + lcm->trigger(LifeCycleManager::MONITOR_DONE, vm->get_oid()); break; case 'd': //The VM was powered-off