Skip to content

Commit 3e810ee

Browse files
committed
Merge pull request #81 from robhoes/ca212083
CA-212083: In with_slaves_removed, call `f` if there are no slaves
2 parents 76047d0 + 4310ea6 commit 3e810ee

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lib/network_utils.ml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -454,14 +454,12 @@ module Linux_bonding = struct
454454
if is_bond_device master then
455455
try
456456
let slaves = get_bond_slaves master in
457-
if slaves <> [] then begin
458-
Ip.with_links_down slaves (fun () ->
459-
remove_bond_slaves master slaves;
460-
finally
461-
f
462-
(fun () -> add_bond_slaves master slaves)
463-
)
464-
end
457+
Ip.with_links_down slaves (fun () ->
458+
remove_bond_slaves master slaves;
459+
finally
460+
f
461+
(fun () -> add_bond_slaves master slaves)
462+
)
465463
with _ ->
466464
error "Failed to remove or re-add slaves from bond %s" master
467465
else
@@ -503,10 +501,12 @@ module Linux_bonding = struct
503501
let set_bond_properties master properties =
504502
if is_bond_device master then begin
505503
let current_props = get_bond_properties master in
504+
debug "Current bond properties: %s" (String.concat ", " (List.map (fun (k, v) -> k ^ "=" ^ v) current_props));
506505
(* Find out which properties are known, but different from the current state,
507506
* and only continue if there is at least one of those. *)
508507
let props_to_update = List.filter (fun (prop, value) ->
509508
not (List.mem (prop, value) current_props) && List.mem prop known_props) properties in
509+
debug "Bond properties to update: %s" (String.concat ", " (List.map (fun (k, v) -> k ^ "=" ^ v) props_to_update));
510510
if props_to_update <> [] then
511511
let set_prop (prop, value) =
512512
try

0 commit comments

Comments
 (0)