@@ -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);
@@ -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)
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 <lcapitulino@redhat.com> --- block.c | 5 +++++ qmp-commands.hx | 2 ++ 2 files changed, 7 insertions(+), 0 deletions(-)