Bug 1443147

Summary: Cold Merge: Improve reduce when merging internal volumes
Product: [oVirt] vdsm Reporter: Ala Hino <ahino>
Component: CoreAssignee: Ala Hino <ahino>
Status: CLOSED CURRENTRELEASE QA Contact: Kevin Alon Goldblatt <kgoldbla>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.17.28CC: amureini, bugs, nsoffer, stirabos, tnisan
Target Milestone: ovirt-4.1.3Flags: rule-engine: ovirt-4.1+
Target Release: 4.19.16   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-07-06 13:31:34 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:
Bug Depends On: 1420405    
Bug Blocks:    

Description Ala Hino 2017-04-18 15:11:06 UTC
Description of problem:
Currently, when reducing the volume during 'finalizeMerge' step, the volume is reduced to actual size + a chunk.

For internal volumes, don't add a chunk.

Steps to Reproduce:
1. Perform cold merge for internal volume (the new flow introduced in 4.1)

Actual results:
Volume is reduce to actual size + a chunk.

Expected results:
Volume to be reduced to actual size

Comment 1 Allon Mureinik 2017-04-18 16:19:04 UTC
Tentatively targeting for 4.1.3, let's see how risky/risk-free this is.

Comment 2 Nir Soffer 2017-04-18 17:08:56 UTC
Testing this change:

1. Perform a cold merge of internal volume

2. Activate the merged volume
   lvchange -ay vgname/lvname
   Activate also the next volumes in this chain, if this is not the base volume

3. Run qemu-img check on this volume:
   qemu-img check --output json /dev/vgname/lvname

Example:

# qemu-img check test.qcow2 --output json
{
    "image-end-offset": 262144,
    "total-clusters": 163840,
    "check-errors": 0,
    "filename": "test.qcow2",
    "format": "qcow2"
}

The actual size of the image is the image-end-offset value.

4. Check the size of the lv
   lvs -o size --units m vgname/lvname

The actual size of the lv should be this value rounded up to the next
extent (128m).

In this example, the lv size should be 128.00m.

Comment 3 Kevin Alon Goldblatt 2017-06-05 08:24:23 UTC
Verified with the following code:
--------------------------------------
ovirt-engine-4.1.3-0.1.el7.noarch
rhevm-4.1.3-0.1.el7.noarch
vdsm-4.19.16-1.el7ev.x86_64

Verified with the following scenario:
--------------------------------------
1. Created a VM with 1 thin ISCSI disk of 10G
2. lvs -o size --units m 5f6e0626-3a8c-41ed-b843-7a9290a4db5a/775ebda8-93bf-402c-8bfe-83f556a6e0ae
  LSize   
  1024.00m (Initial size of minimum thin ISCSI lv)
3. Created Snapshot
4. Write 2G of data to the active disk
5. [root@purple-vds1 ~]#  lvs -o size --units m 5f6e0626-3a8c-41ed-b843-7a9290a4db5a/6a5e2b37-09c7-4ea1-9ab1-6a41bb531bb7
  LSize   
  3072.00m (Initial size of minimum ISCSI lv + about 2G of data)
6. Delete the snapshot - Live Merge is successfull
7. Stop the VM
7. Start the VM again
8. lvs -o size --units m 5f6e0626-3a8c-41ed-b843-7a9290a4db5a/775ebda8-93bf-402c-8bfe-83f556a6e0ae
  LSize   
  3200.00m (Original Size of OS on base + about 2G of data + 128M chunk)

Moving to VERIFIED!

Comment 4 Kevin Alon Goldblatt 2017-06-29 12:11:19 UTC
Verified with the following code:
--------------------------------------
ovirt-engine-4.1.3-0.1.el7.noarch
rhevm-4.1.3-0.1.el7.noarch
vdsm-4.19.16-1.el7ev.x86_64

Verified with the following scenario:
--------------------------------------
1. Created a VM with 1 thin ISCSI disk of 10G
2. lvs -o size --units m 5f6e0626-3a8c-41ed-b843-7a9290a4db5a/775ebda8-93bf-402c-8bfe-83f556a6e0ae
  LSize   
  1024.00m (Initial size of minimum thin ISCSI lv)
3. Created Snapshot
4. Write 2G of data to the active disk
5. [root@purple-vds1 ~]#  lvs -o size --units m 5f6e0626-3a8c-41ed-b843-7a9290a4db5a/6a5e2b37-09c7-4ea1-9ab1-6a41bb531bb7
  LSize   
  3072.00m (Initial size of minimum ISCSI lv + about 2G of data)
6. Power off the VM
7. Delete the snapshot - Live Merge is successfull
8. Start the VM again
9. lvs -o size --units m 5f6e0626-3a8c-41ed-b843-7a9290a4db5a/775ebda8-93bf-402c-8bfe-83f556a6e0ae
  LSize   
  3200.00m (Original Size of OS on base + about 2G of data + 128M chunk)