Displaying 13 results from an estimated 13 matches for "nbd_get_nr_list_exports".
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 18
0
[libnbd PATCH v3 2/2] api: Add nbd_aio_opt_list
...t all exports that it supports. This can
only be used if L<nbd_set_opt_mode(3)> enabled option mode.
-In this mode, during connection we query the server for the list
-of NBD exports and collect them in the handle. You can query
-the list of exports provided by the server by calling
-L<nbd_get_nr_list_exports(3)> and L<nbd_get_list_export_name(3)>.
-After choosing the export you want, set the export name
-(L<nbd_set_export_name(3)>), then finish connecting with L<nbd_opt_go(3)>.
+The <list> function is called once per advertised export, with any
+C<user_data> passed to t...
2020 Jul 31
1
[libnbd PATCH] generator: Trace return even when in wrong state
...re 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 reason to forbid this during READY; but I've also
mentioned that there are probably more changes coming to the way we do
list export handling in libnbd to allow the reuse o...
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 Aug 14
0
[libnbd PATCH v2 11/13] api: Add nbd_aio_opt_list
...t all exports that it supports. This can
only be used if L<nbd_set_opt_mode(3)> enabled option mode.
-In this mode, during connection we query the server for the list
-of NBD exports and collect them in the handle. You can query
-the list of exports provided by the server by calling
-L<nbd_get_nr_list_exports(3)> and L<nbd_get_list_export_name(3)>.
-After choosing the export you want, set the export name
-(L<nbd_set_export_name(3)>), then finish connecting with L<nbd_opt_go(3)>.
+The <list> function is called once per advertised export, with any
+C<user_data> passed to t...
2020 Jul 20
2
[PATCH libnbd PROPOSAL] Add APIs for listing exports from an NBD server.
Proposal for new APIs to list exports. The general shape of the API
can probably best be seen from the examples/list-exports.c example.
Rich.
2020 Aug 14
0
[libnbd PATCH v2 09/13] info: Simplify by using nbd_opt_go
...9,6 @@
#include <limits.h>
#include <errno.h>
-#include <libxml/uri.h>
#include <libnbd.h>
static bool list_all = false;
@@ -422,7 +421,6 @@ static void
list_all_exports (struct nbd_handle *nbd1, const char *uri)
{
int i;
- xmlURIPtr xmluri = NULL;
int count = nbd_get_nr_list_exports (nbd1);
if (count == -1) {
@@ -434,49 +432,38 @@ list_all_exports (struct nbd_handle *nbd1, const char *uri)
printf ("\t\"exports\": []\n");
for (i = 0; i < count; ++i) {
- char *name, *desc, *new_path, *new_uri;
+ char *name, *desc;
struct nbd_handle...
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 29
0
[libnbd PATCH 2/2] info: Expose description in list mode
..._string (desc);
+ printf (",\n");
+ }
+
if (content) {
printf ("\t\"content\": ");
print_json_string (content);
@@ -402,7 +411,7 @@ list_all_exports (struct nbd_handle *nbd1, const char *uri)
xmlURIPtr xmluri = NULL;
for (i = 0; i < nbd_get_nr_list_exports (nbd1); ++i) {
- char *name, *new_path, *new_uri;
+ char *name, *desc, *new_path, *new_uri;
struct nbd_handle *nbd2;
name = nbd_get_list_export_name (nbd1, i);
@@ -437,10 +446,12 @@ list_all_exports (struct nbd_handle *nbd1, const char *uri)
}
/* List the metadata of...
2020 Jul 20
0
[PATCH libnbd PROPOSAL] Add APIs for listing exports from an NBD server.
...is operation can fail normally, so
+ * we need to check the return value and
+ * error code.
+ */
+ r = nbd_connect_unix (nbd, argv[1]);
+ if (r == -1 && nbd_get_errno () == ENOTSUP) {
+ fprintf (stderr, "%s\n", nbd_get_error ());
+ exit (EXIT_FAILURE);
+ }
+
+ if (nbd_get_nr_list_exports (nbd) == 0) {
+ fprintf (stderr, "Server does not support "
+ "listing exports.\n");
+ exit (EXIT_FAILURE);
+ }
+
+ /* Display the list of exports. */
+ for (i = 0;
+ i < nbd_get_nr_list_exports (nbd);
+ i++) {
+ name = nbd_get_list_export_...
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 Jul 20
2
Re: [PATCH libnbd PROPOSAL] Add APIs for listing exports from an NBD server.
...eed to check the return value and
> + * error code.
> + */
> + r = nbd_connect_unix (nbd, argv[1]);
> + if (r == -1 && nbd_get_errno () == ENOTSUP) {
> + fprintf (stderr, "%s\n", nbd_get_error ());
> + exit (EXIT_FAILURE);
> + }
> +
> + if (nbd_get_nr_list_exports (nbd) == 0) {
> + fprintf (stderr, "Server does not support "
> + "listing exports.\n");
> + exit (EXIT_FAILURE);
> + }
> +
> + /* Display the list of exports. */
> + for (i = 0;
> + i < nbd_get_nr_list_exports (nbd);
> +...
2020 Aug 11
3
[libnbd PATCH] API: Add nbd_set_opt_mode to expose NEGOTIATING state
...Set opt mode and request list exports. */
+ nbd_set_opt_mode (nbd, true);
nbd_set_list_exports (nbd, true);
/* Connect to the NBD server over a
@@ -52,8 +71,8 @@ main (int argc, char *argv[])
fprintf (stderr, "%s\n", nbd_get_error ());
exit (EXIT_FAILURE);
}
-
- if (nbd_get_nr_list_exports (nbd) == 0) {
+ if (!nbd_aio_is_negotiating (nbd) ||
+ nbd_get_nr_list_exports (nbd) == 0) {
fprintf (stderr, "Server does not support "
"listing exports.\n");
exit (EXIT_FAILURE);
@@ -73,29 +92,34 @@ main (int argc, char *argv[])
}
printf (&q...