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

feature #4620: Add PCI network requests to automatic requirements

This commit is contained in:
Ruben S. Montero 2016-07-14 15:34:55 +02:00
parent 23f556a406
commit caefeb0e37

View File

@ -1522,6 +1522,27 @@ int VirtualMachine::automatic_requirements(string& error_str)
}
}
vatts.clear();
// Get cluster id from all PCI attibutes, TYPE = NIC
num_vatts = obj_template->get("PCI", vatts);
for(int i=0; i<num_vatts; i++)
{
if ( vatts[i]->vector_value("TYPE") != "NIC" )
{
continue;
}
rc = check_and_set_cluster_id("CLUSTER_ID", vatts[i], cluster_ids);
if ( rc != 0 )
{
incomp_id = i;
goto error_pci;
}
}
if ( !cluster_ids.empty() )
{
set<int>::iterator i = cluster_ids.begin();
@ -1635,6 +1656,20 @@ error_nic:
goto error_common;
error_pci:
if (rc == -1)
{
oss << "Incompatible clusters in PCI (TYPE=NIC). It is is not the same"
<< " as the one used by other VM elements (cluster "
<< one_util::join(cluster_ids, ',') << ")";
}
else
{
oss << "Missing clusters. Network for PCI device of TYPE=NIC";
}
goto error_common;
error_common:
error_str = oss.str();