Received: from eggs.gnu.org ([2001:4830:134:3::10]:36173) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3Hcf-0007zp-UZ for qemu-devel@nongnu.org; Thu, 19 May 2016 02:39:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b3Hcb-0004eS-0a for qemu-devel@nongnu.org; Thu, 19 May 2016 02:39:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44504) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3Hca-0004eH-RK for qemu-devel@nongnu.org; Thu, 19 May 2016 02:39:48 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 768993B731 for ; Thu, 19 May 2016 06:39:47 +0000 (UTC) From: Fam Zheng Date: Thu, 19 May 2016 14:39:44 +0800 Message-Id: <1463639984-1165-1-git-send-email-famz@redhat.com> Subject: [Qemu-devel] [RHEL-7.3 qemu-kvm-rhev PATCH] qmp: Report drive_add error to monitor List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: rhvirt-patches@redhat.com Cc: Markus Armbruster , Kevin Wolf , Fam Zheng , Max Reitz , qemu-devel@nongnu.org, stefanha@redhat.com, jcody@redhat.com BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1337100 Brew: 11051815 Upstream: N/A In other error cases of this function we use error_setg, the same should be done with drive_new() failures. This is useful for libvirt to correctly detect the failure and report proper error message when a specified image is not available. This bug cames from the forward porting from qemu-kvm, at which point we overlooked the difference in QMP reporting between qerror_report and error_report. Signed-off-by: Fam Zheng --- device-hotplug.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/device-hotplug.c b/device-hotplug.c index 12c17e5..883346e 100644 --- a/device-hotplug.c +++ b/device-hotplug.c @@ -145,8 +145,7 @@ void simple_drive_add(QDict *qdict, QObject **ret_data, Error **errp) mc = MACHINE_GET_CLASS(current_machine); dinfo = drive_new(opts, mc->block_default_type); if (!dinfo) { - error_report(QERR_DEVICE_INIT_FAILED, - qemu_opts_id(opts)); + error_setg(errp, QERR_DEVICE_INIT_FAILED, qemu_opts_id(opts)); qemu_opts_del(opts); return; } -- 2.8.2