diff options
author | Kevin Wolf <kwolf@redhat.com> | 2016-12-16 18:52:37 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2017-02-24 16:09:23 +0100 |
commit | 4e4bf5c42c8b2847a90367936a6df6c277f4a76a (patch) | |
tree | 2b2003718fbd7652d35daf6bb209db90792ce88f /tests | |
parent | 52cdbc5869a3fbbe4d91c83e97dffb212af28ce3 (diff) |
block: Attach bs->file only during .bdrv_open()
The way that attaching bs->file worked was a bit unusual in that it was
the only child that would be attached to a node which is not opened yet.
Because of this, the block layer couldn't know yet which permissions the
driver would eventually need.
This patch moves the point where bs->file is attached to the beginning
of the individual .bdrv_open() implementations, so drivers already know
what they are going to do with the child. This is also more consistent
with how driver-specific children work.
For a moment, bdrv_open() gets its own BdrvChild to perform image
probing, but instead of directly assigning this BdrvChild to the BDS, it
becomes a temporary one and the node name is passed as an option to the
drivers, so that they can simply use bdrv_open_child() to create another
reference for their own use.
This duplicated child for (the not opened yet) bs is not the final
state, a follow-up patch will change the image probing code to use a
BlockBackend, which is completely independent of bs.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/qemu-iotests/051.out | 4 | ||||
-rw-r--r-- | tests/qemu-iotests/051.pc.out | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/tests/qemu-iotests/051.out b/tests/qemu-iotests/051.out index 42bf4164ca..7524c62025 100644 --- a/tests/qemu-iotests/051.out +++ b/tests/qemu-iotests/051.out @@ -225,7 +225,7 @@ Testing: -drive driver=nbd QEMU_PROG: -drive driver=nbd: NBD server address missing Testing: -drive driver=raw -QEMU_PROG: -drive driver=raw: Can't use 'raw' as a block driver for the protocol level +QEMU_PROG: -drive driver=raw: A block device must be specified for "file" Testing: -drive file.driver=file QEMU_PROG: -drive file.driver=file: The 'file' block driver requires a file name @@ -234,7 +234,7 @@ Testing: -drive file.driver=nbd QEMU_PROG: -drive file.driver=nbd: NBD server address missing Testing: -drive file.driver=raw -QEMU_PROG: -drive file.driver=raw: Can't use 'raw' as a block driver for the protocol level +QEMU_PROG: -drive file.driver=raw: A block device must be specified for "file" Testing: -drive foo=bar QEMU_PROG: -drive foo=bar: Must specify either driver or file diff --git a/tests/qemu-iotests/051.pc.out b/tests/qemu-iotests/051.pc.out index f8047a2e45..e206ad6c29 100644 --- a/tests/qemu-iotests/051.pc.out +++ b/tests/qemu-iotests/051.pc.out @@ -323,7 +323,7 @@ Testing: -drive driver=nbd QEMU_PROG: -drive driver=nbd: NBD server address missing Testing: -drive driver=raw -QEMU_PROG: -drive driver=raw: Can't use 'raw' as a block driver for the protocol level +QEMU_PROG: -drive driver=raw: A block device must be specified for "file" Testing: -drive file.driver=file QEMU_PROG: -drive file.driver=file: The 'file' block driver requires a file name @@ -332,7 +332,7 @@ Testing: -drive file.driver=nbd QEMU_PROG: -drive file.driver=nbd: NBD server address missing Testing: -drive file.driver=raw -QEMU_PROG: -drive file.driver=raw: Can't use 'raw' as a block driver for the protocol level +QEMU_PROG: -drive file.driver=raw: A block device must be specified for "file" Testing: -drive foo=bar QEMU_PROG: -drive foo=bar: Must specify either driver or file |