search for: nbdsh

Displaying 20 results from an estimated 183 matches for "nbdsh".

2019 Sep 12
1
[libnbd PATCH] nbdsh: Support -u as synonym for --connect
Typing nbdsh --con (the minimum to get an unambiguous prefix for --connect, different from --command) is annoying compared to having a short option. Since it takes a URI as an argument, using -u seems like a reasonable mnemonic. --- sh/nbdsh.pod | 6 ++++-- python/nbdsh.py | 2 +- sh/test-context.sh...
2019 Sep 12
2
[libnbd PATCH] nbdsh: Add -b option to simplify h.block_status
...ne meta context. This adds a convenience knob for requesting that, and has the nice benefit of working with the --connect command line option (previously, if you wanted to use block_status, you could not use --connect, because requesting the meta context must happen before the connection). --- sh/nbdsh.pod | 9 +++++++ python/nbdsh.py | 4 +++ sh/Makefile.am | 4 ++- sh/test-context.sh | 62 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 78 insertions(+), 1 deletion(-) create mode 100755 sh/test-context.sh diff --git a/sh/nbdsh.pod b/sh/nbdsh.pod index d7fc315.....
2022 Nov 04
3
[libnbd PATCH v2 0/3] Improve nbdsh -u handling
...nce then, I've incorporated changes based on Rich's feedback: swap order of patches 2 and 3 less change in patch 1 (including no unsafe eval(%s) for --uri) in patch 2, include -c in list of snippets to store, and use dict of lambdas to map back to the desired action Eric Blake (3): nbdsh: Refactor handling of -c nbdsh: Allow -u interleaved with -c nbdsh: Improve --help and initial banner contents. python/nbdsh.py | 142 +++++++++++++++++++++++++++------------------ sh/test-context.sh | 26 ++++----- sh/test-error.sh | 37 +++++++----- 3 files changed, 119 insertions(+)...
2019 Sep 12
1
[libnbd PATCH v2] nbdsh: Prefer --uri over --connect
Typing nbdsh --con (the minimum to get an unambiguous prefix for --connect, different from --command) is annoying compared to having a short option. Since it takes a URI as an argument, using -u/--uri is a nicer mnemonic. We still accept --connect for back-compat, and document it in the man page, but omit it...
2020 Sep 22
3
[libnbd PATCH v2] nbdsh: Catch nbd.Error from -c arguments
When using nbdsh for scripting, it is convenient to let nbdsh fail with status 1 when encountering an API failure. However, doing so by letting the nbd.Error exception leak all the way causes ABRT (at least on Fedora 32 with abrt-python3-handler installed) to assume the program crashed from a programming error, an...
2019 Sep 12
2
[libnbd PATCH] nbdsh: Start adding unit tests
...andling globals from consecutive -c, but let's start with a simple test that --help output is sane. Sanity includes a mention of the man page for more details (similar to nbdkit --help, although I couldn't figure out how to make python's argparse output that sentence last). --- python/nbdsh.py | 3 ++- sh/Makefile.am | 9 ++++++--- sh/test-help.sh | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 4 deletions(-) create mode 100755 sh/test-help.sh diff --git a/python/nbdsh.py b/python/nbdsh.py index 553e632..117c824 100644 --- a/python/nbdsh.py +++ b/python/...
2020 Sep 18
1
[libnbd PATCH] nbdsh: Hide nbd.Error from abrt-python3-handler
When using nbdsh for scripting, it is convenient to let nbdsh fail with status 1 when encountering an API failure. However, doing so by letting the nbd.Error exception leak all the way causes ABRT (on Fedora 32 at least) to assume the program crashed from a programming error, and needlessly complicates clients to...
2020 Sep 28
2
[libnbd PATCH] nbdsh: Add --opt-mode command line option
Similar to --base-allocation, this is a common enough configuration that cannot be performed with -c when using --uri, but which makes life easier in scripting. And like --base-allocation, I'm starting with only a long option spelling, rather than burning a short option letter. --- sh/nbdsh.pod | 21 +++++++++++++++++++-- python/nbdsh.py | 6 ++++++ sh/test-context.sh | 32 +++++++++++++++++++++++++++++++- 3 files changed, 56 insertions(+), 3 deletions(-) diff --git a/sh/nbdsh.pod b/sh/nbdsh.pod index 46c0f48..c1f1672 100644 --- a/sh/nbdsh.pod +++ b/sh/nbdsh.pod @@ -60,8 +6...
2019 Sep 11
0
[PATCH nbdkit] tests: Convert some tests to use nbdsh instead of qemu-io.
nbdsh has some advantages over qemu-io: - scriptable - allows us to more finely control NBD commands, such as making subsector-sized requests and controlling how many commands are sent on the wire - can write controlled patterns - can read NBD export flags --- README | 2 +...
2020 Jul 10
0
[RFC nbdkit PATCH] server: Allow --run with --vsock
...reason to forbid --vsock with --run. Signed-off-by: Eric Blake <eblake@redhat.com> --- I'm hoping to commit something like this, but right now, the testsuite is failing more times than it succeeds, with: + port=1082294412 + nbdkit --vsock --port 1082294412 memory 1M --run 'sleep 1; nbdsh -u "$uri" -c "$check"' ... libnbd: debug: nbdsh: nbd_connect_uri: enter: uri="nbd+vsock://1:1082294412" libnbd: debug: nbdsh: nbd_connect_uri: event CmdConnectSockAddr: START -> CONNECT.START libnbd: debug: nbdsh: nbd_connect_uri: poll start: events=4 libnbd: de...
2020 Jul 22
2
Re: [PATCH nbdkit] server: Deprecate the -e/--exportname parameter.
...ore likely to >>      be correct than if the -e option had been used. >> The more I think about it, the more I disagree with disabling this. Or, put another way, I think that the _only_ time -e makes sense is _when_ you are using --run. Consider: nbdkit -U - -e foo info --run 'nbdsh -u $uri -c "print(h.pread(3, 0))"' nbdkit -U - -e bar info --run 'nbdsh -u $uri -c "print(h.pread(3, 0))"' Of course, you can accomplish the same with: nbdkit -U - info --run 'nbdsh -u nbd+unix:///foo\?socket=$unixsocket \ -c "print(h.pread(3, 0))"...
2019 Sep 12
1
[libnbd PATCH] nbdsh: Add test of handling globals in -c
...t-dump.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100755 sh/test-dump.sh diff --git a/sh/Makefile.am b/sh/Makefile.am index 2eab987..50cd395 100644 --- a/sh/Makefile.am +++ b/sh/Makefile.am @@ -21,6 +21,7 @@ EXTRA_DIST = \ nbdsh.pod \ examples/LICENSE-FOR-EXAMPLES \ examples/hexdump.sh \ + test-dump.sh \ test-help.sh \ test-version.sh \ $(NULL) @@ -51,7 +52,9 @@ TESTS = \ if HAVE_NBDKIT -TESTS += +TESTS += \ + test-dump.sh \ + $(NULL) endif HAVE_NBDKIT diff --git a/sh/test-dump.sh b/sh/test-dump.sh new file...
2023 Jan 31
1
[libnbd PATCH v2 3/3] nbdsh: Improve --help and initial banner contents.
...to do this correctly in Python. I made > > several attempts, but I don't think Python is very good about having a > > variable which is only defined on some paths -- maybe it's not > > possible at all. > > Can you share the error when it breaks? $ rpm -qf /usr/bin/nbdsh python3-libnbd-1.15.9-2.fc38.x86_64 $ nbdsh Welcome to nbdsh, the shell for interacting with Network Block Device (NBD) servers. The ?nbd? module has already been imported and there is an open NBD handle called ?h? in state 'START'. h.connect_tcp("remote", "10809")...
2020 May 20
1
Re: [PATCH nbdkit] tests/test-truncate4.sh: Rewrite to use nbdsh.
...e > from this partial trace: Nice analysis. > Here are still connecting to nbdkit from "connection A", long after > the sleep has finished and the truncate has been done. > > Instead of increasing the sleep and hoping for the best, I chose to > rewrite the test to use nbdsh. This allows us to control both > connections from a single process, making the test predicatable and > easier to understand. Indeed. nbdsh is making a lot of tests easier to write, and it is now just a question of revisiting the older tests that predated it. > --- > tests/test-t...
2023 Jan 31
1
[libnbd PATCH v2 3/3] nbdsh: Improve --help and initial banner contents.
...made > > > several attempts, but I don't think Python is very good about having a > > > variable which is only defined on some paths -- maybe it's not > > > possible at all. > > > > Can you share the error when it breaks? > > $ rpm -qf /usr/bin/nbdsh > python3-libnbd-1.15.9-2.fc38.x86_64 > > $ nbdsh > > Welcome to nbdsh, the shell for interacting with > Network Block Device (NBD) servers. > > The ?nbd? module has already been imported and there > is an open NBD handle called ?h? in state 'START'. > &gt...
2020 May 20
2
[PATCH nbdkit] tests/test-truncate4.sh: Rewrite to use nbdsh.
This commit works for me, but TBH I'm not clear on what the actual purpose of this test is supposed to be. Rich.
2019 Sep 16
2
Re: [PATCH nbdkit 1/4] Add reflection plugin.
...ad1 EXAMPLES > + > +Create a reflection disk. By setting the export name to C<"hello"> > +when we open it, a virtual disk of only 5 bytes containing these > +characters is created. We then display the contents: > + > + $ nbdkit reflection mode=exportname > + $ nbdsh -u 'nbd://localhost/hello' -c - <<'EOF' > + size = h.get_size() > + print("size = %d" % size) > + buf = h.pread(size, 0) > + print("buf = %r" % buf) > + EOF This leaves nbdkit running as a background daemon after the fact. Is it worth imple...
2023 Jan 31
1
[libnbd PATCH v2 3/3] nbdsh: Improve --help and initial banner contents.
On Tue, Jan 31, 2023 at 12:34 AM Richard W.M. Jones <rjones at redhat.com> wrote: > > On Fri, Nov 04, 2022 at 04:18:31PM -0500, Eric Blake wrote: > > Document all options in --help output. If -n is not in use, then > > enhance the banner to print the current state of h, and further tailor > > the advice given on useful next steps to take to mention opt_go when >
2020 May 20
0
[PATCH nbdkit] tests/test-truncate4.sh: Rewrite to use nbdsh.
...gotiation: NBD_OPT_STRUCTURED_REPLY: client requested structured replies Here are still connecting to nbdkit from "connection A", long after the sleep has finished and the truncate has been done. Instead of increasing the sleep and hoping for the best, I chose to rewrite the test to use nbdsh. This allows us to control both connections from a single process, making the test predicatable and easier to understand. --- tests/test-truncate4.sh | 90 ++++++++++++++++++++++++++--------------- 1 file changed, 58 insertions(+), 32 deletions(-) diff --git a/tests/test-truncate4.sh b/tests/tes...
2019 Sep 17
0
Re: [PATCH nbdkit 1/4] Add reflection plugin.
...+Create a reflection disk. By setting the export name to C<"hello"> > > +when we open it, a virtual disk of only 5 bytes containing these > > +characters is created. We then display the contents: > > + > > + $ nbdkit reflection mode=exportname > > + $ nbdsh -u 'nbd://localhost/hello' -c - <<'EOF' > > + size = h.get_size() > > + print("size = %d" % size) > > + buf = h.pread(size, 0) > > + print("buf = %r" % buf) > > + EOF > > This leaves nbdkit running as a background daemon...