Sketch of an idea to fill several free spaces up reusing existent code #51
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Only PartitionCreator is fully working, the rest is temporary broken (but it's not a big deal)
#create_non_lvm_simple
)#create_non_lvm_simple
is executed for each free space (only with its particular subset of pre-selected volumes)With this idea, we kinda reduce the problem to write a sensible
VolumesDispatcher#distribute
method.That method should solve a problem very similar to the well-known one called "variable sized bin packing problem", a.k.a. VSBPP (info about bin packing in wikipedia). Of course, we don't need a complete solution for it, although it seems to be easily solved using linear programming: paper, one example.
The pull request also includes RSpec tests for several scenarios. The tests pass and proper devicegraphs are generated, probing that all the pieces actually fit together. The bad side if that the tests actually fake
VolumesDispatcher#distribute
returning always the best distribution for each scenario. We need to write a proper algorithm achieving that without faking... in next sprint.The current output of those new tests look like this.
RSpec tests for
SpaceMaker
are not included... yet.