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

Include additional information in PartitioningError #1335

Conversation

vojtechtrefny
Copy link
Member

The generic 'Unable to allocate requested partition scheme' is not very helpful, we should try to include additional information if possible.

@vojtechtrefny
Copy link
Member Author

vojtechtrefny commented Jan 22, 2025

Slight issue with this is that the error message can get quite long with more disks -- up to one extra error line for each disk if you specify multiple disks when creating a partition (which for example Anaconda uses to tell blivet to choose the best disk to allocate the partition). So an extreme example (8 disks all with 4 primary partitions) can look like this:

image

@M4rtinK @KKoukiou @jkonecny12 any thoughts about this?

@KKoukiou
Copy link
Contributor

Slight issue with this is that the error message can get quite long with more disks -- up to one extra error line for each disk if you specify multiple disks when creating a partition (which for example Anaconda uses to tell blivet to choose the best disk to allocate the partition). So an extreme example (8 disks all with 4 primary partitions) can look like this:

image

@M4rtinK @KKoukiou @jkonecny12 any thoughts about this?

We should show the error, but I think a generic detail message, No free partition slots on the requested devices is also acceptable`.

@vojtechtrefny
Copy link
Member Author

We should show the error, but I think a generic detail message, No free partition slots on the requested devices is also acceptable`.

The problem with that is that we can have different reasons for different disks. Right now this PR covers only the cases when a partition cannot be added because of limits for number of partitions on give partition table, but I plan to add other error messages so it would be possible that with 4 disks some could be excluded because there isn't enough free space, one because of the primary partition number limit and one because the partition would start at sector >= 2 TiB. There is unfortunately too many reasons for a partition not being able to be placed on a disk.

@KKoukiou
Copy link
Contributor

KKoukiou commented Jan 22, 2025

@vojtechtrefny in that case you either create a more sophisticated error set, where there are pairs:

# Create a dictionary to group errors by reason
errors = {}
if reason in grouped_set:
        errors[reason].append(disk)
else:
        errors[reason] = [disk]

# Show combined errors for disks
final_errors = [reason .format(disks)} for reason, disks in errors.items()]
msg = _("Unable to allocate requested partition scheme:\n%s") % "\n".join(final_errors)

Or just keep your current code, better than not error details.

@jkonecny12
Copy link
Contributor

I think having list of the disks would be great, however, if we can join these errors together that would be even better.

The generic 'Unable to allocate requested partition scheme' is not
very helpful, we should try to include additional information if
possible.
@vojtechtrefny vojtechtrefny force-pushed the main_partitioning-show-better-error branch from 529ab4e to bdccfdb Compare January 23, 2025 08:44
@vojtechtrefny
Copy link
Member Author

New version:
image

@vojtechtrefny vojtechtrefny merged commit eca4e60 into storaged-project:main Jan 28, 2025
14 checks passed
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