From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42226) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAYiu-0008OH-U7 for qemu-devel@nongnu.org; Wed, 08 Jun 2016 04:20:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bAYis-0003xT-Ij for qemu-devel@nongnu.org; Wed, 08 Jun 2016 04:20:23 -0400 Date: Wed, 8 Jun 2016 10:20:13 +0200 From: Kevin Wolf Message-ID: <20160608082013.GA5324@noname.str.redhat.com> References: <1465242006-22509-1-git-send-email-clord@redhat.com> <20160607102850.GD4684@noname.str.redhat.com> <54e10e22-57ac-c56a-99ee-20116a08a45e@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <54e10e22-57ac-c56a-99ee-20116a08a45e@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [Qemu-block] [PATCH] Report error when opening device with locked tray List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: John Snow Cc: Colin Lord , mreitz@redhat.com, qemu-devel@nongnu.org, qemu-block@nongnu.org, armbru@redhat.com Am 07.06.2016 um 22:00 hat John Snow geschrieben: >=20 >=20 > On 06/07/2016 06:28 AM, Kevin Wolf wrote: > > Am 06.06.2016 um 21:40 hat Colin Lord geschrieben: > >> This commit causes qmp_blockdev_change_medium to report an error if = an > >> attempt is made to open a device with a locked tray. > >=20 > > The old behaviour is that the command seemingly succeeds, but the med= ium > > isn't actually changed. Correct? > >=20 >=20 > Close. Old "change" command also fails, but with a confusing error. >=20 > > Should this be mentioned in the commit message? You just describe wha= t > > you change, but not why. > >=20 >=20 > Old behavior: >=20 > - Change uses qmp_blockdev_open_tray, which "succeeds." > - Change then tries to use qmp_x_blockdev_remove_medium, but receives > potentially confusing error "Tray is locked." > - Moments later, the tray is likely now open. Ah, yes, makes sense. This and that we want to have a less confusing error message is the part that is missing in the commit message. Kevin > New behavior: >=20 > - Change uses do_open_tray, which returns -EINPROGRESS. > - Change can propagate this error upwards without attempting to remove > the medium. > - User gets "Device is locked and force was not specified, wait > for tray to open and try again" error. >=20 > Why: "The new error tries to inform the user that there is an action > pending and that the command, if run again, may succeed." >=20 > >> Signed-off-by: Colin Lord > >> This is based off my previous patch regarding the do_open_tray funct= ion > >> (currently at v3). Probably should have been submitted as a patch se= t > >> but I wasn't thinking that far ahead when I submitted the first patc= h. > >> --- > >> blockdev.c | 7 +++++-- > >> 1 file changed, 5 insertions(+), 2 deletions(-) > >=20 > > Yes, would probably have made sense as a series, but as long as it's > > only two patches, it's not really a problem. > >=20 > > Please make sure to put such comments below the "---" line, though, i= .e. > > comments that make sense for the review, but not as part of the commi= t > > log. Then git-am automatically removes that part from the commit mess= age > > while applying the patch. I did it manually for this one now. > >=20 > > Kevin > >=20 >=20 > --=20 > =E2=80=94js