From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:38148) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T60o1-0005G0-8F for qemu-devel@nongnu.org; Mon, 27 Aug 2012 11:00:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T60nr-0005ab-OA for qemu-devel@nongnu.org; Mon, 27 Aug 2012 11:00:45 -0400 Received: from mail-ee0-f45.google.com ([74.125.83.45]:54960) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T60nr-0005Yi-GR for qemu-devel@nongnu.org; Mon, 27 Aug 2012 11:00:35 -0400 Received: by eeke53 with SMTP id e53so1535391eek.4 for ; Mon, 27 Aug 2012 08:00:33 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Mon, 27 Aug 2012 17:00:13 +0200 Message-Id: <1346079626-16386-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [RFC PATCH 00/13] Embedded NBD server List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, stefanha@gmail.com Hi all, this is an RFC series implementing an NBD server embedded inside QEMU. This can be used in various cases, including migration with non-shared storage. Three new commands are introduced at the QMP level { 'command': 'nbd-server-start', 'data': { 'addr': 'IPSocketAddress' } } { 'command': 'nbd-server-add', 'data': {'device': 'str', '*writable': 'bool'} } { 'command': 'nbd-server-stop' } At the HMP level there is no nbd_server_add command. nbd_server_start automatically exposes all of the VM's block devices, and an option -w makes them writable. The NBD server exports multiple devices on a single port; they can be accessed using "nbd:HOST:PART:exportname=NAME". The patches are mostly boring touching nbd.c. The part where I need a second opinion and/or ack is patch 12 and 13. They fix the case of a disk being unplugged while NBD export is active. To do this I add a NotifierList to a BlockDriverState. Does this look okay, or is it too ad hoc? Paolo Bonzini (13): nbd: add more constants nbd: pass NBDClient to nbd_send_negotiate nbd: do not leak nbd_trip coroutines when a connection is torn down nbd: close all clients on deleting export nbd: register named exports nbd: negotiate with named exports nbd: do not close BlockDriverState in nbd_export_close qemu-sockets: publish dummy_opts qmp: add NBD server commands qemu-sockets: make inet_parse public hmp: add NBD server commands block: add close notifiers nbd: add notifier to close exports when the image is closed Makefile.objs | 5 +- block.c | 19 +++- block.h | 1 + block_int.h | 2 + blockdev-nbd.c | 131 ++++++++++++++++++++++ hmp-commands.hx | 29 +++++ hmp.c | 66 +++++++++++ hmp.h | 2 + nbd.c | 311 +++++++++++++++++++++++++++++++++++++++++----------- nbd.h | 6 + qapi-schema.json | 69 ++++++++++++ qapi/opts-visitor.c | 48 ++++---- qemu-nbd.c | 1 + qemu-sockets.c | 16 +-- qemu_socket.h | 3 + qmp-commands.hx | 16 +++ 16 file modificati, 621 inserzioni(+), 104 rimozioni(-) create mode 100644 blockdev-nbd.c -- 1.7.11.2