On Tue, Aug 29, 2023 at 05:20:40PM -0500, Eric Blake wrote:
While working on a larger set of patches to make nbdinfo favor
NBD_OPT_INFO over NBD_OPT_GO where possible (which requires use of
nbd_set_opt_mode(,true) in more cases), I noticed that it got unwieldy
to have to pick the correct shutdown function in all code paths. So I
propose making the API smarter, by adding an opt-in flag that does the
right thing on my behalf.
If you have an idea for a better name for the flag, or think this
functionality should be enabled by default, let me know. Part of the
reason for choosing a new flag is that it becomes a compile-time
witness of whether nbd_shutdown has the desired capability (if we
allow it to auto-opt_abort without a flag, it's harder to tell whether
we are running against an older libnbd where it errors out instead).
My feeling is this should be enabled by default, as that does the
right thing by default.
Whether or not we need to have a flag to disable it (ie the opposite
sense to the proposed flag) is up to you.
For the series:
Reviewed-by: Richard W.M. Jones <rjones(a)redhat.com>
Rich.
Eric Blake (3):
tests: Test behavior of nbd_shutdown during opt mode
api: Add new COVER_OPT_MODE flag to nbd_shutdown
info: Simplify shutdown calls
generator/API.ml | 21 ++++--
lib/disconnect.c | 15 ++++
tests/Makefile.am | 5 ++
tests/shutdown-opt-mode.c | 149 ++++++++++++++++++++++++++++++++++++++
.gitignore | 1 +
info/list.c | 8 +-
info/main.c | 4 +-
7 files changed, 188 insertions(+), 15 deletions(-)
create mode 100644 tests/shutdown-opt-mode.c
--
2.41.0
_______________________________________________
Libguestfs mailing list
Libguestfs(a)redhat.com
https://listman.redhat.com/mailman/listinfo/libguestfs
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW