As its name implies this new key informs the device's tray status to clients. It's only present if the device is a removable one.
Signed-off-by: Luiz Capitulino <lcapitul...@redhat.com> --- block.c | 5 +++++ qmp-commands.hx | 2 ++ 2 files changed, 7 insertions(+), 0 deletions(-) diff --git a/block.c b/block.c index 959eedd..e1b9057 100644 --- a/block.c +++ b/block.c @@ -1740,6 +1740,11 @@ void bdrv_info(Monitor *mon, QObject **ret_data) bs->device_name, bs->removable, bs->locked); + if (bs->removable) { + QDict *dict = qobject_to_qdict(bs_obj); + qdict_put(dict, "tray-open", qbool_from_int(bs->tray_open)); + } + if (bs->drv) { QObject *obj; QDict *bs_dict = qobject_to_qdict(bs_obj); diff --git a/qmp-commands.hx b/qmp-commands.hx index a9f109a..8393f22 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -1043,6 +1043,8 @@ Each json-object contain the following: - Possible values: "unknown" - "removable": true if the device is removable, false otherwise (json-bool) - "locked": true if the device is locked, false otherwise (json-bool) +- "tray-open": true if the device's tray is open, false otherwise. Only present + for removable media (json-bool) - "inserted": only present if the device is inserted, it is a json-object containing the following: - "file": device file name (json-string) -- 1.7.4.4