search for: get_image_infos

Displaying 15 results from an estimated 15 matches for "get_image_infos".

2017 Oct 27
0
[PATCH v11 4/8] builder: add Utils.get_image_infos function
...\ languages.ml \ cache.ml \ diff --git a/builder/utils.ml b/builder/utils.ml index acb6c2f4b..9fceee282 100644 --- a/builder/utils.ml +++ b/builder/utils.ml @@ -33,3 +33,9 @@ and revision = let string_of_revision = function | Rev_int n -> string_of_int n | Rev_string s -> s + +let get_image_infos filepath = + let qemuimg_cmd = "qemu-img info --output json " ^ (Std_utils.quote filepath) in + let lines = external_command qemuimg_cmd in + let line = String.concat "\n" lines in + Yajl.yajl_tree_parse line diff --git a/builder/utils.mli b/builder/utils.mli index 45385f713...
2018 Aug 17
0
[PATCH v3 1/4] mltools: Rename Yajl module as JSON_parser and move to common/mltools.
...b..59fa5097d 100644 --- a/builder/index_parser.ml +++ b/builder/index_parser.ml @@ -140,7 +140,7 @@ let get_index ~downloader ~sigchecker ?(template = false) { Sources.uri; proxy } match detect_file_type filepath with | `Unknown -> let infos = Utils.get_image_infos filepath in - Yajl.object_get_number "virtual-size" infos + JSON_parser.object_get_number "virtual-size" infos | `XZ | `GZip | `Tar | ` Zip -> eprintf (f_"%s: cannot determine the virtual size of %s due to com...
2018 Aug 20
6
[PATCH 0/4] mltools: JSON unification
An evolution of: https://www.redhat.com/archives/libguestfs/2018-August/msg00155.html
2018 Aug 20
0
[PATCH 4/4] mltools: JSON: unify JSON_parser type with JSON.json_t.
...alse } ] }" ]; then diff --git a/builder/utils.mli b/builder/utils.mli index 5dde43a01..c7631636c 100644 --- a/builder/utils.mli +++ b/builder/utils.mli @@ -29,7 +29,7 @@ and revision = val string_of_revision : revision -> string (** Convert a {!revision} into a string. *) -val get_image_infos : string -> JSON_parser.json_parser_val +val get_image_infos : string -> JSON.json_t (** [get_image_infos path] Run qemu-img info on the image pointed at path as JSON tree. *) diff --git a/common/mltools/JSON_parser-c.c b/common/mltools/JSON_parser-c.c index 32432dc5b..dce9f6a15 10064...
2012 Apr 02
23
[PATCH 00 of 18] [v2] tools: fix bugs and build errors triggered by -O2 -Wall -Werror
Changes: tools/blktap: remove unneeded pointer dereferencing in convert_dev_name_to_num tools/blktap: constify string arrays in convert_dev_name_to_num tools/blktap: fix params and physical-device parsing tools/blktap: remove unneeded pointer dereferencing from img2qcow.c tools/blktap: remove unneeded pointer dereferencing from qcow2raw.c tools/blktap2: fix build errors caused by Werror in
2017 Oct 27
15
[PATCH v11 0/8] virt-builder-repository
...parse time when the template flag is set and the value is missing. * Add virt-repository_main slow test * Other fixes from Richard's comments Cédric Bosdonnat (7): Ignore builder/*.out and *.img files builder: change arch type to (string, string option) maybe. builder: add Utils.get_image_infos function builder: add a template parameter to get_index builder: add Index.write_entry function mllib: add XPath helper xpath_get_nodes New tool: virt-builder-repository Pino Toscano (1): builder: add simple OCaml osinfo-db reader .gitignore | 8 + builde...
2018 Aug 22
3
[PATCH v2 0/2] mltools: JSON: unify JSON & JSON parser.
v2: - Added back the null value. - Reran the tests. Rich.
2017 Nov 14
1
Re: [PATCH v12 3/3] New tool: virt-builder-repository
...t_data/fedora.img.xz > +! test -e $test_data/fedora.img The test should ‘rm’ any temporary files it created after a successful run (but not on error paths). > --- a/builder/utils.mli > +++ b/builder/utils.mli > @@ -32,3 +32,6 @@ val string_of_revision : revision -> string > val get_image_infos : string -> Yajl.yajl_val > (** [get_image_infos path] Run qemu-img info on the image pointed at > path as YAJL tree. *) > + > +val increment_revision : revision -> revision > +(** Add one to the version number *) s/version/revision/ Looks good in general. Rich. --...
2017 Nov 13
6
[PATCH v12 0/3] virt-builder-repository tool
Hi there! Here is the latest version of the series including Richard's comments. I also reworked the repository_main.ml code to avoid setting an empty entry if not found. Cédric Bosdonnat (3): builder: change arch type to distinguish guesses builder: add a template parameter to get_index New tool: virt-builder-repository .gitignore | 4 +
2017 Oct 27
0
[PATCH v11 5/8] builder: add a template parameter to get_index
...rmat", None) fields) with Not_found -> None in let size = + let get_image_size filepath = + (* If a compressed image manages to reach this code, qemu-img just + returns a virtual-size equal to actual-size *) + let infos = Utils.get_image_infos filepath in + Yajl.object_get_number "virtual-size" infos in try Int64.of_string (List.assoc ("size", None) fields) with | Not_found -> - eprintf (f_"%s: no ‘size’ field for ‘%s’\n") prog n; -...
2017 Nov 13
0
[PATCH v12 2/3] builder: add a template parameter to get_index
...rmat", None) fields) with Not_found -> None in let size = + let get_image_size filepath = + (* If a compressed image manages to reach this code, qemu-img just + returns a virtual-size equal to actual-size *) + let infos = Utils.get_image_infos filepath in + Yajl.object_get_number "virtual-size" infos in try Int64.of_string (List.assoc ("size", None) fields) with | Not_found -> - eprintf (f_"%s: no ‘size’ field for ‘%s’\n") prog n; -...
2018 Aug 17
8
[PATCH v3 4/4] v2v: Add --print-estimate option to print copy size
I rethought this again, as I think that it's a dangerous assumption to bake qemu-img measure output into our API. This patch series runs qemu-img measure behind the scenes, but then parses the output and sums it to a single number which we print. Doing that required a bit of reworking, moving the Jansson [JSON parser] bindings from virt-builder into the common directory and a couple of other
2017 Nov 13
0
[PATCH v12 3/3] New tool: virt-builder-repository
...(f_"‘xz’ command failed"); + outimg + +let get_mime_type filepath = + let file_cmd = "file --mime-type --brief " ^ (quote filepath) in + match external_command file_cmd with + | [] -> None + | line :: _ -> Some line + +let get_disk_image_info filepath = + let infos = get_image_infos filepath in + { + format = object_get_string "format" infos; + size = object_get_number "virtual-size" infos + } + +let compute_short_id distro major minor = + match distro with + | "centos" when major >= 7 -> + sprintf "%s%d.0" distro majo...
2017 Nov 21
0
[PATCH v13 2/3] builder: add a template parameter to get_index
...let get_image_size filepath = + (* If a compressed image manages to reach this code, qemu-img just + returns a virtual-size equal to actual-size *) + match detect_file_type filepath with + | `Unknown -> + let infos = Utils.get_image_infos filepath in + Yajl.object_get_number "virtual-size" infos + | `XZ | `GZip | `Tar | ` Zip -> + eprintf (f_"%s: cannot determine the virtal size of %s due to compression") + prog filepath; + corrup...
2017 Nov 21
5
[PATCH v13 0/3] virt-builder-repository
Hey there, Here is an update of the series. The changes: * Incorporate Richard's comments. Left out the with_openfile one since that leads to a double close. * Change the ask option return type to string (removing the option) since if the use doesn't input anything we're using the default, and the default is now a mandatory parameter. * Make sure there are items in the