feature #1712: Make use of datastore selection

This commit is contained in:
Ruben S. Montero committed 2013-08-23 00:46:05 +02:00
1 parent cad0fc8903
commit 2bf0cf7a90
2 files changed
+10 -13

No files matched your search

+5 -9
View File
@@ -532,19 +532,15 @@ void VirtualMachineDeploy::request_execute(xmlrpc_c::paramList const& paramList,
return;
}
if ( ds_cluster_id != cluster_id )
if ((ds_cluster_id != -1) && (ds_cluster_id != cluster_id))
{
ostringstream oss;
oss << "Trying to use " << object_name(PoolObjectSQL::DATASTORE)
<< " [" << ds_id << "], to deploy VM but it is not part of "
<< object_name(PoolObjectSQL::CLUSTER) << " [" << cluster_id
<<"] as " << object_name(PoolObjectSQL::HOST) << " [" << hid
<<"] ";
oss << object_name(PoolObjectSQL::DATASTORE)
<< " [" << ds_id << "] and " << object_name(PoolObjectSQL::HOST)
<< " [" << hid <<"] are not in the same cluster.";
failure_response(ACTION,
request_error(oss.str(),""),
att);
failure_response(ACTION, request_error(oss.str(),""), att);
return;
}
@@ -131,12 +131,13 @@ int VirtualMachinePoolXML::dispatch(int vid, int hid, int dsid, bool resched) co
{
client->call(client->get_endpoint(), // serverUrl
"one.vm.deploy", // methodName
"siib", // arguments format
"siibi", // arguments format
&deploy_result, // resultP
client->get_oneauth().c_str(), // argument 0 (AUTH)
vid, // argument 1 (VM)
hid, // argument 2 (HOST)
false); // argument 3 (ENFORCE)
false, // argument 3 (ENFORCE)
dsid); // argument 5 (SYSTEM SD)
}
}
catch (exception const& e)
@@ -154,11 +155,11 @@ int VirtualMachinePoolXML::dispatch(int vid, int hid, int dsid, bool resched) co
vector<xmlrpc_c::value> values =
xmlrpc_c::value_array(deploy_result).vectorValueValue();
bool success = xmlrpc_c::value_boolean( values[0] );
bool success = xmlrpc_c::value_boolean(values[0]);
if ( !success )
{
string message = xmlrpc_c::value_string( values[1] );
string message = xmlrpc_c::value_string(values[1]);
oss.str("");
oss << "Error deploying virtual machine " << vid