block: Make sure throttled BDSes always have a BB

It was already true in principle that a throttled BDS always has a BB
attached, except that the order of operations while attaching or
detaching a BDS to/from a BB wasn't careful enough.

This commit breaks graph manipulations while I/O throttling is enabled.
It would have been possible to keep things working with some temporary
hacks, but quite cumbersome, so it's not worth the hassle. We'll fix
things again in a minute.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
Kevin Wolf 2016-03-21 10:49:51 +01:00
parent 8ec4fe0a4b
commit a5614993d7
4 changed files with 27 additions and 5 deletions

View file

@ -2570,8 +2570,6 @@ void qmp_blockdev_change_medium(const char *device, const char *filename,
goto fail;
}
blk_apply_root_state(blk, medium_bs);
bdrv_add_key(medium_bs, NULL, &err);
if (err) {
error_propagate(errp, err);
@ -2596,6 +2594,8 @@ void qmp_blockdev_change_medium(const char *device, const char *filename,
goto fail;
}
blk_apply_root_state(blk, medium_bs);
qmp_blockdev_close_tray(device, errp);
fail: