search for: string_of_doc

Displaying 20 results from an estimated 87 matches for "string_of_doc".

2015 Jan 23
0
[PATCH 2/2] mllib: add simple tests for the JSON module
...Fifth Floor, Boston, MA 02110-1301 USA. + *) + +(* This file tests the JSON module. *) + +open OUnit + +(* Utils. *) +let assert_equal_string = assert_equal ~printer:(fun x -> x) + +(* "basic" suite. *) +let test_empty () = + let doc = [] in + assert_equal_string "{}" (JSON.string_of_doc doc); + assert_equal_string "{ +}" (JSON.string_of_doc ~fmt:JSON.Indented doc) + +let test_string () = + let doc = [ "test_string", JSON.String "foo"; ] in + assert_equal_string "{ \"test_string\": \"foo\" }" + (JSON.string_of_doc do...
2015 Jan 23
2
[PATCH 1/2] mllib: tests: add tests for string_lines_split
--- mllib/common_utils_tests.ml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/mllib/common_utils_tests.ml b/mllib/common_utils_tests.ml index 09d5c51..283e9a1 100644 --- a/mllib/common_utils_tests.ml +++ b/mllib/common_utils_tests.ml @@ -27,6 +27,7 @@ let prog = "common_utils_tests" let assert_equal_string = assert_equal ~printer:(fun x -> x) let
2015 May 11
3
[PATCH 1/2] mllib: Require OUnit2 for tests.
...+18,19 @@ (* This file tests the JSON module. *) -open OUnit +open OUnit2 (* Utils. *) let assert_equal_string = assert_equal ~printer:(fun x -> x) (* "basic" suite. *) -let test_empty () = +let test_empty ctx = let doc = [] in assert_equal_string "{}" (JSON.string_of_doc doc); assert_equal_string "{ }" (JSON.string_of_doc ~fmt:JSON.Indented doc) -let test_string () = +let test_string ctx = let doc = [ "test_string", JSON.String "foo"; ] in assert_equal_string "{ \"test_string\": \"foo\" }"...
2018 May 21
1
[PATCH] v2v: -o null: support older qemu-img (RHBZ#1580309)
...4; + + let json = [ + "file.driver", JSON.String "null-co"; + "file.size", JSON.String "1E"; + ] in + + let cmd = + sprintf "qemu-img convert -n -f raw -O raw %s json:%s >/dev/null%s" + (quote tmp) + (quote (JSON.string_of_doc ~fmt:JSON.Compact json)) + (if verbose () then "" else " 2>&1") in + debug "%s" cmd; + let r = 0 = Sys.command cmd in + Unix.unlink tmp; + debug "qemu-img supports the null-co device: %b" r; + r + class output_null = + (* Create a tem...
2014 Oct 10
4
[PATCH 1/3] Move JSON to mllib
...t;\012" "\\f" in + let str = replace_str str "\n" "\\n" in + let str = replace_str str "\r" "\\r" in + let str = replace_str str "\t" "\\t" in + let str = replace_str str "\011" "\\v" in + str + +let string_of_doc fields = + "{ " ^ + String.concat ", " ( + List.map ( + function + | (n, String v) -> + sprintf "\"%s\" : \"%s\"" n (json_quote v) + | (n, Int v) -> + sprintf "\"%s\" : %d" n...
2019 Oct 09
3
[PATCH] v2v: Output saved overlays in a machine-readable fashion
...) filenames + | Some {pr} -> + let json = [ + "type", JSON.String "data"; + "data", JSON.Dict [ + "saved_overlays", + JSON.List (List.map (fun s -> JSON.String s) filenames); + ] + ] in + pr "%s\n" (JSON.string_of_doc json) (* Request guest caps based on source configuration. *) and rcaps_from_source source = -- 2.23.0
2017 Feb 06
3
[PATCH] v2v: ova: Don't rely on qemu-img version, test "offset" and
Not tested yet, am running the tests now. Rich.
2019 Apr 01
2
[PATCH] OCaml tools: fix 3999 -> 3339 typo
...let json = [ "message", JSON.String msg; - "timestamp", JSON.String (c_rfc3999_date_time_string ()); + "timestamp", JSON.String (c_rfc3339_date_time_string ()); "type", JSON.String msgtype; ] in pr "%s\n" (JSON.string_of_doc ~fmt:JSON.Compact json) diff --git a/lib/guestfs.pod b/lib/guestfs.pod index 3c1d635c5..af944ddb7 100644 --- a/lib/guestfs.pod +++ b/lib/guestfs.pod @@ -3295,7 +3295,7 @@ within a single line, below it is indented for readability): C<type> can be: C<message> for progress messages, C&lt...
2018 Aug 20
6
[PATCH 0/4] mltools: JSON unification
An evolution of: https://www.redhat.com/archives/libguestfs/2018-August/msg00155.html
2016 May 22
0
[PATCH 2/2] ocaml tools: Use a common debug function.
...or_if_libvirt_backend (); error_if_no_ssh_agent (); @@ -88,8 +87,7 @@ object | None -> json_params | Some user -> ("file.user", JSON.String user) :: json_params in - if verbose () then - printf "ssh: json parameters: %s\n" (JSON.string_of_doc json_params); + debug "ssh: json parameters: %s" (JSON.string_of_doc json_params); (* Turn the JSON parameters into a 'json:' protocol string. *) let qemu_uri = "json: " ^ JSON.string_of_doc json_params in diff --git a/v2v/input_libvirtxml.ml b...
2019 Oct 10
0
Re: [PATCH] v2v: Output saved overlays in a machine-readable fashion
...let json = [ > + "type", JSON.String "data"; > + "data", JSON.Dict [ > + "saved_overlays", > + JSON.List (List.map (fun s -> JSON.String s) filenames); > + ] > + ] in > + pr "%s\n" (JSON.string_of_doc json) > > (* Request guest caps based on source configuration. *) > and rcaps_from_source source = > -- > 2.23.0 -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is...
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.
2019 Sep 16
0
[PATCH 6/8] v2v: -o rhv-upload: collect disks UUIDs right after copy
...None + (* List of disk UUIDs. *) + val mutable disks_uuids = [] method precheck () = Python_script.error_unless_python_interpreter_found (); @@ -374,23 +376,21 @@ If the messages above are not sufficient to diagnose the problem then add the TargetURI ("json:" ^ JSON.string_of_doc json_params) ) overlays - method create_metadata source targets _ guestcaps inspect target_firmware = - (* Get the UUIDs of each disk image. These files are written - * out by the nbdkit plugins on successful finalization of the + method disk_copied t i nr_disks = + (* Get the U...
2018 Aug 24
0
[PATCH v6] v2v: Add --print-estimate option to print copy size estimate.
...han in + if run_command ~stdout_fd:fd !cmd <> 0 then + error (f_"qemu-img measure failed, see earlier errors"); + (* Note that run_command closes fd. *) + + let json = json_parser_tree_parse_file json in + debug "qemu-img measure output parsed as: %s" + (JSON.string_of_doc ~fmt:JSON.Indented ["", json]); + + (* We're expecting the tree to contain nodes: + * Dict [ "required", Int number; "fully-allocated", Int number ] + * Of course the array could appear in any order. + *) + object_get_number "required" json diff -...
2018 Aug 23
0
[PATCH v5] v2v: Add --print-estimate option to print copy size estimate.
...measure failed, see earlier errors"); + (* Note that run_command closes fd. *) + + let json = read_whole_file json in + debug "qemu-img measure output: %s" json; + let json = json_parser_tree_parse json in + debug "qemu-img measure output parsed as: %s" + (JSON.string_of_doc ~fmt:JSON.Indented ["", json]); + + (* We're expecting the tree to contain nodes: + * Dict [ "required", Int number; "fully-allocated", Int number ] + * Of course the array could appear in any order. + *) + object_get_number "required" json diff -...
2019 Mar 25
1
Re: [PATCH 2/4] common/mltools: make sure machine readable output is flushed
On Fri, Mar 22, 2019 at 04:33:41PM +0100, Pino Toscano wrote: > Enhance the helper printf function for machine readable output to always > flush after each string: this way, readers of the machine readable > stream can get the output as soon as it is outputted. > --- > common/mltools/tools_utils.ml | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff
2018 Aug 24
2
[PATCH v6] v2v: Add --print-estimate option to print copy size estimate.
v6: - Make the text output a bit nicer. - Changes as suggested to Measure_disk module temp file & json parsing. - Use jq to test JSON output. - Retest.
2017 Feb 06
0
[PATCH] v2v: ova: Don't rely on qemu-img version, test "offset" and "size" features.
..."size", JSON.Int 512; + "file", JSON.Dict [ + "filename", JSON.String tmp2 + ] + ] + ] in + + let cmd = + sprintf "qemu-img create %s -f qcow2 -b 'json:%s'%s" + (quote tmp1) + (quote (JSON.string_of_doc ~fmt:JSON.Compact json)) + (if verbose () then "" else " >/dev/null 2>&1") in + + let r = Sys.command cmd in + + Unix.unlink tmp1; + Unix.unlink tmp2; + + r = 0 let find_file_in_tar tar filename = let lines = external_command (sprintf "tar tRv...
2018 Aug 23
2
[PATCH v5] v2v: Add --print-estimate option to print copy size estimate.
v5: - Normal output modified approx as suggested in previous email. - Machine readable output uses JSON.
2017 Dec 07
1
[PATCH] v2v: -o null: Use the qemu null device driver.
...dir // t.target_overlay.ov_sd in - { t with target_file = target_file } - ) targets + let json_params = [ + "file.driver", JSON.String "null-co"; + "file.size", JSON.String "1E"; + ] in + let target_file = "json:" ^ JSON.string_of_doc json_params in + (* XXX It's not really right to set target_format here, but + * it works. + *) + let target_format = "raw" in + List.map (fun t -> { t with target_file; target_format }) targets method create_metadata _ _ _ _ _ _ = () + + (* Stops the main pr...