From patchwork Fri Nov 30 22:03:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Blake X-Patchwork-Id: 10707329 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 253AB1057 for ; Fri, 30 Nov 2018 22:08:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 182B72F390 for ; Fri, 30 Nov 2018 22:08:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0BDD22F3B7; Fri, 30 Nov 2018 22:08:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 385272F390 for ; Fri, 30 Nov 2018 22:08:58 +0000 (UTC) Received: from localhost ([::1]:34836 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSqy0-0001IV-Rl for patchwork-qemu-devel@patchwork.kernel.org; Fri, 30 Nov 2018 17:08:56 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55985) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSqtI-0004Om-L4 for qemu-devel@nongnu.org; Fri, 30 Nov 2018 17:04:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gSqtG-0004Eu-Tr for qemu-devel@nongnu.org; Fri, 30 Nov 2018 17:04:04 -0500 Received: from mx1.redhat.com ([209.132.183.28]:50458) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gSqt8-0003G6-Br; Fri, 30 Nov 2018 17:03:54 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8FF3E307D84D; Fri, 30 Nov 2018 22:03:53 +0000 (UTC) Received: from red.redhat.com (ovpn-117-105.phx2.redhat.com [10.3.117.105]) by smtp.corp.redhat.com (Postfix) with ESMTP id F28A21057F69; Fri, 30 Nov 2018 22:03:50 +0000 (UTC) From: Eric Blake To: qemu-devel@nongnu.org Date: Fri, 30 Nov 2018 16:03:29 -0600 Message-Id: <20181130220344.3350618-1-eblake@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Fri, 30 Nov 2018 22:03:53 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-4.0 00/14] nbd: add qemu-nbd --list X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nsoffer@redhat.com, vsementsov@virtuozzo.com, jsnow@redhat.com, rjones@redhat.com, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP I got tired of debugging whether a server was advertising the correct things during negotiation by inspecting the trace logs of qemu-io as client - not to mention that without SOME sort of client tracing particular commands, we can't easily regression test the server for correct behavior. The final straw was at KVM Forum, when Nir asked me to make sure there was a way to easily determine if an NBD server is exposing what we really want (and fixing x-dirty-bitmap to behave saner fell out as a result of answering that question). I note that upstream NBD has 'nbd-client -l $host' for querying just export names (with no quoting, so you have to know that a blank line means the default export), but it wasn't powerful enough, so I implemented 'qemu-nbd -L' to document everything. Upstream NBD has separate 'nbd-client' and 'nbd-server' binaries, while we only have 'qemu-nbd' (which is normally just a server, but 'qemu-nbd -c' also operates a second thread as a client). Our other uses of qemu as NBD client are for consuming a block device (as in qemu-io, qemu-img, or a drive to qemu) - but those binaries are less suited to something so specific to the NBD protocol. Bonus: As a result of my work on this series, nbdkit now supports NBD_OPT_INFO (my interoperability testing between server implementations has been paying off, both at fixing server bugs, and at making this code more reliable across difference in valid servers). Based-on: <20181130023232.3079982-1-eblake@redhat.com> [0/3] NBD dirty bitmap cleanups (well, only weakly based on it - the two series can be applied in either order, where if you apply this series but revert 12/14, then iotest 223 in 14/14 will expose the bug fixed by patch 1/3 in the other series) Also available at: https://repo.or.cz/qemu/ericb.git qemu-nbd-list-v1 Eric Blake (14): qemu-nbd: Use program name in error messages nbd/client: More consistent error messages qemu-nbd: Fail earlier for -c/-d on non-linux qemu-nbd: Simplify --partition handling nbd/client: Drop pointless buf variable nbd/client: Move export name into NBDExportInfo nbd/client: Refactor nbd_negotiate_simple_meta_context() nbd/client: Refactor nbd_receive_list() nbd/client: Refactor return of nbd_receive_negotiate() nbd/client: Split handshake into two functions nbd/client: Add nbd_receive_export_list() nbd/client: Work around 3.0 bug for listing meta contexts qemu-nbd: Add --list option iotests: Enhance 223, 233 to cover 'qemu-nbd --list' include/block/nbd.h | 23 +- nbd/nbd-internal.h | 1 + block/nbd-client.c | 5 +- nbd/client.c | 595 +++++++++++++++++++++++++------------ qemu-nbd.c | 196 ++++++++++-- nbd/trace-events | 8 +- tests/qemu-iotests/223 | 2 + tests/qemu-iotests/223.out | 20 ++ tests/qemu-iotests/233 | 10 + tests/qemu-iotests/233.out | 17 +- 10 files changed, 650 insertions(+), 227 deletions(-)