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

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

(cherry picked from commit 8950f895254912e6cd3041620206c4c59ecf94bf)
This commit is contained in:
Christian González 2021-04-07 13:16:46 +02:00 committed by Ruben S. Montero
parent ae0f3f79e2
commit 955c2160ba
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87
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