File tree Expand file tree Collapse file tree 1 file changed +24
-4
lines changed Expand file tree Collapse file tree 1 file changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -1179,8 +1179,16 @@ module Ovs = struct
11791179 List.flatten (List.map (fun vif -> create_port_arg ?ty:(List.assoc_opt vif ifaces_with_type) vif name) existing_vifs)
11801180 in
11811181 let del_old_arg =
1182- if vlan <> None then
1183- (* This is to handle the case that a " real" bridge (not a " fake" VLAN bridge) already exists *)
1182+ let real_bridge_exists () =
1183+ try
1184+ (* `ovs-vsctl br-to-parent <name>` returns <name> if <name> is a current " real" bridge *)
1185+ vsctl ~log:false [" br- to - parent" ; name] |> String.trim = name
1186+ with _ -> false
1187+ in
1188+ if vlan <> None && real_bridge_exists () then
1189+ (* This is to handle the case that a " real" bridge (not a " fake" VLAN bridge)
1190+ already exists, while we need to create a VLAN bridge with the same name.
1191+ The bridge will be destroyed and recreated, and the interfaces on it are put back. *)
11841192 [" -- " ; " -- if - exists" ; " del- br" ; name]
11851193 else
11861194 []
@@ -1204,8 +1212,20 @@ module Ovs = struct
12041212 [" -- "; " set"; " bridge"; name; " other_config:mcast- snooping- disable- flood- unregistered= " ^ (string_of_bool !mcast_snooping_disable_flood_unregistered)]
12051213 | _ -> []
12061214 in
1207- vsctl (del_old_arg @ [" -- "; " -- may- exist"; " add- br"; name] @
1208- vlan_arg @ mac_arg @ fail_mode_arg @ disable_in_band_arg @ external_id_arg @ vif_arg @ set_mac_table_size @ set_igmp_snooping @ set_ipv6_igmp_snooping @ disable_flood_unregistered)
1215+ vsctl (
1216+ del_old_arg
1217+ @ [" -- "; " -- may- exist"; " add- br"; name]
1218+ @ vlan_arg
1219+ @ mac_arg
1220+ @ fail_mode_arg
1221+ @ disable_in_band_arg
1222+ @ external_id_arg
1223+ @ vif_arg
1224+ @ set_mac_table_size
1225+ @ set_igmp_snooping
1226+ @ set_ipv6_igmp_snooping
1227+ @ disable_flood_unregistered
1228+ )
12091229
12101230 let destroy_bridge name =
12111231 vsctl [" -- "; " -- if - exists"; " del- br"; name]
You can’t perform that action at this time.
0 commit comments