Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: Preallocate blank image disks as well #1561

Conversation

tomob
Copy link
Contributor

@tomob tomob commented Jan 12, 2021

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1914177
Signed-off-by: Tomasz Baranski tbaransk@redhat.com

What this PR does / why we need it:
This fixes a bug where blank image disks were not preallocated.

This is a cherry-pick from master to v28, including all dependencies
required for functional tests but without new functionality.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

Special notes for your reviewer:

Release note:

NONE

This fixes a bug where blank image disks were not preallocated.
This is a cherry-pick from master to v28, including all dependencies
required for functional tests but without new functionality.

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1914177
Signed-off-by: Tomasz Baranski <tbaransk@redhat.com>
@kubevirt-bot kubevirt-bot added release-note-none Denotes a PR that doesn't merit a release note. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. size/L labels Jan 12, 2021
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 73.806% when pulling 4cc65f5 on tomob:preallocation-blank-image-cherry-pick-v28 into 367563c on kubevirt:release-v1.28.

@tomob
Copy link
Contributor Author

tomob commented Jan 13, 2021

/rerun

if shouldPreallocate {
return ProcessingPhasePreallocate, nil
}
dp.preallocationApplied = "skipped" // qemu did not preallicate space for a resized file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

preallicate->preallocate

if contentType == common.FilesystemCloneContentType {
return filesystemCloneProcessor(stream, common.ImporterVolumePath)
return "false", filesystemCloneProcessor(stream, common.ImporterVolumePath)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a strong reason to use strings that are booleans? it's a bummer to lose the benefit of type-checking

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's "true", "false" or "skipped".

I could do a type redefinition here (like type PreallocationStatus string), but it seemed to me like an overkill.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Go, in general it is very simple to do the redefinition, and it adds some type safety, in particular with typos in the strings. maybe you can do:

type Preallocation string

const PreallocationYes Preallocation="true"
const PreallocationNo Preallocation="false"
const PreallocationSkip Preallocation="skipped"

And you can pass the Yes/No instead of the booleans, and return Yes/No/Skip for the applied. I think that would make it easier to read. I had to re-read a few times before I found the place where the value was set to none.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a cherry-pick for 1.28. I don't want to change this here, let me create a new PR for that.

@tomob
Copy link
Contributor Author

tomob commented Jan 14, 2021

/retest

@awels
Copy link
Member

awels commented Jan 18, 2021

/lgtm
/approve

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Jan 18, 2021
@kubevirt-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: awels

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

The pull request process is described 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 kubevirt-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 18, 2021
@awels
Copy link
Member

awels commented Jan 18, 2021

/cherrypick release-v1.28

@kubevirt-bot
Copy link
Contributor

@awels: once the present PR merges, I will cherry-pick it on top of release-v1.28 in a new PR and assign it to you.

In response to this:

/cherrypick release-v1.28

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/test-infra repository.

@kubevirt-bot kubevirt-bot merged commit 9df35a0 into kubevirt:release-v1.28 Jan 18, 2021
@kubevirt-bot
Copy link
Contributor

@awels: base branch (release-v1.28) needs to differ from target branch (release-v1.28)

In response to this:

/cherrypick release-v1.28

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/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants