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

Merge branch 'feature-3654b'

This commit is contained in:
Ruben S. Montero 2015-04-21 14:34:13 +02:00
commit e1a4a633a1
16 changed files with 27 additions and 259 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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<string, string> 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
//----------------------------------------------------------------------

View File

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

View File

@ -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<string, string> 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;

View File

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

View File

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

View File

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

View File

@ -2496,9 +2496,10 @@ void VirtualMachine::release_disk_images()
{
int iid;
int save_as_id;
int rc;
int num_disks;
bool img_error;
vector<Attribute const * > 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);
}
}
}

View File

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

View File

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