Skip to content

Commit

Permalink
M #-: Add sanity check on PHYDEV
Browse files Browse the repository at this point in the history
Related to issue #6367, PHYDEV maybe an empry string. This commit adds
an additional sanity check on PHYDEV to skip any configuration if it is
empty
  • Loading branch information
rsmontero committed Nov 8, 2023
1 parent 450443e commit 2808f43
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/mad/ruby/DriverExecHelper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def read_configuration
config[name]=value
end
end
rescue StandardException => e
rescue StandardError => e
STDERR.puts "Error reading config: #{e.inspect}"
STDERR.flush
end
Expand Down
9 changes: 5 additions & 4 deletions src/vnm_mad/remotes/lib/no_vlan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ def activate
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] || @nic[:phydev].empty? ||
@bridges[@nic[:bridge]].include?(@nic[:phydev])

# Add phydev device to the bridge.
OpenNebula.exec_and_log("#{command(:ip)} link set " \
Expand Down Expand Up @@ -97,8 +98,8 @@ def deactivate
next if keep

# Delete the bridge.
OpenNebula.exec_and_log("#{command(:ip)} link delete"\
" #{@nic[:bridge]}")
OpenNebula.exec_and_log("#{command(:ip)} link delete #{@nic[:bridge]}")

@bridges.delete(@nic[:bridge])
end
end
Expand All @@ -122,7 +123,7 @@ def update(vnet_id)
@nic = nic

next unless Integer(@nic[:network_id]) == vnet_id
next if @bridges[@nic[:bridge]].include? @nic[:phydev]
next if @nic[:phydev].empty? || @bridges[@nic[:bridge]].include?(@nic[:phydev])

# Del old phydev device from the bridge.
OpenNebula.exec_and_log("#{command(:ip)} link set " \
Expand Down

0 comments on commit 2808f43

Please sign in to comment.