-
Notifications
You must be signed in to change notification settings - Fork 55
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
Rewrite device identification and initialization #1809
Merged
mulkieran
merged 15 commits into
stratis-storage:develop-2.0.1
from
mulkieran:develop-2.0.1-block-device-ownership
Feb 11, 2020
Merged
Rewrite device identification and initialization #1809
mulkieran
merged 15 commits into
stratis-storage:develop-2.0.1
from
mulkieran:develop-2.0.1-block-device-ownership
Feb 11, 2020
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mulkieran
requested review from
bgurney-rh,
drckeefe,
jbaublitz and
lleshchi
February 11, 2020 13:58
jbaublitz
approved these changes
Feb 11, 2020
drckeefe
approved these changes
Feb 11, 2020
bgurney-rh
approved these changes
Feb 11, 2020
lleshchi
approved these changes
Feb 11, 2020
mulkieran
force-pushed
the
develop-2.0.1-block-device-ownership
branch
from
February 11, 2020 21:37
ee2060a
to
4e68ddc
Compare
rebased. |
It had to be moved up a level because the udev functionality was being used in strat_engine/engine.rs to decide the ownership in the block_evaluate method. Now that functionality has been unified into identify_block_device in the identify module in backstore, so the udev module can be moved down again and be the identify module's sibling. Signed-off-by: mulhern <[email protected]>
It is no longer used outside backstore. Signed-off-by: mulhern <[email protected]>
There isn't really any good identifying information for a udev database entry, so it's better not to try to supply any. Signed-off-by: mulhern <[email protected]>
Make log entries in identify less wordy. This also means that the error returned by blockdevmgr::initialize is slightly more informative. Signed-off-by: mulhern <[email protected]>
In blockdevmgr::initialize there was previously no context for failure to determine ownership for a given devnode, now the context identifies the devnode. This is helpful here, since the user may have specified that devnode. Signed-off-by: mulhern <[email protected]>
In the next few commits the device module will go away entirely, while the devices module will take some method from the blockdevmgr module. Signed-off-by: mulhern <[email protected]>
Move initialize and wipe_blockdevs. initialize is getting bigger and needs room to breathe. It depends on wipe_blockdevs. All methods in this module are about blockdevs before they are owned by Stratis. Signed-off-by: mulhern <[email protected]>
Remove any unnecessary use of BlockDevMgr functionality. Signed-off-by: mulhern <[email protected]>
Remove device module entirely. It only contains DevOwnership, which is now entirely unused. The contributions of this rewrite are: * Decompose the problem better. There are now two functions, one which gets information about each device and another which initializes the devices. Previously all this was in one big method, initialize. There are two advantages: * The separated functions are a lot clearer. * The interface will allow the management of idempotency to be hoisted up the call chain to the engine. Currently, the idempotency treatment on create_pool or add must work by analyzing what happened, this will allow it to be much more direct and stable. In this commit, the check is moved up only one level, to blockdevmgr and abstracted into the function check_device_ids. * It removes the DevOwnership enumerated type entirely. This type had been designed to be used both when deciding identity to intialize devices and when deciding whether a device should be included in a pool. This dual purpose made it tough to use in either context, and it has already been dropped from the identify module in a previous PR. Tests that made use of DevOwnership were replaced with tests that made use of UdevOwnership. * Make resolve_devices private, preparatory to removing it in a subsequent commit. * Improve error messages to provide context for various failures. * Be less eager about performing relatively costly operations that get results that may not be needed. For example, if udev indicates that the device is owned by another, there is no need to get its size. * Adds a FIXME marking the spot where we ought to verify that the device is truly unowned using libblkid. * Do not multiply file descriptors gratuitously. Previously, while one file descriptor was being held on a device, another would be made in order to read Stratis metadata. Now only one file descriptor is open at a time on any given device. Signed-off-by: mulhern <[email protected]>
Since using udev, it makes sense to use it to get the device number. This allows getting rid of resolve_devices entirely, and avoid reading filesystem metadata. Signed-off-by: mulhern <[email protected]>
It only tests devices functionality, so that is the right place for it. Signed-off-by: mulhern <[email protected]>
Add some extra checks on the behavior of process_devices. To better delineate the problem if the test should go wrong. Use braces to separate tests parts. Verify that device identfiers have been written by initialization in some additional contexts. Signed-off-by: mulhern <[email protected]>
On general principles. Signed-off-by: mulhern <[email protected]>
This test has intermittent failures; it fails to find the devices it should using find_all. find_all() works, but it uses udev, and the udev database does not seem to be properly updated, although it should be since we use udev settle. Verify that the proper identifiers are on the devices immediately after they are added to the backstore. Signed-off-by: mulhern <[email protected]>
Do not expect udev to catch up in time. Signed-off-by: mulhern <[email protected]>
mulkieran
force-pushed
the
develop-2.0.1-block-device-ownership
branch
from
February 11, 2020 22:12
4e68ddc
to
17f3fd0
Compare
rebased. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Resolves: #1737.
Related: #1659.
Contributions are:
Supercedes #1764.