From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41479) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLDxW-0004B8-AQ for qemu-devel@nongnu.org; Tue, 10 Feb 2015 11:46:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YLDxS-0003HT-AV for qemu-devel@nongnu.org; Tue, 10 Feb 2015 11:46:46 -0500 Received: from mail-we0-x235.google.com ([2a00:1450:400c:c03::235]:37654) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLDxR-0003HI-Ru for qemu-devel@nongnu.org; Tue, 10 Feb 2015 11:46:42 -0500 Received: by mail-we0-f181.google.com with SMTP id w62so17414155wes.12 for ; Tue, 10 Feb 2015 08:46:41 -0800 (PST) Sender: Paolo Bonzini Message-ID: <54DA35ED.2050408@redhat.com> Date: Tue, 10 Feb 2015 17:46:37 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1423479159-30232-1-git-send-email-armbru@redhat.com> In-Reply-To: <1423479159-30232-1-git-send-email-armbru@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] vhost-scsi: Improve error reporting for invalid vhostfd List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster , qemu-devel@nongnu.org Cc: mst@redhat.com On 09/02/2015 11:52, Markus Armbruster wrote: > We get two error messages: one from monitor_handle_fd_param2(), and > another one from vhost_scsi_realize(). The second one gets suppressed > in QMP context. > > That's because monitor_handle_fd_param() calls qerror_report_err(). > Calling qerror_report_err() is always inappropriate in realize > methods, because it doesn't return the Error object. It either > reports the error to stderr or the human monitor, or it stores it in > the QMP monitor, where it makes the QMP command fail even when the > realize method ignores the error and succeeds. Fortunately, > vhost_scsi_realize() doesn't do that. > > Fix by switching to monitor_handle_fd_param2(). > > Signed-off-by: Markus Armbruster > --- > hw/scsi/vhost-scsi.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c > index dcb2bc5..567f350 100644 > --- a/hw/scsi/vhost-scsi.c > +++ b/hw/scsi/vhost-scsi.c > @@ -214,9 +214,11 @@ static void vhost_scsi_realize(DeviceState *dev, Error **errp) > } > > if (vs->conf.vhostfd) { > - vhostfd = monitor_handle_fd_param(cur_mon, vs->conf.vhostfd); > + vhostfd = monitor_handle_fd_param2(cur_mon, vs->conf.vhostfd, &err); > if (vhostfd == -1) { > - error_setg(errp, "vhost-scsi: unable to parse vhostfd"); > + error_setg(errp, "vhost-scsi: unable to parse vhostfd: %s", > + error_get_pretty(err)); > + error_free(err); > return; > } > } else { > Acked-by: Paolo Bonzini