1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-24 21:34:01 +03:00

feature #1639: UNKNOWN VMs migrate to BOOT state. Live migrations only for RUNNING VMs

(cherry picked from commit c794a0f62f47dcb1da4639e7a47757ffc426d5c4)
This commit is contained in:
Ruben S. Montero 2014-08-24 12:05:01 +02:00
parent a445d02a50
commit 17cf5167d4
4 changed files with 21 additions and 16 deletions

View File

@ -619,9 +619,8 @@ HM_MAD = [
# This hook is used to perform recovery actions when a host fails.
# Script to implement host failure tolerance
# It can be set to
# -m migrate VMs to another host.
# State will be lost. Only for shared storage
# -r recreate VMs running in the host
# -m migrate VMs to another host. Only for images in shared storage
# -r recreate VMs running in the host. State will be lost.
# -d delete VMs running in the host
# Additional flags
# -f force resubmission of suspended VMs

View File

@ -16,18 +16,26 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
####################################################
##############################################################################
# Script to implement host failure tolerance
# It can be set to
# -m migrate VMs to another host.
# State will be lost. Only for shared storage
# -r recreate VMs running in the host
# -m migrate VMs to another host. Only for images in shared storage
# -r recreate VMs running in the host. State will be lost.
# -d delete VMs running in the host
# Additional flags
# -f force resubmission of suspended VMs
# -p <n> avoid resubmission if host comes
# back after n monitoring cycles
####################################################
##############################################################################
##############################################################################
# WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!
#
# This scripts needs to fence the error host to prevent split brain VMs. You
# may use any fence mechanism and invoke it around L105, using host_name
#
# WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!
#############################################################################
ONE_LOCATION=ENV["ONE_LOCATION"]

View File

@ -271,7 +271,7 @@ void LifeCycleManager::migrate_action(int vid)
vm->get_lcm_state() == VirtualMachine::UNKNOWN)
{
//----------------------------------------------------
// Bypass SAVE_MIGRATE to PROLOG_MIGRATE STATE
// Bypass SAVE_MIGRATE & PROLOG_MIGRATE goto BOOT
//----------------------------------------------------
Nebula& nd = Nebula::instance();
@ -281,16 +281,16 @@ void LifeCycleManager::migrate_action(int vid)
vm->set_resched(false);
vm->set_state(VirtualMachine::PROLOG);
vm->set_state(VirtualMachine::BOOT);
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);
@ -305,8 +305,6 @@ void LifeCycleManager::migrate_action(int vid)
vmpool->update_previous_history(vm);
vm->set_prolog_stime(the_time);
vmpool->update_history(vm);
vm->get_requirements(cpu,mem,disk);
@ -315,11 +313,11 @@ void LifeCycleManager::migrate_action(int vid)
hpool->del_capacity(vm->get_previous_hid(), vm->get_oid(), cpu, mem, disk);
vm->log("LCM", Log::INFO, "New VM state is PROLOG");
vm->log("LCM", Log::INFO, "New VM state is BOOT");
//----------------------------------------------------
tm->trigger(TransferManager::PROLOG_MIGR,vid);
vmm->trigger(VirtualMachine::BOOT, vid);
}
else
{

View File

@ -1003,7 +1003,7 @@ void VirtualMachineMigrate::request_execute(xmlrpc_c::paramList const& paramList
return;
}
if (live == true)
if (live == true && vm->get_lcm_state() == VirtualMachine::RUNNING )
{
dm->live_migrate(vm);
}