mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
B #: Fix PHYDEV behavior for bridge networks
co-authored-by: Christian González <cgonzalez@opennebula.io> (cherry picked from commit 356c654801cc4007864057b0a375f6e76af83e0e)
This commit is contained in:
parent
855968a15b
commit
6a553c226b
@ -25,17 +25,10 @@ module VNMMAD
|
||||
super(vm, xpath_filter, deploy_id)
|
||||
end
|
||||
|
||||
def create_vlan_dev
|
||||
true
|
||||
end
|
||||
|
||||
def delete_vlan_dev
|
||||
true
|
||||
end
|
||||
|
||||
# Activate the driver and creates bridges and tags devices as needed.
|
||||
def activate
|
||||
lock
|
||||
lock
|
||||
|
||||
@bridges = list_bridges
|
||||
|
||||
@ -44,6 +37,15 @@ module VNMMAD
|
||||
|
||||
# Create the bridge.
|
||||
create_bridge
|
||||
|
||||
# Return if vlan device is already in the bridge.
|
||||
next if !nic[:phydev] || @bridges[@nic[:bridge]].include? @nic[:phydev]
|
||||
|
||||
# Add phydev device to the bridge.
|
||||
OpenNebula.exec_and_log("#{command(:ip)} link set " \
|
||||
"#{@nic[:phydev]} master #{@nic[:bridge]}")
|
||||
|
||||
@bridges[@nic[:bridge]] << @nic[:phydev]
|
||||
end
|
||||
|
||||
unlock
|
||||
@ -75,8 +77,10 @@ module VNMMAD
|
||||
# Return if we want to keep the empty bridge
|
||||
next if @nic[:conf][:keep_empty_bridge]
|
||||
|
||||
# Return if the bridge is not empty
|
||||
next unless @bridges[@nic[:bridge]].empty?
|
||||
# Return if the phydev device is not the only left device in
|
||||
# the bridge.
|
||||
next if (@bridges[@nic[:bridge]].length > 1) ||
|
||||
!@bridges[@nic[:bridge]].include?(@nic[:phydev])
|
||||
|
||||
# Delete the bridge.
|
||||
OpenNebula.exec_and_log("#{command(:ip)} link delete"\
|
||||
@ -90,16 +94,6 @@ module VNMMAD
|
||||
0
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def gen_vlan_dev_name
|
||||
@nic[:vlan_dev] = @nic[:phydev] if @nic[:phydev]
|
||||
end
|
||||
|
||||
def validate_vlan_id
|
||||
true
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user