mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
M #-: Improve bridge delete condition
(cherry picked from commit f4562df95dd61ffa4fcb50171f93a97226f1feaf)
This commit is contained in:
parent
98f709d237
commit
993e87e8f8
@ -39,11 +39,11 @@ module VNMMAD
|
||||
create_bridge(@nic)
|
||||
|
||||
# Return if vlan device is already in the bridge.
|
||||
next if !nic[:phydev] || @bridges[@nic[:bridge]].include? @nic[:phydev]
|
||||
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]}")
|
||||
"#{@nic[:phydev]} master #{@nic[:bridge]}")
|
||||
|
||||
@bridges[@nic[:bridge]] << @nic[:phydev]
|
||||
end
|
||||
@ -78,9 +78,16 @@ module VNMMAD
|
||||
next if @nic[:conf][:keep_empty_bridge]
|
||||
|
||||
# Return if the phydev device is not the only left device in
|
||||
# the bridge.
|
||||
next if (@bridges[@nic[:bridge]].length > 1) ||
|
||||
# the bridge.A
|
||||
if @nic[:phydev].nil?
|
||||
keep = !@bridges[@nic[:bridge]].empty?
|
||||
else
|
||||
|
||||
keep = @bridges[@nic[:bridge]].length > 1 ||
|
||||
!@bridges[@nic[:bridge]].include?(@nic[:phydev])
|
||||
end
|
||||
|
||||
next if keep
|
||||
|
||||
# Delete the bridge.
|
||||
OpenNebula.exec_and_log("#{command(:ip)} link delete"\
|
||||
|
Loading…
x
Reference in New Issue
Block a user