Received: from eggs.gnu.org ([2001:4830:134:3::10]:54630) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSPy8-0007u2-NV for qemu-devel@nongnu.org; Wed, 27 Jul 2016 10:38:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bSPy6-0007xW-Hq for qemu-devel@nongnu.org; Wed, 27 Jul 2016 10:37:55 -0400 References: <1468845016-43468-1-git-send-email-pasic@linux.vnet.ibm.com> <1469532873-78542-1-git-send-email-pasic@linux.vnet.ibm.com> <7c4bdb1e-f0aa-4a07-2780-37f4f92c6665@redhat.com> <57979B63.1060505@linux.vnet.ibm.com> <5798ABB4.1070505@linux.vnet.ibm.com> From: Max Reitz Message-ID: <6a7179a7-b1b4-c379-00df-e1e9d25bccb3@redhat.com> Date: Wed, 27 Jul 2016 16:37:45 +0200 MIME-Version: 1.0 In-Reply-To: <5798ABB4.1070505@linux.vnet.ibm.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="rUpM1uHMhJx7hAdowF0J1DEwKiGl68M4g" Subject: Re: [Qemu-devel] [PATCH v2 1/1] block: improve error handling in raw_open List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Halil Pasic , qemu-block@nongnu.org Cc: Kevin Wolf , Cornelia Huck , qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --rUpM1uHMhJx7hAdowF0J1DEwKiGl68M4g From: Max Reitz To: Halil Pasic , qemu-block@nongnu.org Cc: Kevin Wolf , Cornelia Huck , qemu-devel@nongnu.org Message-ID: <6a7179a7-b1b4-c379-00df-e1e9d25bccb3@redhat.com> Subject: Re: [Qemu-devel] [PATCH v2 1/1] block: improve error handling in raw_open References: <1468845016-43468-1-git-send-email-pasic@linux.vnet.ibm.com> <1469532873-78542-1-git-send-email-pasic@linux.vnet.ibm.com> <7c4bdb1e-f0aa-4a07-2780-37f4f92c6665@redhat.com> <57979B63.1060505@linux.vnet.ibm.com> <5798ABB4.1070505@linux.vnet.ibm.com> In-Reply-To: <5798ABB4.1070505@linux.vnet.ibm.com> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable On 27.07.2016 14:40, Halil Pasic wrote: >=20 >=20 > On 07/26/2016 07:47 PM, Max Reitz wrote: >>> Frankly, I'm a bit uncomfortable with asking (do not want to be pushy= ), >>>> but do you have an opinion on the 'error_report_err' issue (pointed >>>> out in the cover letter part)? >> You are using drive_add with QMP? As far as I know, one can only do so= >> with human-monitor-command which returns the error string like so: >> >> {"return": "Could not open file: No such file or directory\r\n"} >> >=20 > Yes, libvirt uses human-monitor-command, but are you sure the error > message is propagated back as described above? >=20 > Here is the call chain I'm talking about: >=20 > #0 error_report_err (err=3D0x1329a9d0) at /mnt/devel/root/git/qemu/uti= l/error.c:228 > #1 0x00000000100de4fe in drive_new (all_opts=3Dall_opts@entry=3D0x1204= 4010, block_default_type=3D) at /mnt/devel/root/git/qemu/b= lockdev.c:1134 > #2 0x00000000100e47be in add_init_drive (optstr=3D) at = /mnt/devel/root/git/qemu/device-hotplug.c:46 > #3 hmp_drive_add (mon=3D0x3ffe3f7d188, qdict=3D0x120b3af0) at /mnt/dev= el/root/git/qemu/device-hotplug.c:66 > #4 0x0000000010052092 in handle_hmp_command (mon=3Dmon@entry=3D0x3ffe3= f7d188, cmdline=3D0x110399ba "dummy file=3D/dev/sg924,if=3Dnone,id=3Ddriv= e-hostdev912", cmdline@entry=3D0x110399b0 "drive_add dummy file=3D/dev/sg= 924,if=3Dnone,id=3Ddrive-hostdev912") > at /mnt/devel/root/git/qemu/monitor.c:2929 > #5 0x0000000010052176 in qmp_human_monitor_command (command_line=3D0x1= 10399b0 "drive_add dummy file=3D/dev/sg924,if=3Dnone,id=3Ddrive-hostdev91= 2", has_cpu_index=3D, cpu_index=3D0, errp=3Derrp@entry=3D0= x3ffe3f7d310) > at /mnt/devel/root/git/qemu/monitor.c:668 > #6 0x00000000100f6faa in qmp_marshal_human_monitor_command (args=3D, ret=3D0x3ffe3f7d400, errp=3D0x3ffe3f7d3f8) at qmp-marshal.c= :1777 > [...] >=20 > Now if you examine #1 drive_new(all_opts,block_default_type) you see, > there is no errp argument and if you examine the code you see that the > error from blockdev_init which gets propagated properly to this point > gets "handled" by error_report_err (in QMP context! so does not much > good on this code path). AFAIU this can not work. Or am I wrong? drive_add is an HMP command. There's no other way for it to emit errors. Strictly speaking, HMP commands are not supposed to be used by management applications like libvirt (the "H" stands for "human", after all). QMP's "human-monitor-command" is just a workaround because there are some HMP commands for which we do not have fully working QMP replacements yet. One such example is indeed drive_add, because as Markus correctly pointed out, blockdev-add is still considered experiment= al. So we're still in the awkward spot of only having a legacy command (drive_add) and an experimental command (blockdev-add); and we have been in that spot for quite a while now (more than two years, I think). I think we're getting rather close to getting blockdev-add stable, but then again I'm afraid that might be something we've been thinking for the past two years. Max >> Apart from that, as for QMP, in theory you're supposed to use >> blockdev-add and device_add, I think (although blockdev-add is still >> considered experimental...). And blockdev-add will return the error >> string like so: >> >> {"error": {"class": "GenericError", "desc": "Could not open file: No >> such file or directory"}} >> >=20 > I guess libvirt will eventually pick up blockdev-add so the problem > should eventually go away. >=20 > Cheers, > Halil >=20 >=20 >=20 --rUpM1uHMhJx7hAdowF0J1DEwKiGl68M4g Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEvBAEBCAAZBQJXmMc5EhxtcmVpdHpAcmVkaGF0LmNvbQAKCRA7sUIC6DisrZxZ B/4msn5spE+VEjJvbXNvkNlVorwGeOr9DIaidh6nJJkCUiW8bMUcEGSmCTP7hgzn lX5DYQyx8mjFmA8EE11qLfg/YKUogPPLKUrhtAzbiOLql8NKHAzFHxZta8qI6ojJ kam2kw4gUBrx9I2whMBT9qjmBp0huihwQ+3R/CheOYBg8ZD4qWypjOKcfNEI/rIi d9sMHKJwpYGHZwf1LeIas5tEFMRGVWCt45GQAuNOTQ0y7PV8W24xxHdQrDMJDwtv QTNiXfjRoRWsAYia/wqxHOIuRB2spISSn35YkCcIw3YU/cqgbSwIOC5RybgvGTS0 Xpcm/2RCcL8k0YxZQulLlp7Q =a6j5 -----END PGP SIGNATURE----- --rUpM1uHMhJx7hAdowF0J1DEwKiGl68M4g--