|
From: | Eric Blake |
Subject: | Re: [PATCH v3 07/16] qcow2: Write v3-compliant snapshot list on upgrade |
Date: | Fri, 11 Oct 2019 11:23:05 -0500 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.0 |
On 10/11/19 10:28 AM, Max Reitz wrote:
qcow2 v3 requires every snapshot table entry to have two extra data fields: The 64-bit VM state size, and the virtual disk size. Both are optional for v2 images, so they may not be present. qcow2_upgrade() therefore should update the snapshot table to ensure all entries have these extra data fields. Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1727347 Reported-by: Eric Blake <address@hidden> Signed-off-by: Max Reitz <address@hidden> Reviewed-by: Eric Blake <address@hidden> --- block/qcow2.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-)
+ need_snapshot_update = false; + for (i = 0; i < s->nb_snapshots; i++) { + if (s->snapshots[i].extra_data_size < + sizeof_field(QCowSnapshotExtraData, vm_state_size_large) + + sizeof_field(QCowSnapshotExtraData, disk_size))
Shorter as: if (s->snapshots[i].extra_data_size < sizeof(QCowSnapshotExtraData)) but that's stylistic, so R-b still stands. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
[Prev in Thread] | Current Thread | [Next in Thread] |