Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions networkd/network_server.ml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ open D

type context = unit

let network_conf = ref "/etc/xcp/network.conf"
let config : config_t ref = ref empty_config

let legacy_management_interface_start () =
Expand Down Expand Up @@ -396,15 +397,17 @@ module Bridge = struct
config := {!config with bridge_config = update_config !config.bridge_config name data}

let determine_backend () =
let backend = String.strip String.isspace
(Unixext.string_of_file ("/etc/xcp/network.conf")) in
match backend with
| "openvswitch" | "vswitch" -> kind := Openvswitch
| "bridge" -> kind := Bridge
| backend ->
let error = Printf.sprintf "ERROR: network backend unknown (%s)" backend in
debug "%s" error;
failwith error
try
let backend = String.strip String.isspace (Unixext.string_of_file !network_conf) in
match backend with
| "openvswitch" | "vswitch" -> kind := Openvswitch
| "bridge" -> kind := Bridge
| backend ->
warn "Network backend unknown (%s). Falling back to Open vSwitch." backend;
kind := Openvswitch
with _ ->
warn "Network-conf file not found. Falling back to Open vSwitch.";
kind := Openvswitch

let get_bond_links_up _ dbg ~name =
Debug.with_thread_associated dbg (fun () ->
Expand Down
6 changes: 6 additions & 0 deletions networkd/networkd.ml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ open D
module Server = Network_interface.Server(Network_server)

let resources = [
{ Xcp_service.name = "network-conf";
description = "used to select the network backend";
essential = true;
path = Network_server.network_conf;
perms = [ Unix.R_OK ];
};
{ Xcp_service.name = "brctl";
description = "used to set up bridges";
essential = true;
Expand Down