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

F #5362: Add OpenVSwitch support for Firecracker (#1150)

(cherry picked from commit f1749061a00108a81f60be5ab4748e3cf329ecf8)
This commit is contained in:
Christian González 2021-05-01 21:52:50 +02:00 committed by Ruben S. Montero
parent c3598dae61
commit 89e797eaab
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87
2 changed files with 19 additions and 2 deletions

View File

@ -43,6 +43,9 @@ vnmad = File.basename(File.expand_path('..', File.dirname(__FILE__)))
XPATH_NICS = "//TEMPLATE/NIC[VN_MAD='#{vnmad}']"
XPATH_HV = '//HISTORY/VM_MAD'
OVS_VN_MADS = %w[ovswitch ovswitch_vxlan]
#----------------------------------------------------------------------------
template64 = STDIN.read
@ -60,6 +63,7 @@ error = false
template.elements.each(XPATH_NICS) do |nic_element|
nic_id = Integer(nic_element.elements['NIC_ID'].text)
bridge = nic_element.elements['BRIDGE'].text
if_name = "#{deploy_id}-#{nic_id}"
# check if interface is already defined
@ -69,7 +73,12 @@ template.elements.each(XPATH_NICS) do |nic_element|
next unless rc.success?
# Del tap interface from the bridge
cmd = "#{command(:ip)} link set #{if_name} nomaster"
if OVS_VN_MADS.include?(vnmad)
cmd = "#{command(:ovs_vsctl)} --if-exists del-port #{bridge} #{if_name}"
else
cmd = "#{command(:ip)} link set #{if_name} nomaster"
end
_, e, rc = Open3.capture3(cmd)
if !rc.success?

View File

@ -39,6 +39,9 @@ vnmad = File.basename(File.expand_path('..', File.dirname(__FILE__)))
XPATH_NICS = "//TEMPLATE/NIC[VN_MAD='#{vnmad}']"
XPATH_HV = '//HISTORY/VM_MAD'
OVS_VN_MADS = %w[ovswitch ovswitch_vxlan]
#----------------------------------------------------------------------------
template64 = STDIN.read
@ -82,7 +85,12 @@ template.elements.each(XPATH_NICS) do |nic_element|
break unless rc.success?
# Add tap interface to the bridge
cmd = "#{command(:ip)} link set #{if_name} master #{bridge}"
if OVS_VN_MADS.include?(vnmad)
cmd = "#{command(:ovs_vsctl)} add-port #{bridge} #{if_name}"
else
cmd = "#{command(:ip)} link set #{if_name} master #{bridge}"
end
_, _, rc = Open3.capture3(cmd)
break unless rc.success?