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

Feature #3778: Allow DS migration for poweroff VMs only

This commit is contained in:
Carlos Martín 2015-04-30 11:56:26 +02:00
parent b94d0d951b
commit 525e8deb84

View File

@ -1024,6 +1024,25 @@ void VirtualMachineMigrate::request_execute(xmlrpc_c::paramList const& paramList
return;
}
// Check the VM state again, in case the system DS is also changed
if((ds_id != -1 && ds_id != c_ds_id) &&
(vm->get_state() != VirtualMachine::POWEROFF))
{
ostringstream oss;
string tmp_st;
oss << "System datastore migration is only available for VMs in the "
<< VirtualMachine::vm_state_to_str(tmp_st, VirtualMachine::POWEROFF)
<< " state, current state is " << vm->state_str();
failure_response(ACTION,
request_error(oss.str(),""),
att);
vm->unlock();
return;
}
// Check the host has enough capacity
if (enforce)
{
@ -1117,6 +1136,17 @@ void VirtualMachineMigrate::request_execute(xmlrpc_c::paramList const& paramList
return;
}
if (c_tm_mad != tm_mad)
{
ostringstream oss;
oss << "Cannot migrate to a system datastore with a different TM driver";
failure_response(ACTION, request_error(oss.str(),""), att);
return;
}
}
else
{