mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
qcow2: Allow qcow2 disk images with size zero
Images with disk size 0 may be used for VM snapshots, but not to save normal block data. It is possible to create such images using qemu-img, but opening them later fails. So even "qemu-img info image.qcow2" is not possible for an image created with "qemu-img create -f qcow2 image.qcow2 0". This is fixed here. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
b4558d7481
commit
d191d12d5f
2 changed files with 13 additions and 9 deletions
|
@ -39,6 +39,9 @@ int qcow2_grow_l1_table(BlockDriverState *bs, int min_size)
|
|||
new_l1_size = s->l1_size;
|
||||
if (min_size <= new_l1_size)
|
||||
return 0;
|
||||
if (new_l1_size == 0) {
|
||||
new_l1_size = 1;
|
||||
}
|
||||
while (min_size > new_l1_size) {
|
||||
new_l1_size = (new_l1_size * 3 + 1) / 2;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue