Skip to content

Commit 75fb572

Browse files
committed
Merge pull request #56 from sharady/xcp-networkd-fcoe
CP-12093: Add fcoe_driver interface to identify FCoE supported NICs
2 parents 7becd79 + ce16445 commit 75fb572

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

lib/network_utils.ml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ let modprobe = "/sbin/modprobe"
3333
let ethtool = ref "/sbin/ethtool"
3434
let bonding_dir = "/proc/net/bonding/"
3535
let dhcp6c = "/sbin/dhcp6c"
36+
let fcoedriver = ref "/opt/xensource/libexec/fcoe_driver"
3637

3738
let call_script ?(log_successful_output=false) script args =
3839
try
@@ -546,6 +547,19 @@ module Dhclient = struct
546547
end
547548
end
548549

550+
module Fcoe = struct
551+
let call ?(log=false) args =
552+
call_script ~log_successful_output:log !fcoedriver args
553+
554+
let get_capabilities name =
555+
try
556+
let output = call ["--xapi"; name; "capable"] in
557+
if String.has_substr output "True" then ["fcoe"] else []
558+
with _ ->
559+
debug "Failed to get fcoe support status on device %s" name;
560+
[]
561+
end
562+
549563
module Sysctl = struct
550564
let write value variable =
551565
ignore (call_script ~log_successful_output:true sysctl ["-q"; "-w"; variable ^ "=" ^ value])

networkd/network_server.ml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,11 @@ module Interface = struct
317317
Ethtool.set_offload name params
318318
) ()
319319

320+
let get_capabilities _ dbg ~name =
321+
Debug.with_thread_associated dbg (fun () ->
322+
Fcoe.get_capabilities name
323+
) ()
324+
320325
let is_connected _ dbg ~name =
321326
Debug.with_thread_associated dbg (fun () ->
322327
Sysfs.get_carrier name

networkd/networkd.ml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ let resources = [
4040
essential = true;
4141
path = Network_utils.ethtool;
4242
perms = [ Unix.X_OK ];
43+
};
44+
{ Xcp_service.name = "fcoedriver";
45+
description = "used to identify fcoe interfaces";
46+
essential = false;
47+
path = Network_utils.fcoedriver;
48+
perms = [ Unix.X_OK ];
4349
}
4450
]
4551

0 commit comments

Comments
 (0)