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

Fix: checking available image size #3458

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/image/qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ func checkIfURLIsValid(info *ImgInfo, availableSize int64, image string) error {
}
}

if availableSize < info.VirtualSize {
return errors.Errorf("virtual image size %d is larger than the reported available storage %d. A larger PVC is required", info.VirtualSize, availableSize)
if availableSize > info.VirtualSize {
return errors.Errorf("virtual image size %d is smaller than the reported available storage %d. A larger PVC is required", info.VirtualSize, availableSize)
}
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/image/qemu_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ var _ = Describe("Validate", func() {
Entry("should return error on bad json", mockExecFunction(badValidateJSON, "", expectedLimits), "unexpected end of JSON input", imageName),
Entry("should return error on bad format", mockExecFunction(badFormatValidateJSON, "", expectedLimits), fmt.Sprintf("Invalid format raw2 for image %s", imageName), imageName),
Entry("should return error on invalid backing file", mockExecFunction(backingFileValidateJSON, "", expectedLimits), fmt.Sprintf("Image %s is invalid because it has invalid backing file backing-file.qcow2", imageName), imageName),
Entry("should return error when PVC is too small", mockExecFunction(hugeValidateJSON, "", expectedLimits), fmt.Sprintf("virtual image size %d is larger than the reported available storage %d. A larger PVC is required", 52949672960, 42949672960), imageName),
Entry("should return error when PVC is too small", mockExecFunction(hugeValidateJSON, "", expectedLimits), fmt.Sprintf("virtual image size %d is smaller than the reported available storage %d. A larger PVC is required", 42949672960, 52949672960), imageName),
)

})
Expand Down