提交 38f54bd1 编写于 作者: M Max Reitz 提交者: Kevin Wolf

blockdev: Implement eject with basic operations

Implement 'eject' by calling blockdev-open-tray and
blockdev-remove-medium.
Signed-off-by: NMax Reitz <mreitz@redhat.com>
Signed-off-by: NKevin Wolf <kwolf@redhat.com>
上级 d1299882
...@@ -1980,16 +1980,15 @@ out: ...@@ -1980,16 +1980,15 @@ out:
void qmp_eject(const char *device, bool has_force, bool force, Error **errp) void qmp_eject(const char *device, bool has_force, bool force, Error **errp)
{ {
BlockBackend *blk; Error *local_err = NULL;
blk = blk_by_name(device); qmp_blockdev_open_tray(device, has_force, force, &local_err);
if (!blk) { if (local_err) {
error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, error_propagate(errp, local_err);
"Device '%s' not found", device);
return; return;
} }
eject_device(blk, force, errp); qmp_blockdev_remove_medium(device, errp);
} }
void qmp_block_passwd(bool has_device, const char *device, void qmp_block_passwd(bool has_device, const char *device,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册