]> xenbits.xensource.com Git - xcp/xen-api.git/commitdiff
SCTX-525: only write the names of interfaces ("current interfaces") into the inventor...
authorDavid Scott <dave.scott@eu.citrix.com>
Wed, 26 Jan 2011 17:39:04 +0000 (17:39 +0000)
committerDavid Scott <dave.scott@eu.citrix.com>
Wed, 26 Jan 2011 17:39:04 +0000 (17:39 +0000)
Stats:
* 5 host pool
* 300 VLANs, none used
Pool reboot time drops from 45 mins to 8 mins

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
ocaml/xapi/nm.ml
ocaml/xapi/nm.mli
ocaml/xapi/xapi_pif.ml

index 76f67a3e079bb43f988243459e10caddd0351d08..cf75fc63a2a117315e959fa79d7b0fb95c5ce75a 100644 (file)
@@ -23,14 +23,24 @@ let with_local_lock f = Mutex.execute local_m f
 
 let interface_reconfigure_script = "/opt/xensource/libexec/interface-reconfigure"
 
+(* A "dom0 interface" is an IP-enabled interface on _dom0_ which might be
+   being used (via some route in the routing table) for access to storage
+   which we need to be able to see on startup before xapi has initialised *)
+let is_dom0_interface pif_r = pif_r.API.pIF_ip_configuration_mode <> `None
+               
 (* Make sure inventory file has all current interfaces on the local host, so
  * they will all be brought up again at start up. *)
 let update_inventory ~__context =
-  let pifs = List.filter (fun pif -> Db.PIF.get_currently_attached ~__context ~self:pif && 
-    Db.PIF.get_host ~__context ~self:pif = Helpers.get_localhost ~__context) (Db.PIF.get_all ~__context) in
-  let get_netw pif = Db.PIF.get_network ~__context ~self:pif in
-  let bridges = List.map (fun pif -> Db.Network.get_bridge ~__context ~self:(get_netw pif)) pifs in
-  Xapi_inventory.update Xapi_inventory._current_interfaces (String.concat " " bridges)
+       let localhost = Helpers.get_localhost ~__context in
+       let pifs = List.filter 
+               (fun (pif, pif_r) -> 
+                       true &&
+                               pif_r.API.pIF_host = localhost &&
+                               is_dom0_interface pif_r &&
+                               pif_r.API.pIF_currently_attached)
+               (Db.PIF.get_all_records ~__context) in
+       let bridges = List.map (fun (_, pif_r) -> Db.Network.get_bridge ~__context ~self:pif_r.API.pIF_network) pifs in
+       Xapi_inventory.update Xapi_inventory._current_interfaces (String.concat " " bridges)
 
 (* Call the interface reconfigure script. For development ignore the exn if it doesn't exist *)
 let reconfigure_pif ~__context (pif: API.ref_PIF) args = 
index f4ca67c8463f6124fd236eeec0c850c99718aa42..63ed3d2cd49ca8e4dae9a92f497d221fce839a1c 100644 (file)
@@ -27,3 +27,7 @@ val bring_pif_down : __context:Context.t -> API.ref_PIF -> unit
 
 (** Execute a given function under the control of a mutex *)
 val with_local_lock : (unit -> 'a) -> 'a
+
+(** [is_dom0_interface pif_r] returns true if pif_r is a network interface 
+       which has a dom0 endpoint *)
+val is_dom0_interface : API.pIF_t -> bool
index 2bf0ea44e31a6f5e211266eeeda2604892f66edb..b306ed6b60a935d412319aba045abe31b3171920 100644 (file)
@@ -494,10 +494,12 @@ let rec plug ~__context ~self =
   Xapi_network.attach ~__context ~network ~host
    
 let calculate_pifs_required_at_start_of_day ~__context =
-  List.filter (fun (_,pifr) -> 
-    true
-    && (pifr.API.pIF_host = !Xapi_globs.localhost_ref) (* this host only *)
-    && not (Db.is_valid_ref pifr.API.pIF_bond_slave_of) (* not enslaved by a bond *)
+       let localhost = Helpers.get_localhost ~__context in
+       List.filter (fun (_,pifr) -> 
+               true &&
+               pifr.API.pIF_host = localhost && (* this host only *)
+               Nm.is_dom0_interface pifr &&
+               not (Db.is_valid_ref pifr.API.pIF_bond_slave_of) (* not enslaved by a bond *)
   )
     (Db.PIF.get_all_records ~__context)