@@ -249,7 +249,7 @@ module Sysfs = struct
249249 |> (fun p -> try read_one_line p |> duplex_of_string with _ -> Duplex_unknown )
250250 in (speed, duplex)
251251
252- let get_dev_nums_with_same_driver driver =
252+ let get_dev_nums_with_same_driver driver =
253253 try
254254 Sys. readdir (" /sys/bus/pci/drivers/" ^ driver)
255255 |> Array. to_list
@@ -264,7 +264,7 @@ module Sysfs = struct
264264 Result. Ok devices.(0 )
265265 with _ -> Result. Error (Parent_device_of_vf_not_found , " Can not get parent device for " ^ pcibuspath)
266266
267- let get_child_vfs_sysfs_paths dev =
267+ let get_child_vfs_sysfs_paths dev =
268268 try
269269 let device_path = getpath dev " device" in
270270 Result. Ok (
@@ -279,7 +279,7 @@ module Sysfs = struct
279279 try
280280 let open Rresult.R.Infix in
281281 get_child_vfs_sysfs_paths parent_dev >> = fun paths ->
282- let group =
282+ let group =
283283 List. find (fun x -> Astring.String. is_infix ~affix: pcibuspath (Unix. readlink x)) paths
284284 |> Re. exec_opt (Re.Perl. compile_pat " virtfn(\\ d+)" )
285285 in
@@ -291,25 +291,25 @@ module Sysfs = struct
291291 let unbind_child_vfs dev =
292292 let open Rresult.R.Infix in
293293 let unbind vf_path =
294- let driver_name =
294+ let driver_name =
295295 try
296296 Unix. readlink (Filename. concat vf_path " driver" )
297297 |> Filename. basename
298- with _ -> " "
298+ with _ -> " "
299299 and vf_pcibuspath =
300300 Unix. readlink vf_path
301301 |> Filename. basename
302302 in
303303 if driver_name = " " then Result. Ok () (* not bind to any driver, Ok *)
304304 else begin
305- debug " unbinding %s from driver %s at %s" vf_path driver_name vf_pcibuspath;
305+ debug " unbinding %s from driver %s at %s" vf_path driver_name vf_pcibuspath;
306306 let unbind_interface = Filename. concat vf_path " driver/unbind"
307307 and remove_slot_interface = Filename. concat vf_path " driver/remove_slot" in
308308 begin try
309309 write_one_line remove_slot_interface vf_pcibuspath
310310 with _ -> ()
311311 end ;
312- try
312+ try
313313 write_one_line unbind_interface vf_pcibuspath; Result. Ok ()
314314 with _ -> Result. Error (Fail_to_unbind_from_driver , Printf. sprintf " %s: VF Fail to be unbound from driver %s" vf_path driver_name)
315315 end
@@ -320,15 +320,15 @@ module Sysfs = struct
320320 let get_sriov_numvfs dev =
321321 try
322322 getpath dev " device/sriov_numvfs"
323- |> read_one_line
323+ |> read_one_line
324324 |> String. trim
325325 |> int_of_string
326326 with _ -> 0
327327
328328 let get_sriov_maxvfs dev =
329329 try
330330 Ok (getpath dev " device/sriov_totalvfs"
331- |> read_one_line
331+ |> read_one_line
332332 |> String. trim
333333 |> int_of_string)
334334 with _ -> Error (Fail_to_get_maxvfs , " Failed to get maxvfs from sysfs interface for device: " ^ dev)
@@ -501,7 +501,7 @@ module Ip = struct
501501 ignore (call [mode; " addr" ; " flush" ; " dev" ; dev])
502502 with _ -> ()
503503
504- let del_ip_addr dev (ip , prefixlen ) =
504+ let del_ip_addr dev (ip , prefixlen ) =
505505 let addr = Printf. sprintf " %s/%d" (Unix. string_of_inet_addr ip) prefixlen in
506506 try
507507 Sysfs. assert_exists dev;
@@ -745,8 +745,8 @@ module Dhclient = struct
745745 let [@ warning " -27" ] generate_conf ?(ipv6= false ) interface options =
746746 let minimal = [" subnet-mask" ; " broadcast-address" ; " time-offset" ; " host-name" ; " nis-domain" ;
747747 " nis-servers" ; " ntp-servers" ; " interface-mtu" ] in
748- let set_gateway =
749- if List. mem (`gateway interface) options
748+ let set_gateway =
749+ if List. mem (`gateway interface) options
750750 then (debug " %s is the default gateway interface" interface; [" routers" ])
751751 else (debug " %s is NOT the default gateway interface" interface; [] )
752752 in
@@ -769,9 +769,9 @@ module Dhclient = struct
769769 (* but some buggy DHCP servers ignore this *)
770770 (* See CA-137892 *)
771771 let gw_opt = List. fold_left
772- (fun l x ->
773- match x with
774- | `gateway y -> [" -e" ; " GATEWAYDEV=" ^ y]
772+ (fun l x ->
773+ match x with
774+ | `gateway y -> [" -e" ; " GATEWAYDEV=" ^ y]
775775 | _ -> l) [] options in
776776 write_conf_file ~ipv6 interface options;
777777 let ipv6' = if ipv6 then [" -6" ] else [] in
@@ -1090,9 +1090,9 @@ module Ovs = struct
10901090 let get_bridge_vlan_vifs ~name =
10911091 try
10921092 let vlan_fake_bridges = get_vlans name in
1093- List. fold_left(fun vifs br ->
1093+ List. fold_left(fun vifs br ->
10941094 let vifs' = bridge_to_interfaces br in
1095- vifs' @ vifs) [] vlan_fake_bridges
1095+ vifs' @ vifs) [] vlan_fake_bridges
10961096 with _ -> []
10971097
10981098 let get_mcast_snooping_enable ~name =
@@ -1387,20 +1387,20 @@ module Modprobe = struct
13871387 Result. Ok ()
13881388 with _ -> Result. Error (Fail_to_write_modprobe_cfg , " Failed to write modprobe configuration file for: " ^ driver)
13891389
1390- (*
1391- For a igb driver, the module config file will be at path `/etc/modprobe.d/igb.conf`
1392- The module config file is like:
1393- # VFs-param: max_vfs
1394- # VFs-maxvfs-by-default: 7
1395- # VFs-maxvfs-by-user:
1396- options igb max_vfs=7,7
1397-
1398- Example of calls:
1399- "igb" -> "VFs-param" -> Some "max_vfs"
1400- "igb" -> "VFs-maxvfs-by-default" -> Some "7"
1401- "igb" -> "VFs-maxvfs-by-user" -> None
1402- "igb" -> "Not existed comments" -> None
1403- *)
1390+ (*
1391+ For a igb driver, the module config file will be at path `/etc/modprobe.d/igb.conf`
1392+ The module config file is like:
1393+ # VFs-param: max_vfs
1394+ # VFs-maxvfs-by-default: 7
1395+ # VFs-maxvfs-by-user:
1396+ options igb max_vfs=7,7
1397+
1398+ Example of calls:
1399+ "igb" -> "VFs-param" -> Some "max_vfs"
1400+ "igb" -> "VFs-maxvfs-by-default" -> Some "7"
1401+ "igb" -> "VFs-maxvfs-by-user" -> None
1402+ "igb" -> "Not existed comments" -> None
1403+ *)
14041404 let get_config_from_comments driver =
14051405 try
14061406 let open Xapi_stdext_std.Listext in
@@ -1428,12 +1428,12 @@ module Modprobe = struct
14281428 with _ -> None
14291429
14301430 let get_maxvfs driver config =
1431- let get_default_maxvfs config =
1431+ let get_default_maxvfs config =
14321432 try
14331433 Some (List. assoc " VFs-maxvfs-by-default" config |> int_of_string)
14341434 with _ -> None
14351435 in
1436- let get_user_defined_maxvfs config =
1436+ let get_user_defined_maxvfs config =
14371437 try
14381438 Some (List. assoc " VFs-maxvfs-by-user" config |> int_of_string)
14391439 with _ -> None
@@ -1461,8 +1461,8 @@ module Modprobe = struct
14611461 end >> = fun option ->
14621462 let need_rebuild_initrd = ref false in
14631463 let has_probe_conf = ref false in
1464- let parse_single_line s =
1465- let parse_driver_options s =
1464+ let parse_single_line s =
1465+ let parse_driver_options s =
14661466 match Astring.String. cut ~sep: " =" s with
14671467 (* has SR-IOV configuration but the max_vfs is exactly what we want to set, so no changes and return s *)
14681468 | Some (k , v ) when k = vf_param && v = option -> has_probe_conf := true ; s
@@ -1489,7 +1489,7 @@ module Modprobe = struct
14891489 | true , true ->
14901490 write_conf_file driver new_conf >> = fun () ->
14911491 Dracut. rebuild_initrd ()
1492- | false , false ->
1492+ | false , false ->
14931493 let new_option_line = Printf. sprintf " options %s %s=%s" driver vf_param option in
14941494 write_conf_file driver (new_conf @ [new_option_line]) >> = fun () ->
14951495 Dracut. rebuild_initrd ()
0 commit comments