sd: refactor the SD's backend interface#1272
Merged
arogge merged 26 commits intobareos:masterfrom Nov 9, 2022
Merged
Conversation
b3168f6 to
b47cec3
Compare
a6502d9 to
17356b7
Compare
17356b7 to
3485021
Compare
pstorz
requested changes
Oct 26, 2022
Member
pstorz
left a comment
There was a problem hiding this comment.
Do we still want to ship libbareossd-chunked.so and libbareossd-gentape.so?
No, we want to link chunked and gentape statically into the backends (i.e. droplet and tape) instead of shipping them as shared libraries.
arogge
commented
Oct 28, 2022
arogge
commented
Oct 28, 2022
4a17601 to
15ff3fe
Compare
2b49360 to
f09340b
Compare
pstorz
requested changes
Nov 4, 2022
Member
pstorz
left a comment
There was a problem hiding this comment.
Just minimal changes, please check my comments.
d57f5a4 to
d41e8bd
Compare
this patch amends the SD configuration in every systemtest to have the correct BackendDirectory set, so we can load dynamic backends during testing. It also removed the BackendDirectory when built without dynamic backends.
remove the unused FlushDevice() function from the backend interface and all interfaces.
Instead of building unix_file_device/win32_file_device directory into libbareossd, this patch builds them as a dynamic backend and removes special handling for them. Also move all backend build configuration into the backends directory.
This patch removes the remaining traces of these three removed backends from the codebase.
Previously the device-type for a device where the type was not specified was determined when it was first used. Now we do the check for every device right after the configuration was loaded and fail early if needed.
This patch turns the SD's device_type into a std::string, so we can use arbitrary backend names without registering them in a central list of backends.
If you configure a device, the backend will be checked when the configuration is loaded. Thus a lot of the existing test configurations need to be adapted to either use existing storge backends or to have BackendDirectory configured.
This patch introduces a plugin regsitry that contains all loaded backends. Storage backends will self-register their factory either at startup (in case the backend is statically linked into the SD) or when the backend is loaded. From the backend's perspective, there's no difference if it is statically or dynamically loaded anymore. Finally, the loading of the backends is done right after loading the configuration, so for every device we check the presence of its backend and fail if it is missing or cannot be loaded.
This patch removes now unused parts of the old storage backend interface.
Instead of returning a factory that will then provide Device*, we can return the Device* from the PluginRegistry's factory directly. This removes the BackendInterface layer that wrapped the factory again.
Previously the droplet tests were integrated into the sd_backend tests. With the new backend loading, we cannot configure a droplet backend if we did not build it, thus we need to extract the droplet tests so we can disable them completely.
This patch refactors all uses of IsFile() into individual checks that should do what the original author intended.
This is now implemented via SeekType. The refactored code also catches some cases when a backend does not override a required method.
Previously IsTape() was called for display purposes. This patch displays the configured Device Type instead.
Previously, the baseclasses for generic tape support and chunked devices were built as shared modules. As this code is never shared, we can just link it all into the resulting backends with no drawbacks at all.
Historically, we linked against a 3rd-party package. Thus we were using dynamic linking. As we're shipping libdroplet ourselves and there is no other consumer than the droplet storage backend, it is easier to link it directly into the backend.
As we have so many kinds of plugins, we'll just call it ImplementationFactory as it is a factory that returns implementations.
7143bcb to
62674a3
Compare
also set cmake_policy version to 3.17...3.19 enabling all policies present in CMake up until 3.19. CMake 3.19 contains the newest policy we require (CMP0109) which makes find_program() only check for executability but not readability which allows to find sudo.
615be9b to
bd4a80c
Compare
This file contains hidden or 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
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.
This changes the SD Backend and Device interface in a way that is supposed to make it easier to add new backends.
Device Typesetting will accept any string-tIsFile()andIsFifo()fromDevice(in favor of new checks)Please check
If you have any questions or problems, please give a comment in the PR.
Checklist for the reviewer of the PR (will be processed by the Bareos team)
General
Source code quality
bareos-check-sources --since-mergedoes not report any problems