Skip to content

Commit 0c14d1a

Browse files
committed
Set driver domain when plugging a PIF
Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
1 parent bdb59b3 commit 0c14d1a

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

ocaml/xapi/nm.ml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,10 @@ let bring_pif_up ~__context ?(management_interface=false) (pif: API.ref_PIF) =
369369
let rc = Db.PIF.get_record ~__context ~self:pif in
370370
let net_rc = Db.Network.get_record ~__context ~self:rc.API.pIF_network in
371371
let bridge = net_rc.API.network_bridge in
372+
let driver_domain =
373+
Opt.map (fun self -> Db.VM.get_uuid ~__context ~self)
374+
(Network.get_driver_domain ~__context pif)
375+
in
372376

373377
(* Call networkd even if currently_attached is false, just to update its state *)
374378
debug "Making sure that PIF %s is up" rc.API.pIF_uuid;
@@ -390,8 +394,18 @@ let bring_pif_up ~__context ?(management_interface=false) (pif: API.ref_PIF) =
390394
Opt.iter (fun name -> Net.set_gateway_interface dbg ~name) gateway_if;
391395
Opt.iter (fun name -> Net.set_dns_interface dbg ~name) dns_if;
392396

393-
(* Setup network infrastructure *)
397+
(* Get network infrastructure configuration *)
394398
let cleanup, bridge_config, interface_config = create_bridges ~__context rc net_rc in
399+
400+
(* Set driver domains *)
401+
List.iter (fun (name, _) ->
402+
Opt.iter (fun uuid -> Net.Bridge.set_driver_domain dbg ~name ~uuid) driver_domain
403+
) bridge_config;
404+
List.iter (fun (name, _) ->
405+
Opt.iter (fun uuid -> Net.Interface.set_driver_domain dbg ~name ~uuid) driver_domain
406+
) interface_config;
407+
408+
(* Make it happen *)
395409
List.iter (fun (name, force) -> Net.Bridge.destroy dbg ~name ~force ()) cleanup;
396410
Net.Bridge.make_config dbg ~config:bridge_config ();
397411
Net.Interface.make_config dbg ~config:interface_config ();
@@ -460,6 +474,13 @@ let bring_pif_up ~__context ?(management_interface=false) (pif: API.ref_PIF) =
460474
let (ethtool_settings, ethtool_offload) = determine_ethtool_settings net_rc.API.network_other_config in
461475
let interface_config = [bridge, {ipv4_conf; ipv4_gateway; ipv6_conf; ipv6_gateway;
462476
ipv4_routes; dns; ethtool_settings; ethtool_offload; mtu; persistent_i=persistent}] in
477+
478+
(* Set driver domains *)
479+
List.iter (fun (name, _) ->
480+
Opt.iter (fun uuid -> Net.Interface.set_driver_domain dbg ~name ~uuid) driver_domain
481+
) interface_config;
482+
483+
(* Make it happen *)
463484
Net.Interface.make_config dbg ~config:interface_config ()
464485
);
465486

0 commit comments

Comments
 (0)