File tree Expand file tree Collapse file tree 2 files changed +18
-9
lines changed Expand file tree Collapse file tree 2 files changed +18
-9
lines changed Original file line number Diff line number Diff line change 2424
2525type context = unit
2626
27+ let network_conf = ref " /etc/xcp/network.conf"
2728let config : config_t ref = ref empty_config
2829
2930let legacy_management_interface_start () =
@@ -396,15 +397,17 @@ module Bridge = struct
396397 config := {! config with bridge_config = update_config ! config.bridge_config name data}
397398
398399 let determine_backend () =
399- let backend = String. strip String. isspace
400- (Unixext. string_of_file (" /etc/xcp/network.conf" )) in
401- match backend with
402- | "openvswitch" | "vswitch" -> kind := Openvswitch
403- | "bridge" -> kind := Bridge
404- | backend ->
405- let error = Printf. sprintf " ERROR: network backend unknown (%s)" backend in
406- debug " %s" error;
407- failwith error
400+ try
401+ let backend = String. strip String. isspace (Unixext. string_of_file ! network_conf) in
402+ match backend with
403+ | "openvswitch" | "vswitch" -> kind := Openvswitch
404+ | "bridge" -> kind := Bridge
405+ | backend ->
406+ warn " Network backend unknown (%s). Falling back to Open vSwitch." backend;
407+ kind := Openvswitch
408+ with _ ->
409+ warn " Network-conf file not found. Falling back to Open vSwitch." ;
410+ kind := Openvswitch
408411
409412 let get_bond_links_up _ dbg ~name =
410413 Debug. with_thread_associated dbg (fun () ->
Original file line number Diff line number Diff line change @@ -22,6 +22,12 @@ open D
2222module Server = Network_interface. Server (Network_server )
2323
2424let resources = [
25+ { Xcp_service. name = " network-conf" ;
26+ description = " used to select the network backend" ;
27+ essential = true ;
28+ path = Network_server. network_conf;
29+ perms = [ Unix. R_OK ];
30+ };
2531 { Xcp_service. name = " brctl" ;
2632 description = " used to set up bridges" ;
2733 essential = true ;
You can’t perform that action at this time.
0 commit comments