goto cleanup;
}
- /* Don't check for success here, because 'tray_open' is presented iff
- * medium is ejected.
- */
- ignore_value(virJSONValueObjectGetBoolean(dev, "tray_open",
- &info->tray_open));
+ /* 'tray_open' is present only if the device has a tray */
+ if (virJSONValueObjectGetBoolean(dev, "tray_open", &info->tray_open) == 0)
+ info->tray = true;
+
+ /* presence of 'inserted' notifies that a medium is in the device */
+ if (!virJSONValueObjectGetObject(dev, "inserted"))
+ info->empty = true;
/* Missing io-status indicates no error */
if ((status = virJSONValueObjectGetString(dev, "io-status"))) {
" },"
" \"tray_open\": false,"
" \"type\": \"unknown\""
+" },"
+" {"
+" \"io-status\": \"ok\","
+" \"device\": \"drive-ide0-1-1\","
+" \"locked\": false,"
+" \"removable\": true,"
+" \"tray_open\": false,"
+" \"type\": \"unknown\""
" }"
" ],"
" \"id\": \"libvirt-10\""
info->locked = true;
info->removable = true;
+ info->tray = true;
+
if (virHashAddEntry(expectedBlockDevices, "ide0-1-0", info) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
"Unable to create expectedBlockDevices hash table");
goto cleanup;
}
+ if (VIR_ALLOC(info) < 0)
+ goto cleanup;
+
+ info->removable = true;
+ info->tray = true;
+ info->empty = true;
+
+ if (virHashAddEntry(expectedBlockDevices, "ide0-1-1", info) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ "Unable to create expectedBlockDevices hash table");
+ goto cleanup;
+ }
+
if (qemuMonitorTestAddItem(test, "query-block", queryBlockReply) < 0)
goto cleanup;