summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Reitz2015-10-26 21:39:12 +0100
committerKevin Wolf2015-11-11 16:22:47 +0100
commit38f54bd1ee0ed0f13b7326eb79403e320c3a28d3 (patch)
tree5d55b4ee8638d21581bab0f2c4217f7aacd038ca
parentblockdev: Add blockdev-insert-medium (diff)
downloadqemu-38f54bd1ee0ed0f13b7326eb79403e320c3a28d3.tar.gz
qemu-38f54bd1ee0ed0f13b7326eb79403e320c3a28d3.tar.xz
qemu-38f54bd1ee0ed0f13b7326eb79403e320c3a28d3.zip
blockdev: Implement eject with basic operations
Implement 'eject' by calling blockdev-open-tray and blockdev-remove-medium. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r--blockdev.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/blockdev.c b/blockdev.c
index 0f2a7e2988..1624297296 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -1980,16 +1980,15 @@ out:
void qmp_eject(const char *device, bool has_force, bool force, Error **errp)
{
- BlockBackend *blk;
+ Error *local_err = NULL;
- blk = blk_by_name(device);
- if (!blk) {
- error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
- "Device '%s' not found", device);
+ qmp_blockdev_open_tray(device, has_force, force, &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
return;
}
- eject_device(blk, force, errp);
+ qmp_blockdev_remove_medium(device, errp);
}
void qmp_block_passwd(bool has_device, const char *device,