ide: bdrv_attach_dev() for empty CD-ROM
commit947231ad3b479de82d8f5ec185e2d00f3c96edcd
authorKevin Wolf <kwolf@redhat.com>
Tue, 11 Jul 2017 12:04:08 +0000 (11 14:04 +0200)
committerKevin Wolf <kwolf@redhat.com>
Tue, 18 Jul 2017 13:14:36 +0000 (18 15:14 +0200)
treeaeb085f4cb7bbe0914ba7bd72aa50f83d0a77dd2
parentec18b0a93a0b8f6f9a72bf2461dc7a0930391bfa
ide: bdrv_attach_dev() for empty CD-ROM

If no drive=... option is passed (for an empty drive), we don't only
lack the BlockBackend normally created by parse_drive(), but we also
need to manually call blk_attach_dev().

IDE does not support hot unplug, but if it did, qdev would take care to
call the matching blk_detach_dev() on unplug.

This fixes at least the bug that such devices didn't show up in
query-block, and probably some more problems.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
hw/ide/qdev.c