From 4b66f92b089f7128e5f716701bc798f3d580997c Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Thu, 7 May 2015 12:04:35 +0200 Subject: [PATCH] feature #3789: Reference Network used by a NIC in context --- src/vm/VirtualMachine.cc | 3 +-- src/vm/vm_var_syntax.cc | 3 ++- src/vm/vm_var_syntax.y | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/vm/VirtualMachine.cc b/src/vm/VirtualMachine.cc index d68155453c..bc5526fa37 100644 --- a/src/vm/VirtualMachine.cc +++ b/src/vm/VirtualMachine.cc @@ -787,7 +787,6 @@ error_cleanup: static void parse_context_network(const char* vars[][2], int num_vars, VectorAttribute * context, VectorAttribute * nic) { - string name = nic->vector_value("NETWORK"); string nic_id = nic->vector_value("NIC_ID"); for (int i=0; i < num_vars; i++) @@ -810,7 +809,7 @@ static void parse_context_network(const char* vars[][2], int num_vars, { ostringstream cval_ss; - cval_ss << "$NETWORK["<< vars[i][1] <<", NETWORK=\""<< name <<"\"]"; + cval_ss << "$NETWORK["<< vars[i][1] <<", NIC_ID=\""<< nic_id <<"\"]"; cval = cval_ss.str(); } diff --git a/src/vm/vm_var_syntax.cc b/src/vm/vm_var_syntax.cc index 3306364a0b..63f0a42f51 100644 --- a/src/vm/vm_var_syntax.cc +++ b/src/vm/vm_var_syntax.cc @@ -231,7 +231,8 @@ void get_network_attribute(VirtualMachine * vm, attr_value.clear(); - if ( net_name.empty() || (net_name!="NETWORK" && net_name!="NETWORK_ID") ) + if ( net_name.empty() || + (net_name!="NETWORK" && net_name!="NETWORK_ID" && net_name!="NIC_ID")) { return; } diff --git a/src/vm/vm_var_syntax.y b/src/vm/vm_var_syntax.y index e531adaa2d..b071f79b25 100644 --- a/src/vm/vm_var_syntax.y +++ b/src/vm/vm_var_syntax.y @@ -176,7 +176,8 @@ void get_network_attribute(VirtualMachine * vm, attr_value.clear(); - if ( net_name.empty() || (net_name!="NETWORK" && net_name!="NETWORK_ID") ) + if ( net_name.empty() || + (net_name!="NETWORK" && net_name!="NETWORK_ID" && net_name!="NIC_ID")) { return; }