Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1887202

Summary: Disk.reduce() allowed on active image, possibly corrupting disk
Product: [oVirt] ovirt-engine Reporter: Nir Soffer <nsoffer>
Component: Backend.CoreAssignee: Nir Soffer <nsoffer>
Status: CLOSED CURRENTRELEASE QA Contact: Evelina Shames <eshames>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 4.4.3.6CC: aefrat, bugs, dfodor, mkalinin, tnisan
Target Milestone: ovirt-4.4.3Flags: pm-rhel: ovirt-4.4+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rhv-4.4.3-9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-11-11 06:41:42 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Storage RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Nir Soffer 2020-10-11 18:51:38 UTC
Description of problem:

Using Disk.reduce API is allowed on active disk image, possibly corrupting
the disk.

When reducing an image, vdsm check current qcow2 allocation, and then
reduce the logical volume using the calculated value. If the guest writes
data fast enough, it can allocated new qcow2 clusters before the logical
volume is reduced. Reducing the logical volumes will delete these clusters,
corrupting the image.

Version-Release number of selected component (if applicable):
Reproducible with 4.4.3.6
Bug exists since 4.2.5.1.

How reproducible:
Always.

Steps to Reproduce:
1. Run VM with qcow2 disk (e.g. with a snapshot)
2. Reduce the disk using the SDK

    disks_service = connection.system_service().disks_service()
    disk_service = disks_service.disk_service(disk_id)
    disk_service.reduce()

Actual results:
Reduce succeeds.

Expected results:
Reduce must be blocked for active image.

Additional info:
The bug exist since the Disk.reduce API was exposed to API, part of
bug 1443963.

Comment 1 Evelina Shames 2020-10-21 09:07:29 UTC
Reduce image is not supported for active image on engine-4.4.3-7 as expected.
Moving to 'Verified'.

Comment 2 Sandro Bonazzola 2020-11-11 06:41:42 UTC
This bugzilla is included in oVirt 4.4.3 release, published on November 10th 2020.

Since the problem described in this bug report should be resolved in oVirt 4.4.3 release, it has been closed with a resolution of CURRENT RELEASE.

If the solution does not work for you, please open a new bug report.

Comment 3 Marina Kalinin 2020-11-11 14:27:33 UTC
Interesting enough, reduce disk functionality is not documented anywhere - I searched customer portal for the word 'reduce' in RHV and nothing came up.
We do have a KCS saying that reduce is not supported though: https://access.redhat.com/solutions/697303.

Looking into bz#1443963 that introduced this functionality, no release note also to provide more details on it, it mentions that it is important to v2v on qcow disks. 

So maybe this bz could benefit from some release note documenting the fact that reduce disk is only available for non-active disks. And then we may also want to confirm with v2v team to understands if this blocks any workflow for them.

Comment 4 Nir Soffer 2020-11-11 14:53:50 UTC
(In reply to Marina Kalinin from comment #3)
One of the reasons to add this was virt-v2v, but it not use qcow2 format
yet.

When they start to use qcow2, they can use "qemu-img measure" to estimate
the required allocation before the import, and use reduce to shrink the
image to optimal size after an import.