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

console: validate disk size earlier, update error wording #596

Merged
merged 1 commit into from
Nov 27, 2023

Conversation

tserong
Copy link
Contributor

@tserong tserong commented Nov 21, 2023

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() 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.

Related Issue:

harvester/harvester#4734

Test plan:

  • Boot a system with one disk < 250Gi. Verify that when you hit ENTER or DOWN on the Installation disk field that the "Installation disk size is too small. Minimum 250Gi is required" message appears.
  • Boot a system with two disks, one 120Gi, one 200Gi and verify:
    • With the 120Gi disk selected for both installation and data, you see "Installation disk size is too small. Minimum 250Gi is required"
    • With the 200Gi disk selected for both installation and data, verify the same error as above appears immediately.
    • Set the 120Gi disk for data and verify the error goes away.
  • In all cases, verify that an appropriate error appears immediately after you leave each field going down (down arrow or enter key) and that the error disappears when pressing the up arrow to return to the previous field.

@tserong
Copy link
Contributor Author

tserong commented Nov 21, 2023

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.

@bk201
Copy link
Member

bk201 commented Nov 21, 2023

@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.

@tserong
Copy link
Contributor Author

tserong commented Nov 22, 2023

Thanks @bk201, I'll fix the commit message.

I've also just done some more testing and have discovered that by setting c.config.Install.PersistentPartitionSize in persistentSizeV.PreShow(), the default partition size ends up always being 150Gi, even if you change the install disk to something bigger, i.e. the calculation based on DefaultPersistentPercentageNum doesn't happen after changing to a different, larger installation disk, so I need to re-work that slightly.

@tserong tserong force-pushed the wip-clarify-disk-size-errors branch from 5e4963c to ebc9017 Compare November 22, 2023 08:52
@tserong
Copy link
Contributor Author

tserong commented Nov 22, 2023

OK, that should be better now.

@Vicente-Cheng
Copy link
Contributor

Hi @tserong, please force push again to trigger CI.
We fixed the issue harvester/harvester#4754, which caused the CI to fail.

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]>
@tserong tserong force-pushed the wip-clarify-disk-size-errors branch from ebc9017 to 1f08ce6 Compare November 23, 2023 23:31
@tserong
Copy link
Contributor Author

tserong commented Nov 24, 2023

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))
Copy link
Member

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!

Copy link
Contributor Author

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?

Copy link
Member

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!

Copy link
Contributor

@Vicente-Cheng Vicente-Cheng left a 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!

@bk201 bk201 merged commit 9b6dd1e into harvester:master Nov 27, 2023
4 checks passed
@bk201
Copy link
Member

bk201 commented Nov 27, 2023

@Mergifyio backport v1.2

Copy link

mergify bot commented Nov 27, 2023

backport v1.2

✅ Backports have been created

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants