From patchwork Wed Jun 8 17:56:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: clord@redhat.com X-Patchwork-Id: 9165397 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 88A3460832 for ; Wed, 8 Jun 2016 17:56:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D7422804C for ; Wed, 8 Jun 2016 17:56:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6FEB3281FE; Wed, 8 Jun 2016 17:56:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A1F642804C for ; Wed, 8 Jun 2016 17:56:57 +0000 (UTC) Received: from localhost ([::1]:58713 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAhio-0002Nl-Pt for patchwork-qemu-devel@patchwork.kernel.org; Wed, 08 Jun 2016 13:56:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59861) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAhiZ-0002MR-AF for qemu-devel@nongnu.org; Wed, 08 Jun 2016 13:56:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bAhiX-0001QD-Cb for qemu-devel@nongnu.org; Wed, 08 Jun 2016 13:56:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42468) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAhiR-0001PJ-W9; Wed, 08 Jun 2016 13:56:32 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (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 B207885543; Wed, 8 Jun 2016 17:56:30 +0000 (UTC) Received: from dhcp-17-138.bos.redhat.com (dhcp-17-127.bos.redhat.com [10.18.17.127]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u58HuTow018207; Wed, 8 Jun 2016 13:56:29 -0400 From: Colin Lord To: qemu-devel@nongnu.org Date: Wed, 8 Jun 2016 13:56:28 -0400 Message-Id: <1465408588-29473-1-git-send-email-clord@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 08 Jun 2016 17:56:30 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2] blockdev: clarify error on attempt to open locked tray X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, Colin Lord , armbru@redhat.com, qemu-block@nongnu.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP When opening a device with a locked tray, gives an error explaining the device tray is locked and that the user should wait and try again. This is less confusing than the previous error, which simply stated that the tray was locked. Signed-off-by: Colin Lord --- Reworded commit message to hopefully explain things a little better. As before this is based off my previously submitted patch v3. blockdev.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/blockdev.c b/blockdev.c index 7dd14b9..8a045d9 100644 --- a/blockdev.c +++ b/blockdev.c @@ -2544,6 +2544,7 @@ void qmp_blockdev_change_medium(const char *device, const char *filename, BlockBackend *blk; BlockDriverState *medium_bs = NULL; int bdrv_flags; + int rc; QDict *options = NULL; Error *err = NULL; @@ -2598,11 +2599,13 @@ void qmp_blockdev_change_medium(const char *device, const char *filename, goto fail; } - qmp_blockdev_open_tray(device, false, false, &err); - if (err) { + rc = do_open_tray(device, false, &err); + if (rc && rc != -ENOSYS) { error_propagate(errp, err); goto fail; } + error_free(err); + err = NULL; qmp_x_blockdev_remove_medium(device, &err); if (err) {