From 30a7392cdceacb847f38b83fc123ac311289fa32 Mon Sep 17 00:00:00 2001 From: Taoyong Ding Date: Fri, 21 Apr 2017 03:29:19 -0700 Subject: [PATCH] CA-250748: MTU on pif does not always sync to xapi db Fix when pif-plug is called, the mtu is not sync to xapi db. Signed-off-by: Taoyong Ding --- ocaml/xapi/nm.ml | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/ocaml/xapi/nm.ml b/ocaml/xapi/nm.ml index d02c4373ed1..9d95e946781 100644 --- a/ocaml/xapi/nm.ml +++ b/ocaml/xapi/nm.ml @@ -462,18 +462,17 @@ let bring_pif_up ~__context ?(management_interface=false) (pif: API.ref_PIF) = let master = Db.Bond.get_master ~__context ~self:bond in Db.PIF.set_currently_attached ~__context ~self:master ~value:false end; - - (* sync MTU *) - (try - let mtu = Int64.of_int (Net.Interface.get_mtu dbg ~name:bridge) in - Db.PIF.set_MTU ~__context ~self:pif ~value:mtu - with _ -> - debug "could not update MTU field on PIF %s" rc.API.pIF_uuid - ); - Xapi_mgmt_iface.on_dom0_networking_change ~__context - end - ) + end; + + (* sync MTU *) + try + let mtu = Int64.of_int (Net.Interface.get_mtu dbg ~name:bridge) in + if mtu <> rc.API.pIF_MTU then + Db.PIF.set_MTU ~__context ~self:pif ~value:mtu + with _ -> + warn "could not update MTU field on PIF %s" rc.API.pIF_uuid + ) let bring_pif_down ~__context ?(force=false) (pif: API.ref_PIF) = with_local_lock (fun () ->