search for: json_output

Displaying 20 results from an estimated 20 matches for "json_output".

2020 Oct 06
2
[PATCH libnbd] info: Write output atomically.
...fo/nbdinfo.c b/info/nbdinfo.c index 31e2508..24ec129 100644 --- a/info/nbdinfo.c +++ b/info/nbdinfo.c @@ -32,6 +32,7 @@ #include <libnbd.h> static const char *progname; +static FILE *fp; static bool list_all = false; static bool probe_content, content_flag, no_content_flag; static bool json_output = false; @@ -121,6 +122,8 @@ main (int argc, char *argv[]) int64_t size; const char *protocol; int tls_negotiated; + char *output = NULL; + size_t output_len = 0; progname = argv[0]; @@ -207,6 +210,17 @@ main (int argc, char *argv[]) if (map) probe_content = false; + /*...
2020 Sep 26
0
[PATCH nbdinfo v2] info: Add a --map option for displaying allocation metadata.
...0: unexpected output from nbdinfo --map" + exit 1 +fi diff --git a/info/nbdinfo.c b/info/nbdinfo.c index 647a24c..ff060aa 100644 --- a/info/nbdinfo.c +++ b/info/nbdinfo.c @@ -34,6 +34,7 @@ static bool list_all = false; static bool probe_content, content_flag, no_content_flag; static bool json_output = false; +static const char *map = NULL; static bool size_only = false; static struct export_list { @@ -49,6 +50,10 @@ static void list_one_export (struct nbd_handle *nbd, const char *desc, static void list_all_exports (struct nbd_handle *nbd1, const char *uri); static void print_json_string...
2020 Oct 27
6
[PATCH libnbd 0/5] info: --map: Coalesce adjacent extents of the same type.
This adds coalescing of adjacent extents of the same type, as mentioned by Eric Blake in the commit message here: https://github.com/libguestfs/libnbd/commit/46072f6611f80245846a445766da071e457b00cd The patch series is rather long because it detours through adding the <vector.h> library from nbdkit into libnbd and replacing ad hoc uses of realloc, char ** etc in various places. Rich.
2020 Sep 26
1
[PATCH nbdinfo proposal] info: Add a --map option for displaying allocation metadata
This is a rough-and-ready implementation of nbdinfo --map option, to display the allocation and other metadata of NBD exports. I only tested it lightly against nbdkit. It needs at least some tests. Command like these should work: nbdinfo --map nbd://localhost nbdinfo --map=qemu:dirty-bitmap nbd://localhost Rich.
2020 Aug 03
5
[libnbd PATCH 0/4] More nbdinfo fixes
This rounds up the remaining bugs that I originally identified in: https://www.redhat.com/archives/libguestfs/2020-July/msg00153.html Eric Blake (4): api: Permit export list APIs when Connected info: Support --list with serializing servers info: Fix --json output when list size != 1 info: Permit --size --json generator/API.ml | 6 +++--- info/info-list-json.sh | 9 +++++++++
2020 Oct 17
1
[libnbd PATCH] info: Keep request within 4G bound
...ar *argv[]) progname, map); exit (EXIT_FAILURE); } + align = nbd_get_block_size (nbd, LIBNBD_SIZE_MINIMUM) ?: 512; + max_len = UINT32_MAX - align + 1; size = nbd_get_size (nbd); if (size == -1) { @@ -286,7 +290,7 @@ main (int argc, char *argv[]) if (json_output) fprintf (fp, "[\n"); for (offset = 0; offset < size;) { prev_offset = offset; - if (nbd_block_status (nbd, size - offset, offset, + if (nbd_block_status (nbd, MIN (size - offset, max_len), offset, (nbd_extent_callback) { .callback = e...
2020 Sep 26
2
[PATCH nbdinfo v2] info: Add a --map option for displaying allocation metadata.
Fixes bugs with JSON output in the previous patch, and adds some tests. Rich.
2020 Oct 02
0
[libnbd PATCH v2 2/2] info: List available meta-contexts
...t=$unixsocket"' > $out cat $out grep "export-size: $((1024*1024))" $out +sed -n '/contexts:/ { N; p; q }; $ q1' $out + diff --git a/info/nbdinfo.c b/info/nbdinfo.c index 6f5d191..5358f82 100644 --- a/info/nbdinfo.c +++ b/info/nbdinfo.c @@ -37,12 +37,18 @@ static bool json_output = false; static const char *map = NULL; static bool size_only = false; +struct context_list { + char *name; + struct context_list *next; +}; + static struct export_list { size_t len; char **names; char **descs; } export_list; +static int collect_context (void *opaque, const char *n...
2020 Oct 16
3
[libnbd PATCH] info: Add support for new 'qemu-nbd -A' qemu:allocation-depth
A rather trivial decoding; we may enhance it further if qemu extends things to give an integer depth alongside its tri-state encoding. --- I'll wait to push this to libnbd until the counterpart qemu patches land upstream, although it looks like I've got positive review. info/nbdinfo.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/info/nbdinfo.c b/info/nbdinfo.c index
2020 Jul 24
0
[libnbd PATCH 3/3] nbdinfo: Expose block size constraints
...an_multi_conn (nbd); can_trim = nbd_can_trim (nbd); can_zero = nbd_can_zero (nbd); + block_minimum = nbd_get_block_size (nbd, LIBNBD_SIZE_MINIMUM); + block_preferred = nbd_get_block_size (nbd, LIBNBD_SIZE_PREFERRED); + block_maximum = nbd_get_block_size (nbd, LIBNBD_SIZE_MAXIMUM); if (!json_output) { printf ("export="); @@ -317,6 +321,12 @@ list_one_export (struct nbd_handle *nbd) printf ("\t%s: %s\n", "can_trim", can_trim ? "true" : "false"); if (can_zero >= 0) printf ("\t%s: %s\n", "can_zero",...
2020 Aug 03
0
[libnbd PATCH 4/4] info: Permit --size --json
...o.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/info/nbdinfo.c b/info/nbdinfo.c index f37ffea..2e0bf27 100644 --- a/info/nbdinfo.c +++ b/info/nbdinfo.c @@ -158,11 +158,6 @@ main (int argc, char *argv[]) usage (stderr, EXIT_FAILURE); /* You can combine certain options. */ - if (json_output && size_only) { - fprintf (stderr, "%s: you cannot use %s and %s together.\n", - argv[0], "--json", "--size"); - exit (EXIT_FAILURE); - } if (list_all && size_only) { fprintf (stderr, "%s: you cannot use %s and %s togethe...
2020 Oct 27
0
Re: [libnbd PATCH] info: Add support for new 'qemu-nbd -A' qemu:allocation-depth
...} @@ -810,7 +812,7 @@ extent_callback (void *user_data, const char *metacontext, /* Print the entries received. */ for (i = 0; i < nr_entries; i += 2) { - const char *descr = extent_description (map, entries[i+1]); + char *descr = extent_description (map, entries[i+1]); if (!json_output) { fprintf (fp, "%10" PRIu64 " " @@ -837,6 +839,7 @@ extent_callback (void *user_data, const char *metacontext, comma = true; } + free (descr); offset += entries[i]; } -- 2.29.0 -- Eric Blake, Principal Software Engineer Red Hat, Inc....
2020 Jul 29
0
[libnbd PATCH 2/2] info: Expose description in list mode
...:' $out +grep 'description: world' $out grep 'export-size: 1048576' $out diff --git a/info/nbdinfo.c b/info/nbdinfo.c index 49c97be..1aca548 100644 --- a/info/nbdinfo.c +++ b/info/nbdinfo.c @@ -37,7 +37,7 @@ static bool probe_content, content_flag, no_content_flag; static bool json_output = false; static bool size_only = false; -static void list_one_export (struct nbd_handle *nbd); +static void list_one_export (struct nbd_handle *nbd, const char *desc); static void list_all_exports (struct nbd_handle *nbd1, const char *uri); static void print_json_string (const char *); static...
2020 Aug 14
0
[libnbd PATCH v2 11/13] api: Add nbd_aio_opt_list
...- free (desc); - } - nbd_opt_abort (nbd); nbd_close (nbd); exit (EXIT_SUCCESS); diff --git a/info/nbdinfo.c b/info/nbdinfo.c index cdc0db8..81913dd 100644 --- a/info/nbdinfo.c +++ b/info/nbdinfo.c @@ -36,6 +36,14 @@ static bool probe_content, content_flag, no_content_flag; static bool json_output = false; static bool size_only = false; +static struct export_list { + size_t len; + char **names; + char **descs; +} export_list; + +static int collect_export (void *opaque, const char *name, + const char *desc); static void list_one_export (struct nbd_handle *nbd,...
2020 Aug 18
0
[libnbd PATCH v3 2/2] api: Add nbd_aio_opt_list
...t; { + t.Fatalf("unexpected exports contents after opt_list") } h.OptAbort() diff --git a/info/nbdinfo.c b/info/nbdinfo.c index cdc0db8..81913dd 100644 --- a/info/nbdinfo.c +++ b/info/nbdinfo.c @@ -36,6 +36,14 @@ static bool probe_content, content_flag, no_content_flag; static bool json_output = false; static bool size_only = false; +static struct export_list { + size_t len; + char **names; + char **descs; +} export_list; + +static int collect_export (void *opaque, const char *name, + const char *desc); static void list_one_export (struct nbd_handle *nbd,...
2020 Jul 29
3
[libnbd PATCH 0/2] Expose export description
An incremental improvement on top of listing exports. I still think it's worth experimenting with revisiting how our API for list mode should actually work [1] (so that we can reuse a single connection for both grabbing the list and finally using NBD_OPT_GO), but this change was easier to whip together while still thinking about that. [1]
2020 Aug 18
3
[libnbd PATCH v3 0/2] Implementing NBD_OPT_LIST
This is a subset of my v2 posting, but limited to just the NBD_OPT_LIST handling. The biggest change since v2 is the addition of added unit testing in all four language bindings (C, python, ocaml, golang). The tests require nbdkit built from git on PATH, and may not be entirely idiomatic, but I at least validated that they catch issues (for example, adding an exit statement near the end of the
2020 Jul 24
4
[libnbd PATCH 0/3] Expose server block size constraints
Necessary when writing a client that wants to avoid unnecessary EINVAL errors from sending unaligned requests. At some point, we may want to add synchronous convenience API wrappers that do request splitting or read-modify-write to obey server constraints while still appearing to the library client as accepting any possible request. But such a wrapper should only be synchronous and not copied to
2020 Oct 02
4
[libnbd PATCH v2 0/2] opt_list_meta_context
In v2: ack'ed preliminary patches have been pushed, and I've added a lot of testsuite coverage as well as putting the new API to use in nbdinfo. Eric Blake (2): api: Add nbd_opt_list_meta_context info: List available meta-contexts lib/internal.h | 1 + generator/API.ml | 84 ++++++++-
2020 Aug 14
18
[libnbd PATCH v2 00/13] Adding nbd_set_opt_mode to improve nbdinfo
Well, I'm not quite done (I still want to get nbdinfo to work on a single nbd connection for all cases when reading the heads of the file is not required), but I'm happy with patches 1-11, and 12-13 show where I'm headed for getting NBD_OPT_INFO to work. Posting now to see if some of the earlier patches are ready to commit while I continue working on the latter half. Eric Blake (13):