From 80f8c0be57b2c2e53c05b20cfbf36c2b2f5cb13b Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Thu, 9 Apr 2015 16:11:44 +0200 Subject: [PATCH] feature #3564: Do not migrate on PROLOG_MIGRATE_FAILURE --- src/rm/RequestManagerVirtualMachine.cc | 53 +++++--------------------- 1 file changed, 10 insertions(+), 43 deletions(-) diff --git a/src/rm/RequestManagerVirtualMachine.cc b/src/rm/RequestManagerVirtualMachine.cc index e7eb9aed95..5e968a37d8 100644 --- a/src/rm/RequestManagerVirtualMachine.cc +++ b/src/rm/RequestManagerVirtualMachine.cc @@ -915,8 +915,7 @@ 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::UNKNOWN && - vm->get_lcm_state() != VirtualMachine::PROLOG_MIGRATE_FAILURE) || + vm->get_lcm_state() != VirtualMachine::UNKNOWN) || (vm->hasPreviousHistory() && vm->get_previous_reason() == History::NONE)) { failure_response(ACTION, @@ -941,51 +940,19 @@ void VirtualMachineMigrate::request_execute(xmlrpc_c::paramList const& paramList c_hid = vm->get_hid(); - if (vm->get_state() == VirtualMachine::ACTIVE && - vm->get_lcm_state() == VirtualMachine::PROLOG_MIGRATE_FAILURE) + if (c_hid == hid) { - enforce = false; - live = false; + ostringstream oss; - int p_hid = c_hid; + oss << "VM is already running on " + << object_name(PoolObjectSQL::HOST) << " [" << c_hid << "]"; - if(vm->hasPreviousHistory()) - { - p_hid = vm->get_previous_hid(); - } + failure_response(ACTION, + request_error(oss.str(),""), + att); - if (hid != c_hid && hid != p_hid) - { - ostringstream oss; - - oss << "VM in state PROLOG_MIGRATE_FAILURE can only be migrated to " - << object_name(PoolObjectSQL::HOST) << " [" << c_hid << "] or " - << object_name(PoolObjectSQL::HOST) << " [" << p_hid << "]"; - - failure_response(ACTION, - request_error(oss.str(),""), - att); - - vm->unlock(); - return; - } - } - else - { - if (c_hid == hid) - { - ostringstream oss; - - oss << "VM is already running on " - << object_name(PoolObjectSQL::HOST) << " [" << c_hid << "]"; - - failure_response(ACTION, - request_error(oss.str(),""), - att); - - vm->unlock(); - return; - } + vm->unlock(); + return; } // Get System DS information from current History record