From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34723) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bANBD-00016r-2k for qemu-devel@nongnu.org; Tue, 07 Jun 2016 16:00:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bANBB-0007r9-2M for qemu-devel@nongnu.org; Tue, 07 Jun 2016 16:00:50 -0400 References: <1465242006-22509-1-git-send-email-clord@redhat.com> <20160607102850.GD4684@noname.str.redhat.com> From: John Snow Message-ID: <54e10e22-57ac-c56a-99ee-20116a08a45e@redhat.com> Date: Tue, 7 Jun 2016 16:00:37 -0400 MIME-Version: 1.0 In-Reply-To: <20160607102850.GD4684@noname.str.redhat.com> Content-Type: text/plain; charset=windows-1252 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: Kevin Wolf , Colin Lord Cc: mreitz@redhat.com, qemu-devel@nongnu.org, qemu-block@nongnu.org, armbru@redhat.com 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 mediu= m > isn't actually changed. Correct? >=20 Close. Old "change" command also fails, but with a confusing error. > Should this be mentioned in the commit message? You just describe what > you change, but not why. >=20 Old behavior: - 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. New behavior: - 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. Why: "The new error tries to inform the user that there is an action pending and that the command, if run again, may succeed." >> Signed-off-by: Colin Lord >> This is based off my previous patch regarding the do_open_tray functio= n >> (currently at v3). Probably should have been submitted as a patch set >> but I wasn't thinking that far ahead when I submitted the first patch. >> --- >> 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 commit > log. Then git-am automatically removes that part from the commit messag= e > while applying the patch. I did it manually for this one now. >=20 > Kevin >=20 --=20 =97js