search for: human_size

Displaying 20 results from an estimated 91 matches for "human_size".

2015 Jan 22
3
[PATCH 1/2] configure: look for the oUnit OCaml module
It will be used for the OCaml unit tests. --- configure.ac | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/configure.ac b/configure.ac index e0fb481..e360bbb 100644 --- a/configure.ac +++ b/configure.ac @@ -1120,6 +1120,7 @@ AS_IF([test "x$OCAMLC" != "xno"],[ ]) OCAML_PKG_gettext=no +OCAML_PKG_oUnit=no AS_IF([test "x$OCAMLC" != "xno"],[ #
2015 Jan 22
0
[PATCH 2/2] mllib: convert common_utils_tests to oUnit
...~prog 100000_L "+1.1%" = 101100_L); - assert (parse_resize ~prog 100000_L "+1.12%" = 101100_L) + assert_equal_int64 101100_L (parse_resize ~prog 100000_L "+1.1%"); + assert_equal_int64 101100_L (parse_resize ~prog 100000_L "+1.12%") (* Test Common_utils.human_size. *) +let test_human_size () = + assert_equal_string "100" (human_size 100_L); + assert_equal_string "-100" (human_size (-100_L)); + assert_equal_string "1.0K" (human_size 1024_L); + assert_equal_string "-1.0K" (human_size (-1024_L)); + assert_equal_strin...
2014 Sep 08
3
Re: [RFC PATCH] resize: add support for MBR logical partitions some question
...%s: This partition will be deleted.") name > + sprintf (f_"%s: This partition will be deleted.") p.p_name > | OpResize newsize -> > sprintf (f_"%s: This partition will be resized from %s to %s.") > - name (human_size oldsize) (human_size newsize) ^ > + p.p_name (human_size p.p_part.G.part_size) (human_size newsize) ^ > if can_expand_content p.p_type then ( > sprintf (f_" The %s on %s will be expanded using the '%s' method.") >...
2006 May 29
2
Convert bytes to kb or mb in words
Using File.size(myfile) I can get the size of the uploaded file in _bytes_. Does anybody know of a function to convert bytes into a more human readable format? If I had a wish list for a "file_size_in_words()" function, it would do this: 10752 bytes becomes "10.5 Kilobytes". 2213814 bytes becomes "2.1 Megabytes". 238 bytes becomes "Less Than 1 Kilobyte".
2014 Jun 13
3
[PATCH 0/2] sparsify: Add --tmp option to allow specifying temporary directory or block device.
The first patch is just some simple refactoring. See the second patch for a description of the new virt-sparsify --tmp option. I tested this using a loopback device as my temporary block device, and it seems to work fine for me. Federico .. this needs a BZ :-) Rich.
2023 Oct 06
2
[libnbd PATCH 0/2] Improve nbdinfo display of block constraints
...o resync human-size.h back to nbdkit, I'm reluctant to apply patch 1 this until I get Rich's consent to relicensing (this email serves as my consent for my contribution here): https://listman.redhat.com/archives/libguestfs/2023-October/032755.html Eric Blake (2): utils: Slightly simplify human_size() info: Show human sizes for block_size values common/include/human-size.h | 14 ++++++-------- info/show.c | 26 +++++++++++++++++++------- 2 files changed, 25 insertions(+), 15 deletions(-) -- 2.41.0
2015 Oct 20
1
[PATCH v3 07/13] v2v: factor out copying of output data
..., Some actual -> - let pc = - 100. *. Int64.to_float estimate /. Int64.to_float actual - -. 100. in - printf "%s: estimate %Ld (%s) versus actual %Ld (%s): %.1f%%" - t.target_overlay.ov_sd - estimate (human_size estimate) - actual (human_size actual) - pc; - if pc < 0. then printf " ! ESTIMATE TOO LOW !"; - printf "\n%!"; - ); - - t - ) targets - ) (* do_copy *) in + else copy_targets targets input o...
2015 May 11
3
[PATCH 1/2] mllib: Require OUnit2 for tests.
...*) assert_equal_int64 100_L (parse_resize ~prog 100_L "100b"); assert_equal_int64 100_L (parse_resize ~prog 1000_L "100b"); @@ -74,7 +74,7 @@ let test_parse_resize () = assert_equal_int64 101100_L (parse_resize ~prog 100000_L "+1.12%") (* Test Common_utils.human_size. *) -let test_human_size () = +let test_human_size ctx = assert_equal_string "100" (human_size 100_L); assert_equal_string "-100" (human_size (-100_L)); assert_equal_string "1.0K" (human_size 1024_L); @@ -87,7 +87,7 @@ let test_human_size () = assert_equal_...
2014 Jul 16
2
Re: virt-resize: support to MBR logical partitions and some question
On Tue, Jul 15, 2014 at 09:01:47AM +0100, Richard W.M. Jones wrote: > The answer is I don't know. But there are a few things you can try: > > (1) Most importantly, enable tracing (export LIBGUESTFS_TRACE=1) and > get a list of operations that are performed in the order they are > performed. This is vital for debugging this. > > (2) When the error happens, run
2016 May 22
0
[PATCH 2/2] ocaml tools: Use a common debug function.
...xpand %s" (quote lvexpand)) (quote ifile) (quote ofile) in - if verbose () then printf "%s\n%!" cmd; + debug "%s" cmd; if Sys.command cmd <> 0 then exit 1 | itags, `Disk_resize, otags -> @@ -609,7 +609,7 @@ let main () = (human_size osize); let cmd = sprintf "qemu-img resize %s %Ld%s" (quote ofile) osize (if verbose () then "" else " >/dev/null") in - if verbose () then printf "%s\n%!" cmd; + debug "%s" cmd; if Sys.command cmd <> 0 then...
2016 May 22
4
ocaml tools: Use a common debug function.
Add a Common_utils.debug function for printing messages only when in verbose mode. Rich.
2014 Dec 04
2
[PATCH v3 0/2] v2v: When picking a default kernel, favour non-debug
Since v2: - Use string_suffix kernel_name "-debug" || string_suffix kernel_name "-dbg" - This requires addition of the string_suffix function and some tests
2023 Sep 03
5
[PATCH libnbd 0/5] copy: Allow human sizes for --queue-size, etc
See companion patch: Subject: [PATCH nbdkit] server: Move size parsing code (nbdkit_parse_size) to common/include This is the second part of the patch. It adds the new human_size_parse function to libnbd and then uses it for parsing --queue-size, --request-size and --sparse. The main complication here is that there was already a common/utils/human-size.h header which ends up (eventually) being combined with the new header, but the process to get there and ensure that git b...
2014 Jan 22
2
[PATCH] builder: read all the available notes from the index
...Sigchecker.t; diff --git a/builder/list_entries.ml b/builder/list_entries.ml index 7369e6c..742e43b 100644 --- a/builder/list_entries.ml +++ b/builder/list_entries.ml @@ -71,10 +71,10 @@ and list_entries_long ~sources index = printf "%-24s %s\n" (s_"Download size:") (human_size size); ); (match notes with - | None -> () - | Some notes -> + | ("", notes) :: _ -> printf "\n"; printf (f_"Notes:\n\n%s\n") notes + | _ -> () ); printf "\n"...
2014 Sep 19
22
[PATCH v2 00/13] virt-resize: add support for resizing MBR logical partitions
Hi Rich, This is v2 series to add support for resizing MBR logical partitions. I found the reason of problem in v1 that parted reports error when adding logical partitions, is that logical partitions are not aligned to 2 sectors. This problem doesn't appear in v2. This is for early review, because of: 1. I'm not sure the splitting of patches is appropriate or not, but it's much
2014 Jan 16
5
[PATCH 0/3] Add JSON output for virt-builder
Hi, This small patch serie adds a JSON output for virt-builder. This way it is possible to parse the list of available templates, with no need to parse the unstructured and possibly changing short and long outputs of virt-builder. Pino Toscano (3): builder: small refactor of the list output builder: add --list-format builder: add a JSON output for --list builder/builder.ml
2016 Sep 19
0
[PATCH 2/3] mllib: expose disk decrypt functionalities
...+external c_set_echo_keys : unit -> unit = "guestfs_int_mllib_set_echo_keys" "noalloc" +external c_set_keys_from_stdin : unit -> unit = "guestfs_int_mllib_set_keys_from_stdin" "noalloc" + module Char = struct include Char @@ -591,7 +595,7 @@ let human_size i = ) ) -let create_standard_options argspec ?anon_fun usage_msg = +let create_standard_options argspec ?anon_fun ?(key_opts = false) usage_msg = (** Install an exit hook to check gc consistency for --debug-gc *) let set_debug_gc () = at_exit (fun () -> Gc.compact()) in @@ -...
2015 Nov 10
1
[PATCH] OCaml tools: use open_guestfs everywhere
...in.ml | 4 +--- v2v/v2v.ml | 6 +++--- 10 files changed, 19 insertions(+), 43 deletions(-) diff --git a/builder/builder.ml b/builder/builder.ml index feb6e0d..2c51550 100644 --- a/builder/builder.ml +++ b/builder/builder.ml @@ -570,9 +570,7 @@ let main () = (human_size osize); let preallocation = if oformat = "qcow2" then Some "metadata" else None in let () = - let g = new G.guestfs () in - if trace () then g#set_trace true; - if verbose () then g#set_verbose true; + let g = open_guestfs () in...
2015 Aug 11
41
[PATCH v2 00/17] v2v: add --in-place mode
This series is a second attempt to add a mode of virt-v2v operation where it leaves the config and disk image conversion, rollback on errors, registering with the destination hypervisor, etc. to a third-party toolset, and performs only tuning of the guest OS to run in the KVM-based hypervisor. The first 14 patches are just refactoring and rearrangement of the code, factoring the implementation
2018 Aug 21
0
[PATCH 2/2] OCaml tools: add output selection for --machine-readable
...ot;; + machine_readable_printf "virt-builder-repository\n"; exit 0 ); diff --git a/common/mltools/tools_utils.ml b/common/mltools/tools_utils.ml index 920977e42..271e7d55f 100644 --- a/common/mltools/tools_utils.ml +++ b/common/mltools/tools_utils.ml @@ -229,10 +229,60 @@ let human_size i = ) ) +type machine_readable_output_type = + | NoOutput + | Channel of out_channel + | File of string +let machine_readable_output = ref NoOutput +let machine_readable_channel = ref None +let machine_readable_printf fs = + let get_machine_readable_channel () = + let open_machine_...