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

Handling of YAST_REUSE_LVM linuxrc option #1365

Merged
merged 11 commits into from Feb 15, 2024
Merged

Handling of YAST_REUSE_LVM linuxrc option #1365

merged 11 commits into from Feb 15, 2024

Conversation

mchf
Copy link
Member

@mchf mchf commented Feb 1, 2024

Problem

https://jira.suse.com/browse/PED-6407

The Storage Proposal in SLE 15 allows for creating a layout based on LVM. For historical reasons, it tries to reuse the existing LVM volume group for new installations. This sometimes produces a non-optimal, non-logical or even confusing disk setup.

Solution

linuxrc option to disable lvm reuse

Testing

  • Tested manually

@mchf mchf requested a review from ancorgs February 1, 2024 09:56
@coveralls
Copy link

coveralls commented Feb 1, 2024

Coverage Status

coverage: 97.762% (+0.002%) from 97.76%
when pulling eb6aa7d on yast_lvm_reuse
into 4253f2b on SLE-15-SP6.

@mchf mchf requested a review from ancorgs February 2, 2024 07:53
Copy link
Contributor

@ancorgs ancorgs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some doubts a

src/lib/y2storage/proposal_settings.rb Outdated Show resolved Hide resolved
src/lib/y2storage/proposal_settings.rb Outdated Show resolved Hide resolved
src/lib/y2storage/proposal_settings.rb Outdated Show resolved Hide resolved
@ancorgs
Copy link
Contributor

ancorgs commented Feb 2, 2024

Review was sent when I was still working on the comment (I clicked the wrong button, I guess).

I was saying that I like the idea of apply_user_enforced although I think the current implementation does not actually sets the value for the setting.

That being said, I have doubts about adding the setting to the control file. I'm not saying is a bad idea, I literally mean I have doubts whether is a good idea. On the bright side, we will be prepared for configuring the default value per-product in the future without code changes. On the other hand, adding things to the control file definition is a live-lasting contract signed in blood. 😉

@mchf
Copy link
Member Author

mchf commented Feb 2, 2024

Review was sent when I was still working on the comment (I clicked the wrong button, I guess).

I was saying that I like the idea of apply_user_enforced although I think the current implementation does not actually sets the value for the setting.

That being said, I have doubts about adding the setting to the control file. I'm not saying is a bad idea, I literally mean I have doubts whether is a good idea. On the bright side, we will be prepared for configuring the default value per-product in the future without code changes. On the other hand, adding things to the control file definition is a live-lasting contract signed in blood. 😉

I had an idea that we can easily switch default behavior later on if we want to. Question is if it pays of to do it in a creepy way or we should hope in big bang. Adding a feature into control file even changing default proposal, both is radical. Which way brings us more benefits? I'm not sure ... but with control file it at least won't require our assistance in that decision (hope).

#
# @return [Boolean, nil] boolean as explicitly set by user, nil if user set nothing
def requested_lvm_reuse
active?(ENV_REUSE_LVM, default: nil)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry to be picky about this, but the problem already mentioned about boolean and nil is here just moved one level down. :-)

Still, there is a method active? that returns something that is not a boolean. You are actually deviating from the original meaning of that method which explicitly declares both the return value and the parameter default to be booleans.

If you want to introduce support for nil values, please do it at requested_lvm_reuse, but don't twist active?.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, i tried and it didn't pass ... it happens ;-)

So another try is here.

@mchf mchf requested a review from ancorgs February 6, 2024 08:06
Copy link
Contributor

@ancorgs ancorgs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general it's good. But I really miss unit tests.

We have a mock_env helper that makes it easy to test how things behave depending on the presence / absence of some boot parameters.

https://github.com/search?q=repo%3Ayast%2Fyast-storage-ng%20mock_env&type=code


return env_str_to_bool(value) if value

nil
Copy link
Contributor

@ancorgs ancorgs Feb 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpicking comment: I think this would do the same and it's nicer to my Ruby eyes

def requested_lvm_reuse
  value = read(ENV_REUSE_LVM)
  return unless value

  env_str_to_bool(value)
end

How could you easily check if both implementations are equivalent? Well, I you would have unit tests... 😉

@mchf mchf marked this pull request as ready for review February 14, 2024 09:10
Copy link
Contributor

@ancorgs ancorgs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the unit tests

@mchf mchf merged commit c27b5b3 into SLE-15-SP6 Feb 15, 2024
12 checks passed
@mchf mchf deleted the yast_lvm_reuse branch February 15, 2024 10:01
@yast-bot
Copy link

✔️ Internal Jenkins job #5 successfully finished
✔️ Created IBS submit request #321652

@mchf mchf mentioned this pull request Feb 16, 2024
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.

None yet

4 participants