1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-22 13:33:52 +03:00

Bug #668: Change the LCM, the cancel action executes the epilog on success

This commit is contained in:
Carlos Martín 2011-09-12 18:12:36 +02:00
parent 6fd04f1a4e
commit 5b67dd2ebb
4 changed files with 20 additions and 16 deletions

View File

@ -23,7 +23,7 @@ digraph OpenNebula {
subgraph { rank = same; prolog; prolog_resume; prolog_migrate;
color="white" }
subgraph { rank = max; suspended; done; cancel; failure;
subgraph { rank = max; suspended; done; failure;
stopped;color="white" }
# create
@ -64,7 +64,7 @@ digraph OpenNebula {
# cancel
running -> cancel [label="cancel"];
cancel -> done [style="dashed"];
cancel -> epilog [style="dashed"];
# suspend
running -> save_suspend [label="suspend"];

View File

@ -34,8 +34,8 @@ digraph OpenNebula {
# shutdown
running -> shutdown [label="shutdown"];
shutdown -> epilog [label="shutdown", style="dashed"];
epilog -> done [label="shutdown", style="dashed"];
shutdown -> epilog [style="dashed"];
epilog -> done [style="dashed"];
# livemigrate
running -> migrate [label="livemigrate"];
@ -59,7 +59,6 @@ digraph OpenNebula {
# cancel
running -> shutdown [label="cancel"];
shutdown -> done [label="cancel", style="dashed"];
# suspend
running -> save [label="suspend"];

View File

@ -598,12 +598,10 @@ void LifeCycleManager::epilog_failure_action(int vid)
void LifeCycleManager::cancel_success_action(int vid)
{
Nebula& nd = Nebula::instance();
TransferManager * tm = nd.get_tm();
VirtualMachine * vm;
time_t the_time = time(0);
int cpu,mem,disk;
Nebula& nd = Nebula::instance();
DispatchManager * dm = nd.get_dm();
vm = vmpool->get(vid,true);
@ -612,20 +610,27 @@ void LifeCycleManager::cancel_success_action(int vid)
return;
}
vm->set_running_etime(the_time);
vm->set_etime(the_time);
//----------------------------------------------------
// EPILOG STATE
//----------------------------------------------------
vm->set_state(VirtualMachine::EPILOG);
vmpool->update(vm);
vm->set_reason(History::CANCEL);
vm->set_epilog_stime(the_time);
vm->set_running_etime(the_time);
vmpool->update_history(vm);
vm->get_requirements(cpu,mem,disk);
hpool->del_capacity(vm->get_hid(),cpu,mem,disk);
vm->log("LCM", Log::INFO, "New VM state is EPILOG");
//----------------------------------------------------
dm->trigger(DispatchManager::DONE,vid);
tm->trigger(TransferManager::EPILOG,vid);
vm->unlock();
}

View File

@ -714,7 +714,7 @@ public:
dm->cancel(vm->get_oid());
wait_assert(vm, VirtualMachine::DONE);
wait_assert(vm, VirtualMachine::ACTIVE, VirtualMachine::EPILOG );
}
/* -------------------------------------------------------------------------- */