block: Fail requests to empty BlockBackend
authorMax Reitz <mreitz@redhat.com>
Mon, 19 Oct 2015 15:53:26 +0000 (17:53 +0200)
committerKevin Wolf <kwolf@redhat.com>
Fri, 23 Oct 2015 16:18:23 +0000 (18:18 +0200)
commitc09ba36c9ab62e3043041e429205f57ffbe3ba8b
treede43347f6d89b7f11076a267b94ead0fbe6b84ad
parent061959e8da5af59343e2c75d55c40f366d0164f9
block: Fail requests to empty BlockBackend

If there is no BlockDriverState in a BlockBackend or if the tray of the
guest device is open, fail all requests (where that is possible) with
-ENOMEDIUM.

The reason the status of the guest device is taken into account is
because once the guest device's tray is opened, any request on the same
BlockBackend as the guest uses should fail. If the BDS tree is supposed
to be usable even after ejecting it from the guest, a different
BlockBackend must be used.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/block-backend.c