@@ -47,13 +47,6 @@ let table_of_vg vg =
4747 [ " free_space" ; Int64. to_string (Pv.Allocator. size vg.Vg. free_space) ];
4848]
4949
50- let lvs config =
51- set_uri config None ;
52- Lwt_main. run
53- (Client. get () >> = fun vg ->
54- print_table true [ " key" ; " value" ] (table_of_vg vg);
55- Lwt. return () )
56-
5750let format config name filenames =
5851 let t =
5952 let module Vg_IO = Vg. Make (Log )(Block )(Time )(Clock ) in
@@ -145,8 +138,8 @@ let host_list copts (vg_name,_) =
145138 fromLVM @ toLVM @ [ [ " freeExtents" ; Int64. to_string h.freeExtents ] ] in
146139 List. map (fun h -> add_prefix h.name (table_of_host h)) hosts
147140 |> List. concat
148- |> print_table true [ " key" ; " value" ];
149- return ( ) in
141+ |> print_table true [ " key" ; " value" ]
142+ |> Lwt_list. iter_s ( fun x -> stdout " %s " x ) in
150143 Lwt_main. run t
151144
152145let shutdown copts (vg_name ,_ ) =
@@ -162,7 +155,8 @@ let shutdown copts (vg_name,_) =
162155 (fun () ->
163156 Client.Host. all ()
164157 >> = fun _ ->
165- Printf. fprintf stderr " Xenvmd is still alive: will sleep 5s and try again\n %!" ;
158+ stderr " Xenvmd is still alive: will sleep 5s and try again"
159+ >> = fun () ->
166160 Lwt_unix. sleep 5.
167161 ) (fun _ ->
168162 finished := true ;
@@ -184,8 +178,9 @@ let benchmark copts (vg_name,_) =
184178 | n ->
185179 f n
186180 >> = fun () ->
187- if ((n * 100 ) / number) <> (((n + 1 ) * 100 ) / number)
188- then Printf. fprintf stderr " %s %d %% complete\n %!" test_name (100 - (n * 100 ) / number);
181+ ( if ((n * 100 ) / number) <> (((n + 1 ) * 100 ) / number)
182+ then stderr " %s %d %% complete\n %!" test_name (100 - (n * 100 ) / number)
183+ else return () ) >> = fun () ->
189184 fori test_name ((number - n, Unix. gettimeofday () -. start) :: acc) f (n - 1 ) in
190185 fori " Creating volumes" [] (fun i -> Client. create ~name: (Printf. sprintf " test-lv-%d" i) ~size: mib ~tags: [] ) number
191186 >> = fun creates ->
@@ -205,8 +200,9 @@ let benchmark copts (vg_name,_) =
205200 Lwt_main. run t
206201
207202let help config =
208- Printf. printf " help - %s %s\n " config.config (match config.uri_override with | Some u -> u | None -> " URI unset" )
209-
203+ Lwt_main. run (
204+ stdout " help - %s %s" config.config (match config.uri_override with | Some u -> u | None -> " URI unset" )
205+ )
210206
211207open Cmdliner
212208let info =
@@ -242,17 +238,6 @@ let size =
242238 let doc = " Size of the LV in megs" in
243239 Arg. (value & opt int64 4L & info [" size" ] ~docv: " SIZE" ~doc )
244240
245-
246- let lvs_cmd =
247- let doc = " List the logical volumes in the VG" in
248- let man = [
249- `S " DESCRIPTION" ;
250- `P " Contacts the XenVM LVM daemon and retreives a list of
251- all of the currently defined logical volumes" ;
252- ] in
253- Term. (pure lvs $ copts_t),
254- Term. info " lvs" ~sdocs: copts_sect ~doc ~man
255-
256241let format_cmd =
257242 let doc = " Format the specified file as a VG" in
258243 let man = [
@@ -377,6 +362,8 @@ let cmds = [
377362
378363let () =
379364 Random. self_init () ;
365+ Lwt_main. run (
366+ Lwt_log. log ~logger: syslog ~level: Lwt_log. Notice (String. concat " " (Array. to_list Sys. argv))
367+ );
380368 match Term. eval_choice default_cmd cmds with
381369 | `Error _ -> exit 1 | _ -> exit 0
382-
0 commit comments