From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:36406) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TK7E9-0006DC-M3 for qemu-devel@nongnu.org; Fri, 05 Oct 2012 08:42:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TK7E7-0006PJ-Oz for qemu-devel@nongnu.org; Fri, 05 Oct 2012 08:42:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:15052) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TK7E7-0006P6-H7 for qemu-devel@nongnu.org; Fri, 05 Oct 2012 08:41:59 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q95CfwY7028724 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 5 Oct 2012 08:41:58 -0400 Date: Fri, 5 Oct 2012 09:42:52 -0300 From: Luiz Capitulino Message-ID: <20121005094252.6bf323a5@doriath.home> In-Reply-To: <506E7DCD.1000405@redhat.com> References: <1349275025-5093-1-git-send-email-pbonzini@redhat.com> <1349275025-5093-12-git-send-email-pbonzini@redhat.com> <20121004170856.5941bed1@doriath.home> <506E7DCD.1000405@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 11/18] nbd: ask and print error information from qemu-sockets List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org On Fri, 05 Oct 2012 08:27:25 +0200 Paolo Bonzini wrote: > Il 04/10/2012 22:08, Luiz Capitulino ha scritto: > > On Wed, 3 Oct 2012 16:36:58 +0200 > > Paolo Bonzini wrote: > > > >> Before: > >> > >> $ qemu-system-x86_64 nbd:localhost:12345 > >> inet_connect_opts: connect(ipv4,yakj.usersys.redhat.com,127.0.0.1,12345): Connection refused > >> qemu-system-x86_64: could not open disk image nbd:localhost:12345: Connection refused > >> > >> After: > >> > >> $ x86_64-softmmu/qemu-system-x86_64 nbd:localhost:12345 > >> qemu-system-x86_64: Failed to connect to socket: Connection refused > >> qemu-system-x86_64: could not open disk image nbd:localhost:12345: Connection refused > >> > >> Signed-off-by: Paolo Bonzini > >> --- > >> nbd.c | 39 +++++++++++++++++++++++++++++++-------- > >> 1 file modificato, 31 inserzioni(+), 8 rimozioni(-) > >> > >> diff --git a/nbd.c b/nbd.c > >> index f61a288..cec5a94 100644 > >> --- a/nbd.c > >> +++ b/nbd.c > >> @@ -208,7 +208,14 @@ int tcp_socket_outgoing(const char *address, uint16_t port) > >> > >> int tcp_socket_outgoing_spec(const char *address_and_port) > >> { > >> - return inet_connect(address_and_port, NULL); > >> + Error *local_err = NULL; > >> + int fd = inet_connect(address_and_port, &local_err); > >> + > >> + if (local_err != NULL) { > >> + qerror_report_err(local_err); > >> + error_free(local_err); > > > > Can't you propagate errp instead of using qerror_report_err()? This function > > should only be used when the caller expects QError semantics. > > No, I cannot. These functions are used only for a) qemu-nbd, for which > qerror_report_err() is ok; b) the NBD driver's bdrv_open, which is not > able to propagate errors yet. > > When error propagation is added to bdrv_open they can just disappear, > replaced by direct calls to functions in qemu-sockets.c. Ok. I've started working on adding error propagation to bdrv_open(), should have a series soon.