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

stored: remove warning for maximum block size for tapes #1375

Conversation

sebsura
Copy link
Contributor

@sebsura sebsura commented Feb 10, 2023

Thank you for contributing to the Bareos Project!

When the storage daemon encounters a device config that contains 'Maximum Block Size = ...' it was always throwing the warning "[...] Setting 'Maximum Block Size' is only supported on tape devices' even if the device was a tape device.

The reason for this is twofold. The config parser puts the device_type verbatim into the DeviceResource object without taking care to lower case it for the many device_type = DeviceType::B_TAPE_DEV string comparisions.
Another bug amplified this: the validation of config objects included dummy object which do not contain every set option.
This included the device_type option, which was left blank; this caused the validation to never consider the device a tape drive.

Because of their small size this pr contains two other changes:

  • A printf style function is called in bnet.cc but a wrong format string was used
  • the default addresses and ports gtest failed when the developer is running a default bareos-dir in the background.
    a hint was added to let the developer know of this possibility if the particular test fails.

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
  • Check backport line
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

@sebsura sebsura changed the title remove storage daemon warning for maximum block size for tapes stored: remove storage daemon warning for maximum block size for tapes Feb 13, 2023
@sebsura sebsura changed the title stored: remove storage daemon warning for maximum block size for tapes stored: remove warning for maximum block size for tapes Feb 13, 2023
@sebsura sebsura marked this pull request as draft February 15, 2023 13:49
@sebsura sebsura force-pushed the dev/ssura/master/remove-warning-for-maximum-block-size branch from 9932601 to 086b941 Compare February 16, 2023 06:58
@sebsura sebsura marked this pull request as ready for review February 16, 2023 06:58
Copy link
Contributor

@alaaeddineelamri alaaeddineelamri left a comment

Choose a reason for hiding this comment

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

good for me :)

PR-tool reports commit messages that are too long:

abfefd42f gtest: warn developers to disable their local bareos instance: headline too long
508701648 tests: Write tape with capital t like our docs are saying to do it: headline too long

as a reminder for how the PR-tool works, commit headline should be <=60 characters, and commit body should be <=72 characters

@sebsura sebsura force-pushed the dev/ssura/master/remove-warning-for-maximum-block-size branch 2 times, most recently from b7e0773 to 4c5fbf7 Compare February 20, 2023 06:19
sebsura and others added 8 commits March 2, 2023 18:12
During pass 2 dummy resources are being created that end up not being
really used.  These dummy resources often do not get filled with the
complete information; in particular device_type was never filled out
since its std::string.

Previously the dummy resource was being used to validate the resource
configuration.  This lead to spurious warnings since the validator
expected the data to be actually correct, e.g. it checked to see if
the device_resource was a tape or not.  Since this info was not filled
out it threw a warning.

Now the resource created in pass 1 is used for validation.
Since the config parsing step does not always take care to lower case
the device type, we need to check case insensitivly wether the
device_type is tape or not!
Since other parts of the system are actually using equality
comparision, we should ensure that any validated resource is actually
usable by the rest of the system.  In this case we do this by
lower_case-ing the device type before we start the validation process.
Since the documentation uses capital letters our tests should reflect
that so that we do not miss any bugs that get introduced by this
discrepancy.
If you have a local bareos director running that is using a port that
a test wants to start a director on it will fail.  Normally this will
not happen but one particular test checks the default config.

In that case it might not be obvious to check wether you have a bareos
director running in the background.  This hint was added for this
particular purpose.
Similar to the situation in stored, here the pass 2 resources are just
dummies which do not contain every information.

As such we only validate resources from pass 1.
@arogge arogge force-pushed the dev/ssura/master/remove-warning-for-maximum-block-size branch from 538adc7 to c4affb1 Compare March 2, 2023 17:13
@arogge arogge merged commit 0bf71f4 into bareos:master Mar 2, 2023
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.

None yet

3 participants