aboutsummaryrefslogtreecommitdiff
path: root/blockdev.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2016-09-20 13:38:46 +0200
committerKevin Wolf <kwolf@redhat.com>2016-09-23 13:40:45 +0200
commitfbe2d8163e8900fe22c67f55bd09ebc6f322f430 (patch)
treeb646f9d69084bc651df2a79975a807cbe698b42e /blockdev.c
parent00949babe90c528df1ffb79439d632c7bd4f6c42 (diff)
block: Accept device model name for eject
In order to remove the need for BlockBackend names in the external API, we want to allow qdev device names in all device related commands. This converts eject to accept a qdev device name. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'blockdev.c')
-rw-r--r--blockdev.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/blockdev.c b/blockdev.c
index a007b22f80..3d92724d0f 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -2265,7 +2265,9 @@ exit:
block_job_txn_unref(block_job_txn);
}
-void qmp_eject(const char *device, bool has_force, bool force, Error **errp)
+void qmp_eject(bool has_device, const char *device,
+ bool has_id, const char *id,
+ bool has_force, bool force, Error **errp)
{
Error *local_err = NULL;
int rc;
@@ -2274,14 +2276,16 @@ void qmp_eject(const char *device, bool has_force, bool force, Error **errp)
force = false;
}
- rc = do_open_tray(device, NULL, force, &local_err);
+ rc = do_open_tray(has_device ? device : NULL,
+ has_id ? id : NULL,
+ force, &local_err);
if (rc && rc != -ENOSYS) {
error_propagate(errp, local_err);
return;
}
error_free(local_err);
- qmp_x_blockdev_remove_medium(true, device, false, NULL, errp);
+ qmp_x_blockdev_remove_medium(has_device, device, has_id, id, errp);
}
void qmp_block_passwd(bool has_device, const char *device,