mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-25 02:50:08 +03:00
Feature #4205: Name host-side guest interfaces uniquely
This commit is based on the patch submitted by Roy Keene.
This commit is contained in:
parent
1f31442eeb
commit
a716343a0d
@ -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
|
||||
{
|
||||
|
@ -24,6 +24,7 @@ MAC=$2
|
||||
BRIDGE=$3
|
||||
THE_MODEL=$4
|
||||
NET_DRV=$5
|
||||
TARGET=$6
|
||||
|
||||
if [ "$THE_MODEL" != "-" ]; then
|
||||
MODEL="<model type='$THE_MODEL'/>"
|
||||
@ -37,6 +38,7 @@ DEVICE=$(cat <<EOF
|
||||
<interface type='bridge'>
|
||||
<source bridge='$BRIDGE'/>
|
||||
<mac address='$MAC'/>
|
||||
<target dev='$TARGET'/>
|
||||
$MODEL
|
||||
$VIRTUALPORT
|
||||
</interface>
|
||||
|
@ -573,6 +573,10 @@ int VirtualNetwork::nic_attribute(
|
||||
const vector<string>& inherit_attrs)
|
||||
{
|
||||
string inherit_val;
|
||||
string target;
|
||||
|
||||
ostringstream oss;
|
||||
|
||||
vector<string>::const_iterator it;
|
||||
|
||||
set<int> 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());
|
||||
|
Loading…
x
Reference in New Issue
Block a user