diff --git a/src/vmm_mad/exec/one_vmm_exec.rb b/src/vmm_mad/exec/one_vmm_exec.rb index 657bf70dad..fa7cc295d5 100755 --- a/src/vmm_mad/exec/one_vmm_exec.rb +++ b/src/vmm_mad/exec/one_vmm_exec.rb @@ -826,14 +826,15 @@ class ExecDriver < VirtualMachineDriver target_device = target_device.text if target_device begin - source = xml_data.elements["VM/TEMPLATE/NIC[ATTACH='YES']/BRIDGE"] - source_ovs = - xml_data.elements["VM/TEMPLATE/NIC[ATTACH='YES']/BRIDGE_OVS"] - mac = xml_data.elements["VM/TEMPLATE/NIC[ATTACH='YES']/MAC"] + source = xml_data.elements["VM/TEMPLATE/NIC[ATTACH='YES']/BRIDGE"] + source_ovs = xml_data.elements["VM/TEMPLATE/NIC[ATTACH='YES']/BRIDGE_OVS"] + mac = xml_data.elements["VM/TEMPLATE/NIC[ATTACH='YES']/MAC"] + target = xml_data.elements["VM/TEMPLATE/NIC[ATTACH='YES']/TARGET"] - source = source.text.strip + source = source.text.strip source_ovs = source_ovs.text.strip if source_ovs - mac = mac.text.strip + mac = mac.text.strip + target = target.text.strip rescue send_message(action, RESULT[:failure], id, "Error in #{ACTION[:attach_nic]}, BRIDGE and MAC needed in NIC") @@ -867,7 +868,7 @@ class ExecDriver < VirtualMachineDriver { :driver => :vmm, :action => :attach_nic, - :parameters => [:deploy_id, mac, source, model, net_drv] + :parameters => [:deploy_id, mac, source, model, net_drv, target] }, # Execute post-boot networking setup { diff --git a/src/vmm_mad/remotes/kvm/attach_nic b/src/vmm_mad/remotes/kvm/attach_nic index f82752d26a..5bdb68b24e 100755 --- a/src/vmm_mad/remotes/kvm/attach_nic +++ b/src/vmm_mad/remotes/kvm/attach_nic @@ -24,6 +24,7 @@ MAC=$2 BRIDGE=$3 THE_MODEL=$4 NET_DRV=$5 +TARGET=$6 if [ "$THE_MODEL" != "-" ]; then MODEL="" @@ -37,6 +38,7 @@ DEVICE=$(cat < + $MODEL $VIRTUALPORT diff --git a/src/vnm/VirtualNetwork.cc b/src/vnm/VirtualNetwork.cc index 7387ad6062..f053acaf39 100644 --- a/src/vnm/VirtualNetwork.cc +++ b/src/vnm/VirtualNetwork.cc @@ -573,6 +573,10 @@ int VirtualNetwork::nic_attribute( const vector& inherit_attrs) { string inherit_val; + string target; + + ostringstream oss; + vector::const_iterator it; set nic_sgs; @@ -610,6 +614,14 @@ int VirtualNetwork::nic_attribute( nic->replace("PARENT_NETWORK_ID", parent_vid); } + target = nic->vector_value("TARGET"); + + if (target.empty()) + { + oss << "one-" << vid << "-" << nic->vector_value("NIC_ID"); + nic->replace("TARGET", oss.str()); + } + if ( get_cluster_id() != ClusterPool::NONE_CLUSTER_ID ) { nic->replace("CLUSTER_ID", get_cluster_id());