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

Partitioner: Wrong evaluation of "undefined" Maximum size of a disk (swap) #1065

Closed
kobliha opened this issue Mar 1, 2024 · 1 comment
Closed
Assignees
Labels
bug Something isn't working

Comments

@kobliha
Copy link
Contributor

kobliha commented Mar 1, 2024

Let's start with the default TW partitioning

  1. Swap partition is 1 - 2 GB
  2. Click edit
  3. Keep "Range"
  4. Change Minimum to 16 GB (not needed) and delete the Maximum of 2 GB
  5. Click [Accept]
  6. Now the swap partition is Min 16 - Max 2 GB

It's probably taking the default when nothing is set, but then it can easily contain a nonsense range.

I've also tried to undef the Minimum size, but Agama is complaining that Minimum must be set.

@imobachgs imobachgs added the bug Something isn't working label Mar 1, 2024
@dgdavid dgdavid self-assigned this Mar 1, 2024
@lslezak lslezak assigned lslezak and unassigned dgdavid Apr 10, 2024
lslezak added a commit that referenced this issue Apr 10, 2024
## Problem

- #1065
- The maximum partition size cannot be set to "unlimited", using empty
value results in the default maximum size

**Example:** Changing the default 2GB max size is not possible, it is
always restored back:

![agama_max_size_broken](https://github.com/openSUSE/agama/assets/907998/04bb3f90-dbff-4a7e-99c2-32045162d64d)

## Details

- The problem is that the "unlimited" value is represented using the
`undefined` value in the web UI.
- But `undefined` cannot be sent over D-Bus because D-Bus does not have
concept for `undefined`, `nil` or `NULL` values, Iin that case the
`MaxSize` is simply missing the sent D-Bus data.
- When the D-Bus service creates a `Volume` object it first initializes
it with the default data from the YAML product configuration file. Then
it updates the attributes using the D-Bus data. Obviously when a value
is missing in the D-Bus then it keeps the default value from the config.
And that's the problem.

## Solution

- Set the "unlimited" value when the `MaxSize` attribute is missing in
the D-Bus data.

## Questions

- The fix has a drawback, the current code allows sending only partial
data set and ensures the defaults from the config file are used for
missing values.
- This won't work any more for the maximum size as a missing value won't
be considered as a "use the default" but as "use the unlimited size".
- Can this have some bad consequences?
- The code works, but is it safe in all scenarios?

## Alternative Solution

- If this fix is not correct then we should probably introduce a new key
in the D-Bus data, something like `MaxSizeUnlimited` with `true` /
`false` values which can be transferred via D-Bus...

## Testing

- Tested manually

Now it is possible to unset  the maximum size:

![agama_max_size_fixed](https://github.com/openSUSE/agama/assets/907998/067c8108-75d8-40be-9eda-04828bd73e48)

---------

Co-authored-by: José Iván López <jlopez@suse.com>
@lslezak
Copy link
Contributor

lslezak commented Apr 11, 2024

Fixed in #1142

@lslezak lslezak closed this as completed Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants