Skip to content

bareos-fd: add option for grpc fallback#2104

Merged
BareosBot merged 21 commits intobareos:masterfrom
sebsura:dev/ssura/master/auto-grpc
Mar 5, 2025
Merged

bareos-fd: add option for grpc fallback#2104
BareosBot merged 21 commits intobareos:masterfrom
sebsura:dev/ssura/master/auto-grpc

Conversation

@sebsura
Copy link
Contributor

@sebsura sebsura commented Jan 6, 2025

This PR adds a new option to the bareos-fd: Grpc Module (Fd->Client).

If this option is set, and the grpc plugin is loaded, then the fd will try to use the specified grpc module to load any plugin that the fd did not already load itself.

As an example: If you instruct the fd to load only the grpc plugin, but not the python plugin (i.e. specifiying only grpc in Plugin Names (Fd->Client), and the director sends a fileset which specifies the python plugin, then the fd will use the specified grpc module (via the grpc plugin) to load the python plugin.

This PR also adds two types of tests for this:

  1. a manually created test that checks that backups are interchangable between a client using the new grpc feature and a client using the old python plugin.
  2. it (automatically) adds a new test for each already existing python test which causes the fd to use the grpc module instead of using the python plugin.

TODO:

  • write documentation
  • add grpc adr
  • rename grpc-python-module -> bareos-grpc-fd-python-bridge

Thank you for contributing to the Bareos Project!

Please check

  • Short description and the purpose of this PR is present above this paragraph
  • Your name is present in the AUTHORS file (optional)

If you have any questions or problems, please give a comment in the PR.

Helpful documentation and best practices

Checklist for the reviewer of the PR (will be processed by the Bareos team)

Make sure you check/merge the PR using devtools/pr-tool to have some simple automated checks run and a proper changelog record added.

General
  • Is the PR title usable as CHANGELOG entry?
  • Purpose of the PR is understood
  • Commit descriptions are understandable and well formatted
  • Required backport PRs have been created
  • Correct milestone is set
Source code quality
  • Source code changes are understandable
  • Variable and function names are meaningful
  • Code comments are correct (logically and spelling)
  • Required documentation changes are present and part of the PR
Tests
  • Decision taken that a test is required (if not, then remove this paragraph)
  • The choice of the type of test (unit test or systemtest) is reasonable
  • Testname matches exactly what is being tested
  • On a fail, output of the test leads quickly to the origin of the fault

@sebsura sebsura added this to the 25.0.0 milestone Jan 6, 2025
@sebsura sebsura self-assigned this Jan 6, 2025
@bruno-at-bareos bruno-at-bareos self-requested a review January 6, 2025 13:28
@arogge
Copy link
Member

arogge commented Jan 7, 2025

We don't need the option to select the compatibility module, as it will only be used when grpc module is loaded, but the requested module is not.

Copy link
Contributor

@bruno-at-bareos bruno-at-bareos left a comment

Choose a reason for hiding this comment

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

Nice work, eager to get it merge. Until that I've a few remarks, and would like to have second pair of eyes n filed_conf.cc and fd_plugins

@sebsura sebsura force-pushed the dev/ssura/master/auto-grpc branch 3 times, most recently from dc615d8 to c0fedc9 Compare January 15, 2025 10:51
@sebsura
Copy link
Contributor Author

sebsura commented Jan 15, 2025

Rebased onto master because of a confict

@bruno-at-bareos bruno-at-bareos force-pushed the dev/ssura/master/auto-grpc branch from aff470a to 035c24a Compare January 15, 2025 13:54
@sebsura sebsura force-pushed the dev/ssura/master/auto-grpc branch from 2bd7130 to a627c60 Compare January 17, 2025 07:15
@bruno-at-bareos bruno-at-bareos self-requested a review January 21, 2025 14:31
Copy link
Contributor

@bruno-at-bareos bruno-at-bareos left a comment

Choose a reason for hiding this comment

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

Redone a bunch of tests especially those mixing grpc and native, with no troubles.
On my side I would approve the great work done.
Now pass the ball to another C++ in depth review.

@sebsura sebsura force-pushed the dev/ssura/master/auto-grpc branch from a627c60 to 298518b Compare January 22, 2025 09:01
@sebsura sebsura requested a review from pstorz January 23, 2025 11:59
@sebsura sebsura force-pushed the dev/ssura/master/auto-grpc branch 2 times, most recently from 8f82381 to b1672c7 Compare January 29, 2025 05:59
@sebsura sebsura force-pushed the dev/ssura/master/auto-grpc branch 3 times, most recently from 3a5fae4 to 5646340 Compare February 5, 2025 13:12
@sduehr
Copy link
Member

sduehr commented Feb 7, 2025

Thanks, tested this with the VMware plugin, works fine.

@sebsura sebsura force-pushed the dev/ssura/master/auto-grpc branch 2 times, most recently from 6bb9967 to f369743 Compare February 20, 2025 08:37
@pstorz pstorz self-requested a review February 20, 2025 08:45
Copy link
Member

@pstorz pstorz left a comment

Choose a reason for hiding this comment

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

Please see comments

@sebsura sebsura requested a review from pstorz February 27, 2025 09:25
@sebsura sebsura dismissed bruno-at-bareos’s stale review February 28, 2025 10:56

It looks like this is blocking the merge

@sebsura sebsura force-pushed the dev/ssura/master/auto-grpc branch from 048c8a3 to 4118cad Compare March 3, 2025 06:40
sebsura and others added 21 commits March 5, 2025 09:45
This will later be used to run all normal plugins through grpc
When a plugin cannot be found, the grpc plugin is loaded and a
grpc compat module is defined, then we try to load that plugin with
that compat module.

To facilitate this we must make sure that the plugin handling is able
to modify the plugin command strings both into the plugin and out of
the plugin as we need to add/remove the grpc prefix.

We also remove the `reverse` option of `GeneratePluginEvent` as it was
unused and would mess with the (already complicated) grpc fallback
logic.
Since auto grpc needs completely different plugins on the filed and
director, we now have two different variables: python_module_name and
dir_python_module_name for python tests.
python_module_name is the module name on the fd side, whereas
dir_python_module_name is the module name on the director side.

This also removes the need for the python_module_suffix as the normal
grpc tests can now just specify the dir module name directly.
Currently the core adds fallbacks for the python plugin, so that even
if your fd has python3-fd and your fileset specifies just "python", it
will still work.  This also has to be supported in the grpc python
module for painless transitions.
This makes the transition to grpc easier as users just have to set
their plugin names to grpc.
The name did not say much and was also misleading.  We chose a name
that hopefully makes it clear what it actually does when it shows up
in a process explorer.
This argument is used in the vmware plugin, so we cannot just ignore
it.
Our systemtests will quit when `waitpid` sees a zombie process.  This
can happen when the system is under a lot of load.  Because of this we
wait for 1 second after discovering a zombie process to give the
system some time to clean it up.
This test sometimes fails because scheduling sometimes takes a lot of
time (~10secs), causing the first job to be executed first even though
it waited for a long time.
@BareosBot BareosBot force-pushed the dev/ssura/master/auto-grpc branch from fbcf911 to 17548b5 Compare March 5, 2025 09:45
@BareosBot BareosBot merged commit 49cfd28 into bareos:master Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants