Skip to content

Commit 4563373

Browse files
authored
Merge pull request xapi-project#3007 from taoyongd/CA-250748
CA-250748: MTU on pif does not always sync to xapi db
2 parents 49bd2d4 + 30a7392 commit 4563373

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

ocaml/xapi/nm.ml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -462,18 +462,17 @@ let bring_pif_up ~__context ?(management_interface=false) (pif: API.ref_PIF) =
462462
let master = Db.Bond.get_master ~__context ~self:bond in
463463
Db.PIF.set_currently_attached ~__context ~self:master ~value:false
464464
end;
465-
466-
(* sync MTU *)
467-
(try
468-
let mtu = Int64.of_int (Net.Interface.get_mtu dbg ~name:bridge) in
469-
Db.PIF.set_MTU ~__context ~self:pif ~value:mtu
470-
with _ ->
471-
debug "could not update MTU field on PIF %s" rc.API.pIF_uuid
472-
);
473-
474465
Xapi_mgmt_iface.on_dom0_networking_change ~__context
475-
end
476-
)
466+
end;
467+
468+
(* sync MTU *)
469+
try
470+
let mtu = Int64.of_int (Net.Interface.get_mtu dbg ~name:bridge) in
471+
if mtu <> rc.API.pIF_MTU then
472+
Db.PIF.set_MTU ~__context ~self:pif ~value:mtu
473+
with _ ->
474+
warn "could not update MTU field on PIF %s" rc.API.pIF_uuid
475+
)
477476

478477
let bring_pif_down ~__context ?(force=false) (pif: API.ref_PIF) =
479478
with_local_lock (fun () ->

0 commit comments

Comments
 (0)