Bug 1491893

Summary: copyImage fails on block storage if source image is compressed
Product: Red Hat Enterprise Virtualization Manager Reporter: Germano Veit Michel <gveitmic>
Component: vdsmAssignee: Fred Rolland <frolland>
Status: CLOSED DUPLICATE QA Contact: Raz Tamir <ratamir>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.1.5CC: aefrat, amureini, bazulay, ebenahar, gwatson, lsurette, srevivo, ycui, ykaul
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-09-17 08:56:43 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 Germano Veit Michel 2017-09-15 01:21:54 UTC
Description of problem:

1. Download one of the Red Hat provided RHEL7 kvm qcow2 image[1].
   * Or create an image, write some data and compress it.
   # man qemu-img | grep "be compressed"
   -c  indicates that target image must be compressed (qcow format only)
2. Upload image to RHV (Admin Portal/API)
3. Copy disk to same SD (block)

The copy fails with "CopyImageError: low level Image copy failed: No space left on device".

The Red Hat provided image is compressed. The destination LV is not big enough to accommodate the result of the qemu-img convert because it expands without the "-c" option.

Destination LV: 3c998305-ec3a-4d17-ab2c-44751c1667d8 43c67df7-2293-4756-9aa3-de09d67d7050 -wi-ao----   1.00g                                                                     
Source LV:      fb990cda-642e-4a11-93f7-b3fe3b29bc77 43c67df7-2293-4756-9aa3-de09d67d7050 -wi-ao---- 640.00m

I understand the destination is 1GB due to volume_utilization_chunk_mb.

But that specific image expands from 530MB to 1.2GB. For example, doing on my own laptop:

# This is what VDSM does during the copy:
# qemu-img convert -p -t none -T none -f qcow2 rhel-server-7.4-x86_64-kvm.qcow2   -O qcow2    -o compat=1.1 rhel-server-7.4-x86_64-kvm-2.qcow2

# This is an example of doing a convert with compression, so the Red Hat provided image stays the same size.
# qemu-img convert -p -t none -T none -f qcow2 rhel-server-7.4-x86_64-kvm.qcow2   -O qcow2 -c -o compat=1.1 rhel-server-7.4-x86_64-kvm-3.qcow2

# ll -h rhel-server-7.4-x86_64-kvm*
-rw-r--r--. 1 gveitmic gveitmic 1.2G Sep 15 10:16 rhel-server-7.4-x86_64-kvm-2.qcow2
-rw-r--r--. 1 gveitmic gveitmic 531M Sep 15 10:17 rhel-server-7.4-x86_64-kvm-3.qcow2
-rw-rw-r--. 1 gveitmic gveitmic 531M Sep 15 09:54 rhel-server-7.4-x86_64-kvm.qcow2

The destination needs 1.2G, more than twice the size of the source and bigger than 1GB that VDSM rounded up (Virtual size is 10G, doesn't really matter).

[1] Red Hat Enterprise Linux 7.4 KVM Guest Image 
https://access.redhat.com/downloads/content/69/ver=/rhel---7/7.4/x86_64/product-software

Version-Release number of selected component (if applicable):
vdsm-4.19.10.1-1.el7ev.x86_64

How reproducible:
100%

Steps to Reproduce:
As above

Actual results:
Copy fails on block, succeeds on NFS

Expected results:
Succeeds on block too.

Comment 2 Allon Mureinik 2017-09-17 08:56:43 UTC

*** This bug has been marked as a duplicate of bug 1470435 ***