From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PULL v2 01/11] vhost-scsi: Improve error reporting for invalid vhostfd
Date: Wed, 18 Feb 2015 12:10:31 +0100 [thread overview]
Message-ID: <1424257841-18634-2-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1424257841-18634-1-git-send-email-armbru@redhat.com>
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 <armbru@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
---
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 {
--
1.9.3
next prev parent reply other threads:[~2015-02-18 11:10 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-18 11:10 [Qemu-devel] [PULL v2 00/11] Clean up around error_get_pretty(), qerror_report_err() Markus Armbruster
2015-02-18 11:10 ` Markus Armbruster [this message]
2015-02-18 11:10 ` [Qemu-devel] [PULL v2 02/11] error: New convenience function error_report_err() Markus Armbruster
2015-02-18 11:10 ` [Qemu-devel] [PULL v2 03/11] error: Use error_report_err() where appropriate Markus Armbruster
2015-02-18 11:10 ` [Qemu-devel] [PULL v2 04/11] monitor: Clean up around monitor_handle_fd_param() Markus Armbruster
2015-02-18 11:10 ` [Qemu-devel] [PULL v2 05/11] monitor: Avoid qerror_report_err() outside QMP command handlers Markus Armbruster
2015-02-18 11:10 ` [Qemu-devel] [PULL v2 06/11] net: " Markus Armbruster
2015-02-18 11:10 ` [Qemu-devel] [PULL v2 07/11] numa: " Markus Armbruster
2015-02-18 11:10 ` [Qemu-devel] [PULL v2 08/11] tpm: " Markus Armbruster
2015-02-18 11:10 ` [Qemu-devel] [PULL v2 09/11] vl: " Markus Armbruster
2015-02-18 11:10 ` [Qemu-devel] [PULL v2 10/11] qemu-img: " Markus Armbruster
2015-02-18 11:10 ` [Qemu-devel] [PULL v2 11/11] qemu-char: " Markus Armbruster
2015-02-26 9:08 ` [Qemu-devel] [PULL v2 00/11] Clean up around error_get_pretty(), qerror_report_err() Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1424257841-18634-2-git-send-email-armbru@redhat.com \
--to=armbru@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).