Bugzilla (bugzilla.redhat.com) will be under maintenance for infrastructure upgrades and will not be unavailable on July 31st between 12:30 AM - 05:30 AM UTC. We appreciate your understanding and patience. You can follow status.redhat.com for details.
Bug 1414430 - Disable sparsify option for pre allocated disk
Summary: Disable sparsify option for pre allocated disk
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: BLL.Virt
Version: 4.1.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ovirt-4.1.1
: 4.1.1.2
Assignee: Shmuel Melamud
QA Contact: sefi litmanovich
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-01-18 13:31 UTC by sefi litmanovich
Modified: 2017-04-21 09:35 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-04-21 09:35:46 UTC
oVirt Team: Virt
rule-engine: ovirt-4.1+
tjelinek: devel_ack+
rule-engine: testing_ack+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 734120 0 high CLOSED [RFE] use virt-sparsify to reduce image size 2021-02-22 00:41:40 UTC
oVirt gerrit 71487 0 master MERGED core, webadmin: Disable sparsify for pre-allocated disks 2017-02-14 15:19:05 UTC
oVirt gerrit 72286 0 ovirt-engine-4.1 MERGED core, webadmin: Disable sparsify for pre-allocated disks 2017-02-14 22:28:04 UTC

Internal Links: 734120

Description sefi litmanovich 2017-01-18 13:31:15 UTC
Description of problem:
A new sparsify option was added in 4.1:
https://bugzilla.redhat.com/show_bug.cgi?id=734120

This option provides the ability to re claim previously used disk space of the guest in case guest's disk is thin provisioned.
The option will have no effect on pre allocated disks and there for is redundant for that case.
Currently the option is available to use on any disk, and will just report success even if nothing has actually been done on the disk. This has no negative effect but is just awkward and misleading so I suggest to disable the option.
Either gray out the button in case the disk is pre allocated. Or fail the command with a relevant error msg.

Version-Release number of selected component (if applicable):
ovirt-engine-4.1.0-0.4.master.20170116141310.gita30debd.el7.centos.noarch

How reproducible:
always

Steps to Reproduce:
1. Create a vm with a pre allocated disk on iscsi SD.
2. Create some files on the vm and then delete them.
3. Stop the vm.
4. Sparsify vm's disk (under disk sub tab of vm tab)

Actual results:
Action reports success, at no point does the actual disk size change, as it was all allocated in advance.

Expected results:
Fail with message: 'Cannot sparsify disk {name_of_disk}, disk space was pre allocated' or something of that sort.

Additional info:

Comment 1 Yaniv Kaul 2017-01-19 06:51:54 UTC
Why doesn't it work on pre-allocated disks? 
It should, unless they have 'wipe-after-delete' checked, in which case it gets a bit more complicated (for security reasons, we don't want to simply discard, but ensure it is wiped before that. Some arrays support it, some don't - we'll complete this work in 4.1.z).

Idan - thoughts?

Comment 2 Idan Shaby 2017-01-19 15:09:28 UTC
Yes, actually it doesn't matter if the disk is thinly provisioned or pre-allocated.

If I understood it correctly, virt-sparsify --in-place adds the disk's mount options the 'discard' option and calls 'fstrim /', which is exactly one of the options to reclaim space using the "Pass Discard" option of a vm disk, only that in the case of virt-sparsify you also need to shut down the vm.

Two questions that should be asked are:
1. Does the underlying storage support discard? What happens if it doesn't?
2. Does the underlying storage support the property that discard zeroes the data? If not, we cannot allow running virt-sparsify when wipe after delete is enabled.

From what I've seen in the code, these validations are not made prior to the call to virt-sparsify, even though the final outcome is the same as in Pass Discard, where we do check these things.

Shmuel, am I missing something here?
Can you please clarify?

Comment 3 Shmuel Melamud 2017-01-22 10:37:37 UTC
(In reply to Yaniv Kaul from comment #1)
> Why doesn't it work on pre-allocated disks? 

It works on pre-allocated disks, but I doubt it is justified for this case. User chooses pre-allocated option if she needs better performance, because no additional allocation and no fragmentation will occur when the disk is used. Deallocating some clusters as result of sparsification will overturn this advantage. If user wants to save space at cost of some performance decrease, she will select thin-provisioned option. So I would disable sparsify for pre-allocated disks.

Comment 4 Shmuel Melamud 2017-01-22 10:47:39 UTC
(In reply to Idan Shaby from comment #2)
> Two questions that should be asked are:
> 1. Does the underlying storage support discard? What happens if it doesn't?

Nothing will happen. Like in any other case when no blocks can be discarded.

> 2. Does the underlying storage support the property that discard zeroes the
> data? If not, we cannot allow running virt-sparsify when wipe after delete
> is enabled.

I don't check this currently. But yes, need to check this.

Comment 5 Idan Shaby 2017-01-22 15:34:10 UTC
Please see BZ 1415491 to track this bug.

Comment 6 Tomas Jelinek 2017-01-25 09:58:56 UTC
ok, so just disable the sparsify for preallocated disk. Since it is a new feature, targeting 4.1.1

Comment 7 sefi litmanovich 2017-02-20 12:20:30 UTC
Verified with rhevm-4.1.1.2-0.1.el7.noarch.
Sparsify action is disabled when the disk is pre allocated (sparse=False).


Note You need to log in before you can comment on or make changes to this bug.