mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
(cherry picked from commit f1749061a00108a81f60be5ab4748e3cf329ecf8)
This commit is contained in:
parent
c3598dae61
commit
89e797eaab
@ -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?
|
||||
|
@ -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?
|
||||
|
Loading…
x
Reference in New Issue
Block a user