From 55880601d82d55cbfa3b5bd9757496b6ebbc527c Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Fri, 17 Feb 2017 15:07:38 +0100 Subject: block: Add BDRV_O_RESIZE for blk_new_open() blk_new_open() is a convenience function that processes flags rather than QDict options as a simple way to just open an image file. In order to keep it convenient in the future, it must automatically request the necessary permissions. This can easily be inferred from the flags for read and write, but we need another flag that tells us whether to get the resize permission. We can't just always request it because that means that no block jobs can run on the resulting BlockBackend (which is something that e.g. qemu-img commit wants to do), but we also can't request it never because most of the .bdrv_create() implementations call blk_truncate(). The solution is to introduce another flag that is passed by all users that want to resize the image. Signed-off-by: Kevin Wolf Acked-by: Fam Zheng Reviewed-by: Max Reitz --- block/parallels.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'block/parallels.c') diff --git a/block/parallels.c b/block/parallels.c index 6b0c0a917c..19935e29a9 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -488,7 +488,8 @@ static int parallels_create(const char *filename, QemuOpts *opts, Error **errp) } file = blk_new_open(filename, NULL, NULL, - BDRV_O_RDWR | BDRV_O_PROTOCOL, &local_err); + BDRV_O_RDWR | BDRV_O_RESIZE | BDRV_O_PROTOCOL, + &local_err); if (file == NULL) { error_propagate(errp, local_err); return -EIO; -- cgit v1.2.3