diff mbox

[4/4] block/qapi: Emit tray_open only if there is a tray

Message ID 1452613674-12248-5-git-send-email-mreitz@redhat.com
State New
Headers show

Commit Message

Max Reitz Jan. 12, 2016, 3:47 p.m. UTC
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 block/qapi.c               | 2 +-
 tests/qemu-iotests/067.out | 4 ----
 2 files changed, 1 insertion(+), 5 deletions(-)

Comments

Eric Blake Jan. 15, 2016, 5:11 p.m. UTC | #1
On 01/12/2016 08:47 AM, Max Reitz wrote:
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>  block/qapi.c               | 2 +-
>  tests/qemu-iotests/067.out | 4 ----
>  2 files changed, 1 insertion(+), 5 deletions(-)
> 

Reviewed-by: Eric Blake <eblake@redhat.com>
Alberto Garcia Jan. 18, 2016, 10:52 a.m. UTC | #2
On Tue 12 Jan 2016 04:47:54 PM CET, Max Reitz wrote:

> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>  block/qapi.c               | 2 +-
>  tests/qemu-iotests/067.out | 4 ----
>  2 files changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/block/qapi.c b/block/qapi.c
> index 58d3975..12a0f25 100644
> --- a/block/qapi.c
> +++ b/block/qapi.c
> @@ -299,7 +299,7 @@ static void bdrv_query_info(BlockBackend *blk, BlockInfo **p_info,
>      info->locked = blk_dev_is_medium_locked(blk);
>      info->removable = blk_dev_has_removable_media(blk);
>  
> -    if (blk_dev_has_removable_media(blk)) {
> +    if (blk_dev_has_tray(blk)) {
>          info->has_tray_open = true;
>          info->tray_open = blk_dev_is_tray_open(blk);
>      }

It probably makes sense to update the documentation as well:

# @tray_open: #optional True if the device has a tray and it is open
#             (only present if removable is true)

Berto
diff mbox

Patch

diff --git a/block/qapi.c b/block/qapi.c
index 58d3975..12a0f25 100644
--- a/block/qapi.c
+++ b/block/qapi.c
@@ -299,7 +299,7 @@  static void bdrv_query_info(BlockBackend *blk, BlockInfo **p_info,
     info->locked = blk_dev_is_medium_locked(blk);
     info->removable = blk_dev_has_removable_media(blk);
 
-    if (blk_dev_has_removable_media(blk)) {
+    if (blk_dev_has_tray(blk)) {
         info->has_tray_open = true;
         info->tray_open = blk_dev_is_tray_open(blk);
     }
diff --git a/tests/qemu-iotests/067.out b/tests/qemu-iotests/067.out
index 27ad56f..ae3fccb 100644
--- a/tests/qemu-iotests/067.out
+++ b/tests/qemu-iotests/067.out
@@ -169,7 +169,6 @@  Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,if=none,id=disk
                 "file": "TEST_DIR/t.qcow2",
                 "encryption_key_missing": false
             },
-            "tray_open": false,
             "type": "unknown"
         }
     ]
@@ -289,7 +288,6 @@  Testing:
                 "file": "TEST_DIR/t.qcow2",
                 "encryption_key_missing": false
             },
-            "tray_open": false,
             "type": "unknown"
         }
     ]
@@ -410,7 +408,6 @@  Testing:
                 "file": "TEST_DIR/t.qcow2",
                 "encryption_key_missing": false
             },
-            "tray_open": false,
             "type": "unknown"
         }
     ]
@@ -501,7 +498,6 @@  Testing:
                 "file": "TEST_DIR/t.qcow2",
                 "encryption_key_missing": false
             },
-            "tray_open": false,
             "type": "unknown"
         }
     ]