From 4307ba0e7293aafa038eb2c99a27d73ea7b8d0f7 Mon Sep 17 00:00:00 2001 From: John Snow Date: Fri, 17 Jun 2016 21:28:21 +0200 Subject: [PATCH 3/8] blockdev: clarify error on attempt to open locked tray RH-Author: John Snow Message-id: <1466198902-14524-3-git-send-email-jsnow@redhat.com> Patchwork-id: 70682 O-Subject: [RHEV-7.3 qemu-kvm-rhev PATCH 2/3] blockdev: clarify error on attempt to open locked tray Bugzilla: 961589 RH-Acked-by: Miroslav Rezanina RH-Acked-by: Stefan Hajnoczi RH-Acked-by: Max Reitz From: Colin Lord 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 Signed-off-by: Kevin Wolf (cherry picked from commit 38a53d506be5efc83a33498948d8e6ba838dd836) Signed-off-by: John Snow Signed-off-by: Miroslav Rezanina Conflicts: blockdev.c: minor local variable ordering conflict --- blockdev.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/blockdev.c b/blockdev.c index 8853dd4..e53690f 100644 --- a/blockdev.c +++ b/blockdev.c @@ -2560,6 +2560,7 @@ void qmp_blockdev_change_medium(const char *device, const char *filename, BlockBackend *blk; BlockDriverState *medium_bs = NULL; int bdrv_flags, ret; + int rc; QDict *options = NULL; Error *err = NULL; @@ -2617,11 +2618,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) { -- 1.8.3.1