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

Bug #1306: VMs cannot be migrated to hosts using a different system DS

(cherry picked from commit 2867263e5734007747322cbcf9f94fb5ee6b0ac8)
This commit is contained in:
Carlos Martín 2012-07-03 18:58:14 +02:00
parent 989b1d1fbc
commit cd00217bad

View File

@ -440,6 +440,11 @@ void VirtualMachineMigrate::request_execute(xmlrpc_c::paramList const& paramList
string tm_mad;
int ds_id;
PoolObjectAuth aux_perms;
int current_ds_id;
string aux_st;
int current_hid;
int id = xmlrpc_c::value_int(paramList.getInt(1));
int hid = xmlrpc_c::value_int(paramList.getInt(2));
bool live = xmlrpc_c::value_boolean(paramList.getBoolean(3));
@ -476,6 +481,39 @@ void VirtualMachineMigrate::request_execute(xmlrpc_c::paramList const& paramList
return;
}
current_hid = vm->get_hid();
vm->unlock();
if (get_host_information(
current_hid,aux_st,aux_st,aux_st,
aux_st,current_ds_id, att, aux_perms) != 0)
{
return;
}
if ( current_ds_id != ds_id )
{
ostringstream oss;
oss << "Cannot migrate to a different cluster with different system "
<< "datastore. Current " << object_name(PoolObjectSQL::HOST)
<< " [" << current_hid << "] uses system datastore [" << current_ds_id
<< "], new " << object_name(PoolObjectSQL::HOST) << " [" << hid
<< "] uses system datastore [" << ds_id << "]";
failure_response(ACTION,
request_error(oss.str(),""),
att);
return;
}
if ( (vm = get_vm(id, att)) == 0 )
{
return;
}
if ( add_history(vm,hid,hostname,vmm_mad,vnm_mad,tm_mad,ds_id,att) != 0)
{
vm->unlock();