search for: list_one_export

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

2020 Jul 29
0
[libnbd PATCH 2/2] info: Expose description in list mode
...rt-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 char *get_content (struct nbd_handle *, int64_t size); @@ -243,7 +243,8...
2020 Oct 02
0
[libnbd PATCH v2 2/2] info: List available meta-contexts
Use the just-added nbd_opt_list_meta_context() API to give more details about each export (matching what 'qemu-nbd --list' already does). Note that this requires some shuffling: listing meta exports requires being in opt mode, but is easiest to do in list_one_export(), which requires setting opt_mode in more code paths, and deferring ready mode until the last possible minute during get_content(). As written, the code displays the list in reverse order from how the server presented it, thanks to my use of a simple linked list. We could use a different data ty...
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 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 Jul 24
0
[libnbd PATCH 3/3] nbdinfo: Expose block size constraints
...t;: 1, + "block_size_preferred": 4096, + "block_size_maximum": 33554432, "export-size": 2125119488 } ] diff --git a/info/nbdinfo.c b/info/nbdinfo.c index 455cfc8..4c58815 100644 --- a/info/nbdinfo.c +++ b/info/nbdinfo.c @@ -264,6 +264,7 @@ list_one_export (struct nbd_handle *nbd) int is_rotational, is_read_only; int can_cache, can_df, can_fast_zero, can_flush, can_fua, can_multi_conn, can_trim, can_zero; + int64_t block_minimum, block_preferred, block_maximum; /* Collect the metadata we are going to display. */ size = nbd_get_size...
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
0
[libnbd PATCH v2 09/13] info: Simplify by using nbd_opt_go
...1 || + nbd_set_export_name (nbd2, name) == -1 || + nbd_opt_go (nbd2) == -1) { + fprintf (stderr, "%s\n", nbd_get_error ()); + exit (EXIT_FAILURE); + } - /* List the metadata of this export. */ - desc = nbd_get_list_export_description (nbd1, i); - list_one_export (nbd2, desc, i == 0, i + 1 == count); + /* List the metadata of this export. */ + desc = nbd_get_list_export_description (nbd1, i); + list_one_export (nbd2, desc, i == 0, i + 1 == count); - nbd_close (nbd2); - free (new_uri); - free (desc); - xmlFreeURI (xmluri); /* th...
2020 Aug 19
0
[libnbd PATCH 2/2] info: Use nbd_opt_info for fewer handles during --list
...d); + if (probe_content) + /* Disconnect from the server to move the handle into a closed + * state, in case the server serializes further connections. + * But we can ignore errors in this case. + */ + nbd_opt_abort (nbd); } if (size_only) { @@ -456,9 +457,6 @@ list_one_export (struct nbd_handle *nbd, const char *desc, free (export_name); } -/* XXX Inefficient and hacky. See TODO for a suggestion on how to - * improve this. - */ static void list_all_exports (struct nbd_handle *nbd1, const char *uri) { @@ -468,31 +466,41 @@ list_all_exports (struct nbd_handle *nb...
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 Jul 31
1
[libnbd PATCH] generator: Trace return even when in wrong state
...to submit one patch so far. I found them all while trying to implement .list_exports in nbdkit. Bug 1: 'nbdinfo --list --json $uri' produces invalid JSON if there are 0 or more than 1 exports. We need to move the '"exports":[' and ']' into list_all_exports(), not list_one_export(), and manage correct trailing comma output. (We only tested nbdinfo with qemu-nbd, which only lists one export, explaining how we missed this) Bug 2: nbd_get_nr_list_exports() fails if the handle is still in READY state, even though there were exports listed and available in that case. I see no...
2020 Aug 14
0
[libnbd PATCH v2 11/13] api: Add nbd_aio_opt_list
...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, const char *desc, bool first, bool last); static void list_all_exports (struct nbd_handle *nbd1, const char *uri); @@ -196,7 +204,8 @@ main (int argc, char *argv[]) } if (list_all) { - if (nbd_opt_list (nbd) == -1) { + if (nbd_opt...
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 Aug 18
0
[libnbd PATCH v3 2/2] api: Add nbd_aio_opt_list
...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, const char *desc, bool first, bool last); static void list_all_exports (struct nbd_handle *nbd1, const char *uri); @@ -196,7 +204,8 @@ main (int argc, char *argv[]) } if (list_all) { - if (nbd_opt_list (nbd) == -1) { + if (nbd_opt...
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 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 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):
2020 Sep 26
0
[PATCH nbdinfo v2] info: Add a --map option for displaying allocation metadata.
.../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 (const char *); static char *get_content (struct nbd_handle *, int64_t size); +static int extent_callback (void *user_data, const char *metacontext, +...
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 06
2
[PATCH libnbd] info: Write output atomically.
...derr, "%s: ", progname); + perror ("fclose"); + exit (EXIT_FAILURE); + } + if (puts (output) == EOF) { + fprintf (stderr, "%s: ", progname); + perror ("puts"); + exit (EXIT_FAILURE); + } + exit (EXIT_SUCCESS); } @@ -451,126 +478,133 @@ list_one_export (struct nbd_handle *nbd, const char *desc, content = get_content (nbd, size); if (!json_output) { - printf ("export="); + fprintf (fp, "export="); /* Might as well use the JSON function to get an escaped string here ... */ print_json_string (export_name);...
2020 Aug 19
3
[libnbd PATCH 0/2] NBD_OPT_INFO support
This replaces 13/13 of my v2 series; and now that it has pretty good testsuite coverage and demonstrable performance improvement to nbdinfo, I'm going ahead and pushing this now. We may still want to add further nbd_opt_* commands for other fine-grained tuning of negotiation, but for now, I think things have stabilized on this end, and I can return to polishing .list_exports on the nbdkit