mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-11 05:17:41 +03:00
Feature #1639: Allow a VM to be migrated from the unknown state
(cherry picked from commit 9ace10e010e74f61b139c96d60b5482cb68cae1e) (cherry picked from commit 78ea7034a3280a3411efdc64b00dcccb357cdc3e)
This commit is contained in:
parent
b39548283c
commit
e9308b7539
@ -91,7 +91,8 @@ int DispatchManager::migrate(
|
||||
NebulaLog::log("DiM",Log::DEBUG,oss);
|
||||
|
||||
if (vm->get_state() == VirtualMachine::ACTIVE &&
|
||||
vm->get_lcm_state() == VirtualMachine::RUNNING )
|
||||
(vm->get_lcm_state() == VirtualMachine::RUNNING ||
|
||||
vm->get_lcm_state() == VirtualMachine::UNKNOWN ) )
|
||||
{
|
||||
Nebula& nd = Nebula::instance();
|
||||
LifeCycleManager * lcm = nd.get_lcm();
|
||||
@ -776,7 +777,8 @@ int DispatchManager::resched(int vid, bool do_resched)
|
||||
NebulaLog::log("DiM",Log::DEBUG,oss);
|
||||
|
||||
if (vm->get_state() == VirtualMachine::ACTIVE &&
|
||||
vm->get_lcm_state() == VirtualMachine::RUNNING )
|
||||
(vm->get_lcm_state() == VirtualMachine::RUNNING ||
|
||||
vm->get_lcm_state() == VirtualMachine::UNKNOWN))
|
||||
{
|
||||
vm->set_resched(do_resched);
|
||||
vmpool->update(vm);
|
||||
|
@ -267,6 +267,60 @@ void LifeCycleManager::migrate_action(int vid)
|
||||
|
||||
vmm->trigger(VirtualMachineManager::SAVE,vid);
|
||||
}
|
||||
else if (vm->get_state() == VirtualMachine::ACTIVE &&
|
||||
vm->get_lcm_state() == VirtualMachine::UNKNOWN)
|
||||
{
|
||||
//----------------------------------------------------
|
||||
// Bypass SAVE_MIGRATE to PROLOG_MIGRATE STATE
|
||||
//----------------------------------------------------
|
||||
|
||||
Nebula& nd = Nebula::instance();
|
||||
TransferManager * tm = nd.get_tm();
|
||||
int cpu,mem,disk;
|
||||
time_t the_time = time(0);
|
||||
|
||||
vm->set_resched(false);
|
||||
|
||||
vm->set_state(VirtualMachine::PROLOG);
|
||||
|
||||
vm->delete_snapshots();
|
||||
|
||||
map<string, string> empty;
|
||||
vm->update_info(0, 0, -1, -1, empty);
|
||||
|
||||
vmpool->update(vm);
|
||||
|
||||
|
||||
vm->set_stime(the_time);
|
||||
|
||||
vm->set_previous_action(History::MIGRATE_ACTION);
|
||||
|
||||
vm->set_previous_etime(the_time);
|
||||
|
||||
vm->set_previous_vm_info();
|
||||
|
||||
vm->set_previous_running_etime(the_time);
|
||||
|
||||
vm->set_previous_reason(History::USER);
|
||||
|
||||
vmpool->update_previous_history(vm);
|
||||
|
||||
vm->set_prolog_stime(the_time);
|
||||
|
||||
vmpool->update_history(vm);
|
||||
|
||||
vm->get_requirements(cpu,mem,disk);
|
||||
|
||||
hpool->add_capacity(vm->get_hid(), vm->get_oid(), cpu, mem, disk);
|
||||
|
||||
hpool->del_capacity(vm->get_previous_hid(), vm->get_oid(), cpu, mem, disk);
|
||||
|
||||
vm->log("LCM", Log::INFO, "New VM state is PROLOG");
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
tm->trigger(TransferManager::PROLOG_MIGR,vid);
|
||||
}
|
||||
else
|
||||
{
|
||||
vm->log("LCM", Log::ERROR, "migrate_action, VM in a wrong state.");
|
||||
|
@ -882,7 +882,8 @@ void VirtualMachineMigrate::request_execute(xmlrpc_c::paramList const& paramList
|
||||
}
|
||||
|
||||
if((vm->get_state() != VirtualMachine::ACTIVE) ||
|
||||
(vm->get_lcm_state() != VirtualMachine::RUNNING) ||
|
||||
(vm->get_lcm_state() != VirtualMachine::RUNNING &&
|
||||
vm->get_lcm_state() != VirtualMachine::UNKNOWN) ||
|
||||
(vm->hasPreviousHistory() && vm->get_previous_reason() == History::NONE))
|
||||
{
|
||||
failure_response(ACTION,
|
||||
|
Loading…
Reference in New Issue
Block a user