On Fri, Aug 04, 2023 at 10:55:40AM +0100, Richard W.M. Jones wrote:
On Wed, Aug 02, 2023 at 08:50:36PM -0500, Eric Blake wrote:
> Add another bit of overall server information, as well as a '--has
> extended-headers' silent query. For now, the testsuite is written
> assuming that when nbdkit finally adds extended headers support, it
> will also add a --no-eh kill switch comparable to its existing --no-sr
> switch.
>
> Signed-off-by: Eric Blake <eblake(a)redhat.com>
> ---
>
> v4: s/can/has/ [Rich]
> ---
> @@ -318,8 +320,9 @@ main (int argc, char *argv[])
> fprintf (fp, "protocol: %s", protocol);
> if (tls_negotiated >= 0)
> fprintf (fp, " %s TLS", tls_negotiated ? "with" :
"without");
> - if (sr_negotiated >= 0)
> + if (eh_negotiated >= 0 && sr_negotiated >= 0)
> fprintf (fp, ", using %s packets",
> + eh_negotiated ? "extended" :
> sr_negotiated ? "structured" : "simple");
Interesting - there's never a case where we could have extended
headers && ! structured replies?
Correct - the NBD spec says extended headers takes precedence over
structured replies; and for maximal back-compat, I set it up so that
even if the client asks for just extended headers and the server
responds with success, the libnbd API claims structured replies are
supported (because the structured chunk aspect is still in use, even
if the header sizes are different).
> fprintf (fp, "\n");
> ansi_restore (fp);
> @@ -337,6 +340,8 @@ main (int argc, char *argv[])
> fprintf (fp, "\"TLS\": %s,\n", tls_negotiated ?
"true" : "false");
> if (sr_negotiated >= 0)
> fprintf (fp, "\"structured\": %s,\n", sr_negotiated ?
"true" : "false");
> + if (eh_negotiated >= 0)
> + fprintf (fp, "\"extended\": %s,\n", eh_negotiated ?
"true" : "false");
> }
As a result, this code will never output
"structured":false,"extended":true.
>
> if (!list_all)
> --
Reviewed-by: Richard W.M. Jones <rjones(a)redhat.com>
Rich.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization:
qemu.org |
libguestfs.org