Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Set driver domain when plugging a PIF

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
  • Loading branch information...
commit 0c14d1a9abe80ab8f7b3a5fab9a7a878712f91fa 1 parent bdb59b3
@robhoes authored
Showing with 22 additions and 1 deletion.
  1. +22 −1 ocaml/xapi/nm.ml
View
23 ocaml/xapi/nm.ml
@@ -369,6 +369,10 @@ let bring_pif_up ~__context ?(management_interface=false) (pif: API.ref_PIF) =
let rc = Db.PIF.get_record ~__context ~self:pif in
let net_rc = Db.Network.get_record ~__context ~self:rc.API.pIF_network in
let bridge = net_rc.API.network_bridge in
+ let driver_domain =
+ Opt.map (fun self -> Db.VM.get_uuid ~__context ~self)
+ (Network.get_driver_domain ~__context pif)
+ in
(* Call networkd even if currently_attached is false, just to update its state *)
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) =
Opt.iter (fun name -> Net.set_gateway_interface dbg ~name) gateway_if;
Opt.iter (fun name -> Net.set_dns_interface dbg ~name) dns_if;
- (* Setup network infrastructure *)
+ (* Get network infrastructure configuration *)
let cleanup, bridge_config, interface_config = create_bridges ~__context rc net_rc in
+
+ (* Set driver domains *)
+ List.iter (fun (name, _) ->
+ Opt.iter (fun uuid -> Net.Bridge.set_driver_domain dbg ~name ~uuid) driver_domain
+ ) bridge_config;
+ List.iter (fun (name, _) ->
+ Opt.iter (fun uuid -> Net.Interface.set_driver_domain dbg ~name ~uuid) driver_domain
+ ) interface_config;
+
+ (* Make it happen *)
List.iter (fun (name, force) -> Net.Bridge.destroy dbg ~name ~force ()) cleanup;
Net.Bridge.make_config dbg ~config:bridge_config ();
Net.Interface.make_config dbg ~config:interface_config ();
@@ -460,6 +474,13 @@ let bring_pif_up ~__context ?(management_interface=false) (pif: API.ref_PIF) =
let (ethtool_settings, ethtool_offload) = determine_ethtool_settings net_rc.API.network_other_config in
let interface_config = [bridge, {ipv4_conf; ipv4_gateway; ipv6_conf; ipv6_gateway;
ipv4_routes; dns; ethtool_settings; ethtool_offload; mtu; persistent_i=persistent}] in
+
+ (* Set driver domains *)
+ List.iter (fun (name, _) ->
+ Opt.iter (fun uuid -> Net.Interface.set_driver_domain dbg ~name ~uuid) driver_domain
+ ) interface_config;
+
+ (* Make it happen *)
Net.Interface.make_config dbg ~config:interface_config ()
);
Please sign in to comment.
Something went wrong with that request. Please try again.