From 42d83f59bf12da4b8ef763abe1a1b04650da85aa Mon Sep 17 00:00:00 2001 From: Alejandro Huertas Herrero Date: Tue, 3 Sep 2019 16:30:32 +0200 Subject: [PATCH] B #3578: change parser to process alias (#3635) --- src/parsers/vm_var_syntax.y | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/src/parsers/vm_var_syntax.y b/src/parsers/vm_var_syntax.y index ba642aa459..6f0a53350b 100644 --- a/src/parsers/vm_var_syntax.y +++ b/src/parsers/vm_var_syntax.y @@ -191,10 +191,38 @@ void get_network_attribute(VirtualMachine * vm, } } - if (vnet_id == -1) + vector 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