1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-25 23:21:29 +03:00

B #3578: change parser to process alias (#3635)

This commit is contained in:
Alejandro Huertas Herrero 2019-09-03 16:30:32 +02:00 committed by Ruben S. Montero
parent d9ee08235b
commit 42d83f59bf

View File

@ -191,10 +191,38 @@ void get_network_attribute(VirtualMachine * vm,
}
}
if (vnet_id == -1)
vector<const VectorAttribute *> alias;
int alias_num = vm->get_template_attribute("NIC_ALIAS", alias);
if (vnet_id == -1 && alias_num == 0)
{
return;
}
else
{
for (int i=0; i < alias_num ;i++)
{
if ( alias[i]->vector_value(net_name.c_str()) == net_value )
{
if (alias[i]->vector_value("NETWORK_ID", vnet_id) != 0)
{
vnet_id = -1;
}
if (alias[i]->vector_value("AR_ID", ar_id) != 0)
{
vnet_id = -1;
}
break;
}
}
if (vnet_id == -1)
{
return;
}
}
// ----------------------------------------------
// Get the attribute template from the image