containerized-data-importer icon indicating copy to clipboard operation
containerized-data-importer copied to clipboard

Bugfix/qemu img convert lose sparseness

Open noamasu opened this issue 7 months ago • 5 comments

What this PR does / why we need it: This PR updates the qemu-img convert command by conditionally adding the --target-is-zero and -n flags when preallocation is not requested. Since we assume that the target block device is already zeroed, the flag allows qemu-img to skip writing zero blocks—reducing unnecessary I/O and speeding up image conversion. The -n flag (which is used to skip target image creation) is required together with --target-is-zero, so it is automatically added when preallocation is disabled.

Which issue(s) this PR fixes: Fixes #3614

Special notes for your reviewer:

Release note:

NONE

noamasu avatar Apr 09 '25 13:04 noamasu

Hi @noamasu. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

kubevirt-bot avatar Apr 09 '25 13:04 kubevirt-bot

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Once this PR has been reviewed and has the lgtm label, please assign mhenriks for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

kubevirt-bot avatar Apr 09 '25 13:04 kubevirt-bot

@noamasu following offline discussions, should we hold this for now? I guess we're not in the wrong to not use this flag but rather device mapper devices return ENOSUPP on the appropriate ioctl, where other storage providers don't?

akalenyu avatar Apr 28 '25 12:04 akalenyu

Hey @akalenyu, I guess we should hold this for now, at least until we know whats going on with the ENOSUPP when using thin lv, not sure if this is the only one with ENOSUPP.

but worth mentioning that using --target-is zero will always reduce I/O and amount of sectors written to the block device. in fact, it will write the minimum amount of I/O and sectors possible which is always what we want. on an ideal scenario, if we knew 100% that the target device is zeroed out, it is worth adding this flag.

but yes, looks like most devices actually do preserve sparseness even when not using --target-is-zero (except that thin lv ENOSUPP), in that case not adding the flag will just mean more I/O and sectors written but at least the target block device conversion result is reliable (results in the same sha256sum disk signature even if the disk is not zeroed).

noamasu avatar Apr 29 '25 08:04 noamasu

/hold ref for enotsupp https://issues.redhat.com/browse/RHEL-87599

akalenyu avatar Apr 29 '25 11:04 akalenyu

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

/lifecycle stale

kubevirt-bot avatar Jul 28 '25 11:07 kubevirt-bot

Stale issues rot after 30d of inactivity. Mark the issue as fresh with /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

/lifecycle rotten

kubevirt-bot avatar Aug 27 '25 11:08 kubevirt-bot

Rotten issues close after 30d of inactivity. Reopen the issue with /reopen. Mark the issue as fresh with /remove-lifecycle rotten.

/close

kubevirt-bot avatar Sep 26 '25 11:09 kubevirt-bot

@kubevirt-bot: Closed this PR.

In response to this:

Rotten issues close after 30d of inactivity. Reopen the issue with /reopen. Mark the issue as fresh with /remove-lifecycle rotten.

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

kubevirt-bot avatar Sep 26 '25 11:09 kubevirt-bot