Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #1616 from ravippandey/Dodger/HFX-1004
[HFX-1004] CA-118425/SCTX-1559: Remove interfaces from bridge before
  • Loading branch information
robhoes committed Feb 4, 2014
2 parents 69bf907 + a35f214 commit a4e2115
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions ocaml/network/network_server.ml
Expand Up @@ -466,11 +466,23 @@ module Bridge = struct
match vlan with
| None -> ()
| Some (parent, vlan) ->
let interface = List.hd (List.filter (fun n ->
(* Robustness enhancement: ensure there are no other VLANs in the bridge *)
let current_interfaces = List.filter (fun n ->
String.startswith "eth" n || String.startswith "bond" n
) (Sysfs.bridge_to_interfaces name) in
debug "Removing these non-VIF interfaces found on the bridge: %s"
(String.concat ", " current_interfaces);
List.iter (fun interface ->
Brctl.destroy_port name interface;
Interface.bring_down () dbg ~name:interface
) current_interfaces;

(* Now create the new VLAN device and add it to the bridge *)
let parent_interface = List.hd (List.filter (fun n ->
String.startswith "eth" n || String.startswith "bond" n
) (Sysfs.bridge_to_interfaces parent)) in
Ip.create_vlan interface vlan;
let vlan_name = Ip.vlan_name interface vlan in
Ip.create_vlan parent_interface vlan;
let vlan_name = Ip.vlan_name parent_interface vlan in
Interface.bring_up () dbg ~name:vlan_name;
Brctl.create_port name vlan_name
end;
Expand Down

0 comments on commit a4e2115

Please sign in to comment.