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: button to activate crypt devices #849

Merged
merged 4 commits into from
Feb 20, 2019

Conversation

ancorgs
Copy link
Contributor

@ancorgs ancorgs commented Feb 18, 2019

Problem

When executed on an already installed system (i.e. not in installation), the Partitioner of storage-ng does not contain any way to activate pre-existing but inactive LUKs device.

The old partitioner (pre-ng) didn't executed an activation by default either, but it offered two ways of activating such device so it could be mounted or used in any other way.

  1. The user can click on "Edit" for an encrypted partition and then, in the first screen of the Edit wizard, select to mount the existing file-system. In that case, the next step of the Edit wizard consists on asking the password and activating the existing LUKS.

  2. There is also a general option "Provide Crypt Passwords" that is available in "Configure..." just alongside the similar "Configure Multipath" also used to activate inactive devices (Multipath devices instead of LUKS ones).

See more in the following links

Solution

Due to fundamental differences in how activation of devices works in storage-ng, solution 1 cannot be re-implemented.

This pull request re-implements solution 2. But due to the mentioned differences in approach, the "Provide Crypt Passwords" button added in this pull request:

  • activates all kind of devices, not only the crypt ones
  • refreshes everything (i.e. reprobes the whole devicegraph)

Testing

  • Tested manually
  • Unit test added

Screenshots

activate-crypt

None of the options of "Configure" and "Rescan Devices" buttons has never been explained in the help (not even in the old storage). Let's fix it.

activate-help

@coveralls
Copy link

coveralls commented Feb 18, 2019

Coverage Status

Coverage decreased (-0.02%) to 97.378% when pulling 5187270 on ancorgs:provide_password into 5b14c69 on yast:master.

@ancorgs ancorgs force-pushed the provide_password branch 3 times, most recently from 3b09276 to f8f1596 Compare February 18, 2019 12:25
#
# @return [Boolean, nil]
def activate
id == :crypt ? true : nil
Copy link
Member

Choose a reason for hiding this comment

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

to be honest i start thinking that here it is a bit abusing generic class where it more fits by common class hierarchy. I see there many "child" specific actions and this is one of it ( others are e.g. label defined elsewhere, warning text and others). why not create child class and have factory that create child based on id? If there is reason please document it in Action class description. Because as it is now, reuse single or subset of actions elsewhere is problematic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think there is a reason to avoid a hierarchy other than keeping things simple. These "actions" are not supposed to be reused elsewhere, they are just some very simplistic objects to represent the options of the "Configure" menu-button. They will never be used out of the scope of such button.

Anyway, I will take a look to the possibility of introducing a hierarchy and a factory class.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jreidinger I added a commit which changes this to use a hierarchy of actions. I don't think the factory class helps in this case, so I just reorganized the code a bit to use the new classes directly.

Now is more correct from the OOP point of view, but to be honest I'm not sure if the code has become more readable or simply bigger. :-)

Copy link
Member

Choose a reason for hiding this comment

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

@ancorgs for me it looks much better at least from my POV. and I think it makes also easier to extend it in future as it means add it only to two places and not more ( previously also warning texts and possible activate ). Only potentially movable stuff is also label, but nothing critical, so LGTM.

Copy link
Contributor

@joseivanlopez joseivanlopez left a comment

Choose a reason for hiding this comment

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

LGTM

@joseivanlopez
Copy link
Contributor

Remember changelog, etc.

@ancorgs ancorgs force-pushed the provide_password branch 2 times, most recently from 61739ec to 48f1f30 Compare February 19, 2019 15:33
@ancorgs ancorgs merged commit d9af0d7 into yast:master Feb 20, 2019
@yast-bot
Copy link

✔️ Internal Jenkins job #118 successfully finished
✔️ Created IBS submit request #184938

@yast-bot
Copy link

✔️ Public Jenkins job #116 successfully finished
✔️ Created OBS submit request #677620

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

5 participants