qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH RESEND 39/50] blockdev: Add blockdev-close-tray


From: Max Reitz
Subject: Re: [Qemu-devel] [PATCH RESEND 39/50] blockdev: Add blockdev-close-tray
Date: Wed, 28 Jan 2015 15:00:04 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0

On 2015-01-28 at 14:58, Eric Blake wrote:
On 01/27/2015 12:46 PM, Max Reitz wrote:
Signed-off-by: Max Reitz <address@hidden>
---
  blockdev.c           | 22 ++++++++++++++++++++++
  qapi/block-core.json | 14 ++++++++++++++
  qmp-commands.hx      | 33 +++++++++++++++++++++++++++++++++
  3 files changed, 69 insertions(+)

+void qmp_blockdev_close_tray(const char *device, Error **errp)
+{
+    BlockBackend *blk;
+
+    blk = blk_by_name(device);
+    if (!blk) {
+        error_set(errp, QERR_DEVICE_NOT_FOUND, device);
+        return;
+    }
+
+    if (!blk_dev_has_removable_media(blk)) {
+        error_setg(errp, "Device '%s' is not removable", device);
+        return;
+    }
+
+    if (!blk_dev_is_tray_open(blk)) {
+        return;
+    }
Is it worth documenting that this (and the one in 38/50) are intentional
no-ops if the tray is already in the desired state?

There's certainly no harm in documenting it, so I might as well just do it.

Max

Reviewed-by: Eric Blake <address@hidden>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]