diff options
author | Jeff Cody <jcody@redhat.com> | 2014-06-25 16:55:30 -0400 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2014-06-27 11:37:35 +0200 |
commit | 9c75e168bc388094c04aabb6fc59c91abe06e81c (patch) | |
tree | 1ffb1180562aa96b5217310a33c27d041778f558 /blockdev.c | |
parent | a760715095e9cda6eb97486c040aa35f82297945 (diff) | |
download | hqemu-9c75e168bc388094c04aabb6fc59c91abe06e81c.zip hqemu-9c75e168bc388094c04aabb6fc59c91abe06e81c.tar.gz |
block: check for RESIZE blocker in the QMP command, not bdrv_truncate()
If we check for the RESIZE blocker in bdrv_truncate(), that means a
commit will fail if the overlay layer is larger than the base, due to
the backing blocker.
This is a regression in behavior from 2.0; currently, commit will try to
grow the size of the base image to match the overlay size, if the
overlay size is larger.
By moving this into the QMP command qmp_block_resize(), it allows
usage of bdrv_truncate() within block jobs.
Signed-off-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'blockdev.c')
-rw-r--r-- | blockdev.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -1819,6 +1819,11 @@ void qmp_block_resize(bool has_device, const char *device, return; } + if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_RESIZE, NULL)) { + error_set(errp, QERR_DEVICE_IN_USE, device); + return; + } + /* complete all in-flight operations before resizing the device */ bdrv_drain_all(); |