When amending the size option for a qcow2 image, use bdrv_truncate
instead of qcow2_truncate directly, since the latter will not adjust the
total_sectors count in the BDS structure (whereas the former will).

Signed-off-by: Max Reitz <mre...@redhat.com>
---
Depends on (follow-up to):
 - block/qcow2: Image file option amendment (series, v5)
---
 block/qcow2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/qcow2.c b/block/qcow2.c
index d29547b..259edfd 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -1997,7 +1997,7 @@ static int qcow2_amend_options(BlockDriverState *bs,
     }
 
     if (new_size) {
-        ret = qcow2_truncate(bs, new_size);
+        ret = bdrv_truncate(bs, new_size);
         if (ret < 0) {
             return ret;
         }
-- 
1.8.3.1


Reply via email to