From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:58687) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SC9JN-0006Rn-7k for Qemu-devel@nongnu.org; Mon, 26 Mar 2012 08:46:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SC9JH-0000EI-Mx for Qemu-devel@nongnu.org; Mon, 26 Mar 2012 08:46:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:20736) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SC9JH-0000E3-FM for Qemu-devel@nongnu.org; Mon, 26 Mar 2012 08:46:07 -0400 Date: Mon, 26 Mar 2012 09:46:10 -0300 From: Luiz Capitulino Message-ID: <20120326094610.2ee5abc8@doriath.home> In-Reply-To: <4F702B56.8030400@redhat.com> References: <4F702B56.8030400@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] Ignoring errno makes QMP errors suck List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: Qemu-devel@nongnu.org, Anthony Liguori On Mon, 26 Mar 2012 10:39:50 +0200 Kevin Wolf wrote: > Hi, > > I keep getting reports of problems, with nice error descriptions that > usually look very similar to what I produced here: > > {"execute":"blockdev-snapshot-sync","arguments":{"device":"ide0-hd0","snapshot-file":"/tmp/backing.qcow2"}} > {"error": {"class": "OpenFileFailed", "desc": "Could not open > '/tmp/backing.qcow2'", "data": {"filename": "/tmp/backing.qcow2"}}} > > Who can tell me what has happened here? Oh, yes, the command failed, I > would have guessed that from the "error" key. But the actual error > description is as useless as it gets. It doesn't tell me anything about > _why_ the snapshot couldn't be created. ("Permission denied" would have > been the helpful additional information in this case) There's a function called qemu_fopen_err() in the screendump conversion series that return more specific errors. It will be trivial to add qemu_open_err() as soon as qemu_fopen_err() is merged. We're adding a bunch of more precise errors (some map directly to errno). That's the easy part. The hard part is to convert everything to use them. Note that while it's true that this shouldn't have leaked to QMP, good error reporting is a general problem in QEMU.