-
Notifications
You must be signed in to change notification settings - Fork 81
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
console: validate disk size earlier, update error wording #596
Conversation
Note to reviewers: I've put "Fixes: harvester/harvester#4734" in the commit message, which will presumably automatically close that issue if this PR is merged. I'm not sure if that's usually done with harvester PRs. If not, please let me know and I'll remove that from the commit message. |
@tserong Thanks for the great PR! No, we don't like GitHub automatically closing an issue unless QA verifies it. So prefer not to use the fix/close keywords in the commits or PR. |
Thanks @bk201, I'll fix the commit message. I've also just done some more testing and have discovered that by setting |
5e4963c
to
ebc9017
Compare
OK, that should be better now. |
Hi @tserong, please force push again to trigger CI. |
This commit adds disk size validation in the calls to diskConfirm() and dataDiskConfirm(), so that as you walk through the fields you'll see potential error messages as you go, rather than having to wait until leaving the last field on the page. The error message clears if you press the up arrow to go to previous fields. The persistent partition size check remains where it is, i.e. it's only done when you try to move to the next page. I couldn't figure out a neat way to incorporate this into the validateAllDiskSizes() function, which gets called before the default persistent size is set in persistentSizeV.PreShow(). This commit also changes the wording of the "disk size is too small" error messages to explicitly state *which* disk is too small, and makes a small tweak to the "partition size" error message. Signed-off-by: Tim Serong <[email protected]>
ebc9017
to
1f08ce6
Compare
Thanks @Vicente-Cheng that seems to have worked :-) |
@@ -17,12 +17,12 @@ const ( | |||
|
|||
func ParsePartitionSize(diskSizeBytes uint64, partitionSize string) (uint64, error) { | |||
if diskSizeBytes < MinDiskSize { | |||
return 0, fmt.Errorf("Disk size is too small. Minimum %dGi is required", ByteToGi(MinDiskSize)) | |||
return 0, fmt.Errorf("Installation disk size is too small. Minimum %dGi is required", ByteToGi(MinDiskSize)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this makes the function only useful for the installation disk. Although we don't use the function in the data disk path, can we make the function more general like supporting passing a disk type?
The other parts of the PR work great!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although we don't use the function in the data disk path, can we make the function more general like supporting passing a disk type?
I'm not sure. I mean, yeah, we could add a parameter to specify disk type :-) but looking at the rest of the function, it's specifically testing sizes against MinDiskSize and MinPersistentSize, so ISTM the way it's implemented now is really geared towards looking at the installation disk only. Maybe this is something we can look at refactoring separately?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, no need to be in this PR!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for the improvement!
@Mergifyio backport v1.2 |
✅ Backports have been created
|
Problem:
The error messages are sometimes unclear when one has an installation disk that's too small.
Solution:
This commit adds disk size validation in the calls to
diskConfirm()
anddataDiskConfirm()
, so that as you walk through the fields you'll see potential error messages as you go, rather than having to wait until leaving the last field on the page. The error message clears if you press the up arrow to go to previous fields.The persistent partition size check remains where it is, i.e. it's only done when you try to move to the next page. I couldn't figure out a neat way to incorporate this into the
validateAllDiskSizes()
function, which gets called before the default persistent size is set inpersistentSizeV.PreShow()
.This commit also changes the wording of the "disk size is too small" error messages to explicitly state which disk is too small, and makes a small tweak to the "partition size" error message.
Related Issue:
harvester/harvester#4734
Test plan: