yast / yast-storage-ng

Rewrite of https://github.com/yast/yast-storage
http://yast.github.io/
GNU General Public License v2.0
14 stars 20 forks source link

Adaptations to have more flexible proposal (useful for Agama) #1335

Closed ancorgs closed 1 year ago

ancorgs commented 1 year ago

Problem

We are re-using the YaST GuidedProposal at Agama (to be precise, we use MinGuidedProposal which is identical but ignores desired_size and performs only one attempt with the minimum).

The GuidedProposal can find the best location for every requested volumes within a set of candidate devices. It also allows to specify that a given volume must be placed in a specific disk. But turns out it was not able to do both things at the same time!

If a setting called allocate_volume_mode was set to auto (which is the default), assignations of volume to specific disks were ignored and the proposal freely allocated all the volumes within the designated candidate devices. If allocate_volume_mode was set to device then the proposal calculated the candidate devices as the sum of all devices already assigned to a particular volume.

In other words, the proposal was not able to handle requirements like "allocate all volumes at sda except for volume /home that should go alone to sdb".

Solution

Now when the allocate mode is auto, the proposal still honors when a volume is assigned to a specific device, no matter if that device is part of candidate_devices or not.

That allows us to offer the following options at Agama proposal configuration.

Agama's partition-based proposal

That can be achieved by setting the following Y2Storage::Settings

Agama's LVM-based proposal

That can be achieved by setting the following Y2Storage::Settings

Testing

Added unit tests to demonstrate all that is possible now

Review

Better review commit by commit. This also includes a couple of clean-up commits.

coveralls commented 1 year ago

Coverage Status

Coverage: 97.75% (+0.001%) from 97.749% when pulling f22e5078141b9d57ae9b190f4c791470f67141d9 on ancorgs:agama_adaptations into 7bd8abc5600cfa2fdcec056e34de98eb37b30406 on yast:master.

yast-bot commented 1 year ago

:heavy_check_mark: Public Jenkins job #462 successfully finished :heavy_check_mark: Created OBS submit request #1084316