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

Feature #2435 #2092: Do not allow migrations to/from a public cloud host

This commit is contained in:
Carlos Martín 2013-11-21 13:18:31 +01:00 committed by Javi Fontan
parent 0924ec23f4
commit 9c9a0306db

View File

@ -846,6 +846,7 @@ void VirtualMachineMigrate::request_execute(xmlrpc_c::paramList const& paramList
int c_cluster_id;
int c_ds_id;
string c_tm_mad;
bool c_is_public_cloud;
bool auth = false;
@ -876,8 +877,6 @@ void VirtualMachineMigrate::request_execute(xmlrpc_c::paramList const& paramList
return;
}
// TODO: return error for public cloud hosts?
// ------------------------------------------------------------------------
// Authorize request
// ------------------------------------------------------------------------
@ -895,6 +894,7 @@ void VirtualMachineMigrate::request_execute(xmlrpc_c::paramList const& paramList
// - New host is not the current one
// - Host capacity if required
// - New host and current one are in the same cluster
// - New or old host are not public cloud
// ------------------------------------------------------------------------
if ((vm = get_vm(id, att)) == 0)
@ -974,6 +974,8 @@ void VirtualMachineMigrate::request_execute(xmlrpc_c::paramList const& paramList
c_cluster_id = host->get_cluster_id();
c_is_public_cloud = host->is_public_cloud();
host->unlock();
if ( c_cluster_id != cluster_id )
@ -992,6 +994,15 @@ void VirtualMachineMigrate::request_execute(xmlrpc_c::paramList const& paramList
return;
}
if ( is_public_cloud || c_is_public_cloud )
{
failure_response(ACTION,
request_error("Cannot migrate to or from a Public Cloud Host",""),
att);
return;
}
// ------------------------------------------------------------------------
// Add a new history record and migrate the VM
// ------------------------------------------------------------------------