1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

B #5319: make sure OVS ports are cleanned (#1071)

This commit is contained in:
Christian González 2021-04-07 13:16:46 +02:00 committed by GitHub
parent 358208b54e
commit 8950f89525
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -202,6 +202,8 @@ module VNMMAD
end
def get_tap(vm)
return self unless vm.deploy_id
self[:tap] = "#{vm.deploy_id}-#{self[:nic_id]}"
self

View File

@ -132,8 +132,9 @@ class OpenvSwitchVLAN < VNMMAD::VNMDriver
# Remove flows
del_flows
# delete port from bridge in case of dpdk
del_bridge_port(@nic[:target]) if dpdk?
# delete port from bridge if exists. Some virtualization
# technologies might clean the port itselves.
del_bridge_port(@nic[:target])
next if @nic[:phydev].nil?
next if @bridges[@nic[:bridge]].nil?
@ -440,7 +441,8 @@ private
# Delete port from OvS bridge
def del_bridge_port(port)
OpenNebula.exec_and_log("#{command(:ovs_vsctl)} del-port #{@nic[:bridge]} #{port}")
OpenNebula.exec_and_log("#{command(:ovs_vsctl)} --if-exists del-port " \
"#{@nic[:bridge]} #{port}")
@bridges[@nic[:bridge]].delete(port)
end