Skip to content

storage: improve tapealert plugin#2370

Merged
BareosBot merged 3 commits intobareos:masterfrom
arogge:improve-tapealert
Oct 1, 2025
Merged

storage: improve tapealert plugin#2370
BareosBot merged 3 commits intobareos:masterfrom
arogge:improve-tapealert

Conversation

@arogge
Copy link
Member

@arogge arogge commented Sep 15, 2025

This PR resolves #2369 by extending the scsitapealert-sd plugin for the storage daemon to write proper tapealert reports into the joblog.
It also updates the documentation on how to setup the plugin.

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

There is no proper way of automated testing for this. However, I solemnly swear I tried it on physical and virtual tape libraries and it worked properly.

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.

On my side unifying TapeAlert word would be a significant plus. One line log has also my preference.
See also my other comment about build

@bruno-at-bareos
Copy link
Contributor

bruno-at-bareos commented Sep 16, 2025

Actually when I tried to build the pr failed around this stage

[ 41%] Building CXX object core/src/lib/CMakeFiles/bareos.dir/qualified_resource_name_type_converter.cc.o
cd /ioda/bareos/git/build/2370/core/src/lib && /usr/bin/ccache base_dir=/ioda/bareos/git/b-at-bareos hash_dir=true namespace=bareos /usr/bin/g++-15 -DHAVE_GCC=1 -D_FILE_OFFSET_BITS=64 -Dbareos_EXPORTS -I/ioda/bareos/git/b-at-bareos/core/src -I/ioda/bareos/git/build/2370/core/src -I/ioda/bareos/git/b-at-bareos/core/src/fastlz/include -isystem /usr/include/utf8cpp -fdebug-prefix-map=/ioda/bareos/git/b-at-bareos=/usr/src/bareos -fmacro-prefix-map=/ioda/bareos/git/b-at-bareos=/usr/src/bareos -Wsuggest-override -Wformat -Werror=format-security -Wno-invalid-offsetof -Werror -Wall -Wextra -Wshadow -std=gnu++17 -fPIC -MD -MT core/src/lib/CMakeFiles/bareos.dir/qualified_resource_name_type_converter.cc.o -MF CMakeFiles/bareos.dir/qualified_resource_name_type_converter.cc.o.d -o CMakeFiles/bareos.dir/qualified_resource_name_type_converter.cc.o -c /ioda/bareos/git/b-at-bareos/core/src/lib/qualified_resource_name_type_converter.cc
[ 42%] Linking CXX shared library libbareos.so
cd /ioda/bareos/git/build/2370/core/src/lib && /usr/bin/cmake -E cmake_link_script CMakeFiles/bareos.dir/link.txt --verbose=1
/usr/bin/g++-15 -fPIC  -fdebug-prefix-map=/ioda/bareos/git/b-at-bareos=/usr/src/bareos -fmacro-prefix-map=/ioda/bareos/git/b-at-bareos=/usr/src/bareos -Wsuggest-override -Wformat -Werror=format-security -Wno-invalid-offsetof -Werror -Wall -Wextra -Wshadow -Wl,--as-needed -Wl,--dependency-file=CMakeFiles/bareos.dir/link.d -shared -Wl,-soname,libbareos.so.25 -o libbareos.so.25.0.0 CMakeFiles/bareos.dir/address_conf.cc.o CMakeFiles/bareos.dir/alist.cc.o CMakeFiles/bareos.dir/attr.cc.o CMakeFiles/bareos.dir/attribs.cc.o CMakeFiles/bareos.dir/bareos_universal_initialiser.cc.o CMakeFiles/bareos.dir/backtrace.cc.o CMakeFiles/bareos.dir/base64.cc.o CMakeFiles/bareos.dir/berrno.cc.o CMakeFiles/bareos.dir/bget_msg.cc.o CMakeFiles/bareos.dir/binflate.cc.o CMakeFiles/bareos.dir/bnet_server_tcp.cc.o CMakeFiles/bareos.dir/bnet.cc.o CMakeFiles/bareos.dir/bnet_network_dump.cc.o CMakeFiles/bareos.dir/bnet_network_dump_private.cc.o CMakeFiles/bareos.dir/bpipe.cc.o CMakeFiles/bareos.dir/breg.cc.o CMakeFiles/bareos.dir/bregex.cc.o CMakeFiles/bareos.dir/bsnprintf.cc.o CMakeFiles/bareos.dir/bsock.cc.o CMakeFiles/bareos.dir/bsock_tcp.cc.o CMakeFiles/bareos.dir/bstringlist.cc.o CMakeFiles/bareos.dir/bsys.cc.o CMakeFiles/bareos.dir/btime.cc.o CMakeFiles/bareos.dir/btimers.cc.o CMakeFiles/bareos.dir/cbuf.cc.o CMakeFiles/bareos.dir/cli.cc.o CMakeFiles/bareos.dir/connection_pool.cc.o CMakeFiles/bareos.dir/cram_md5.cc.o CMakeFiles/bareos.dir/crypto.cc.o CMakeFiles/bareos.dir/crypto_cache.cc.o CMakeFiles/bareos.dir/crypto_openssl.cc.o CMakeFiles/bareos.dir/crypto_wrap.cc.o CMakeFiles/bareos.dir/daemon.cc.o CMakeFiles/bareos.dir/devlock.cc.o CMakeFiles/bareos.dir/dlist_string.cc.o CMakeFiles/bareos.dir/edit.cc.o CMakeFiles/bareos.dir/fnmatch.cc.o CMakeFiles/bareos.dir/guid_to_name.cc.o CMakeFiles/bareos.dir/hmac.cc.o CMakeFiles/bareos.dir/htable.cc.o CMakeFiles/bareos.dir/jcr.cc.o CMakeFiles/bareos.dir/lockmgr.cc.o CMakeFiles/bareos.dir/mem_pool.cc.o CMakeFiles/bareos.dir/message.cc.o CMakeFiles/bareos.dir/messages_resource.cc.o CMakeFiles/bareos.dir/mntent_cache.cc.o CMakeFiles/bareos.dir/monotonic_buffer.cc.o CMakeFiles/bareos.dir/output_formatter.cc.o CMakeFiles/bareos.dir/output_formatter_resource.cc.o CMakeFiles/bareos.dir/passphrase.cc.o CMakeFiles/bareos.dir/path_list.cc.o CMakeFiles/bareos.dir/plugins.cc.o CMakeFiles/bareos.dir/bpoll.cc.o CMakeFiles/bareos.dir/priv.cc.o CMakeFiles/bareos.dir/recent_job_results_list.cc.o CMakeFiles/bareos.dir/rblist.cc.o CMakeFiles/bareos.dir/runscript.cc.o CMakeFiles/bareos.dir/rwlock.cc.o CMakeFiles/bareos.dir/scan.cc.o CMakeFiles/bareos.dir/scsi_crypto.cc.o CMakeFiles/bareos.dir/scsi_lli.cc.o CMakeFiles/bareos.dir/serial.cc.o CMakeFiles/bareos.dir/signal.cc.o CMakeFiles/bareos.dir/status_packet.cc.o CMakeFiles/bareos.dir/thread_list.cc.o CMakeFiles/bareos.dir/thread_specific_data.cc.o CMakeFiles/bareos.dir/tls.cc.o CMakeFiles/bareos.dir/tls_conf.cc.o CMakeFiles/bareos.dir/tls_openssl.cc.o CMakeFiles/bareos.dir/tls_openssl_private.cc.o CMakeFiles/bareos.dir/tree.cc.o CMakeFiles/bareos.dir/try_tls_handshake_as_a_server.cc.o CMakeFiles/bareos.dir/compression.cc.o CMakeFiles/bareos.dir/util.cc.o CMakeFiles/bareos.dir/var.cc.o CMakeFiles/bareos.dir/watchdog.cc.o CMakeFiles/bareos.dir/xxhash.cc.o CMakeFiles/bareos.dir/bpipe_unix.cc.o CMakeFiles/bareos.dir/scsi_tapealert.cc.o CMakeFiles/bareos.dir/osinfo.cc.o CMakeFiles/bareos.dir/bareos_resource.cc.o CMakeFiles/bareos.dir/configured_tls_policy_getter.cc.o CMakeFiles/bareos.dir/lex.cc.o CMakeFiles/bareos.dir/parse_bsr.cc.o CMakeFiles/bareos.dir/res.cc.o CMakeFiles/bareos.dir/parse_conf.cc.o CMakeFiles/bareos.dir/parse_conf_init_resource.cc.o CMakeFiles/bareos.dir/parse_conf_state_machine.cc.o CMakeFiles/bareos.dir/qualified_resource_name_type_converter.cc.o "CMakeFiles/version-obj.dir/version.cc.o"  -Wl,-rpath,/ioda/bareos/git/build/2370/core/src/fastlz: ../fastlz/libbareosfastlz.so.25.0.0 /usr/lib64/libssl.so /usr/lib64/libz.so /usr/lib64/libxxhash.so -ldl /usr/lib64/liblzo2.so /usr/lib64/libjansson.so /usr/lib64/libcrypto.so
cd /ioda/bareos/git/build/2370/core/src/plugins/filed/grpc && /usr/lib/rpm/debugedit -b /usr/src/bareos -d /ioda/bareos/git/b-at-bareos /ioda/bareos/git/build/2370/core/src/plugins/filed/grpc/grpc-test-module
make[2]: Leaving directory '/ioda/bareos/git/build/2370'
[ 42%] Built target grpc-test-module
cd /ioda/bareos/git/build/2370/core/src/plugins/filed/grpc && /usr/lib/rpm/debugedit -b /usr/src/bareos -d /ioda/bareos/git/b-at-bareos /ioda/bareos/git/build/2370/core/src/plugins/filed/grpc/bareos-grpc-fd-plugin-bridge
make[2]: Leaving directory '/ioda/bareos/git/build/2370'
[ 42%] Built target bareos-grpc-fd-plugin-bridge
cd /ioda/bareos/git/build/2370/core/src/lib && /usr/bin/cmake -E cmake_symlink_library libbareos.so.25.0.0 libbareos.so.25 libbareos.so
cd /ioda/bareos/git/build/2370/core/src/lib && /usr/lib/rpm/debugedit -b /usr/src/bareos -d /ioda/bareos/git/b-at-bareos /ioda/bareos/git/build/2370/core/src/lib/libbareos.so.25.0.0
make[2]: Leaving directory '/ioda/bareos/git/build/2370'
[ 42%] Built target bareos
make[1]: Leaving directory '/ioda/bareos/git/build/2370'
make: *** [Makefile:149: all] Error 2

My cmake looks like

cmake \
  -DCMAKE_VERBOSE_MAKEFILE=ON \
  -Dcoverage=OFF \
  -DCMAKE_INSTALL_PREFIX:PATH=/usr \
  -DCMAKE_INSTALL_LIBDIR:PATH=/usr/lib \
  -DINCLUDE_INSTALL_DIR:PATH=/usr/include \
  -DLIB_INSTALL_DIR:PATH=/usr/lib \
  -DSYSCONF_INSTALL_DIR:PATH=/etc \
  -DSHARE_INSTALL_PREFIX:PATH=/usr/share \
  -DBUILD_SHARED_LIBS:BOOL=ON \
  -Dprefix=$(rpm --eval %{_prefix})\
  -Dlibdir=$(rpm --eval %{_libdir})/bareos \
  -Dsbindir=$(rpm --eval %{_sbindir}) \
  -Dsysconfdir=$(rpm --eval %{_sysconfdir}) \
  -Dconfdir=$(rpm --eval %{_sysconfdir})/bareos \
  -Dmandir=$(rpm --eval %{_mandir}) \
  -Darchivedir=/var/lib/bareos/storage \
  -Dbackenddir=$(rpm --eval %{_libdir})/bareos/backends \
  -Dscriptdir=/usr/lib/bareos/scripts \
  -Dworkingdir=/var/lib/bareos \
  -Dplugindir=$(rpm --eval %{_libdir})/bareos/plugins \
  -Dlogdir=/var/log/bareos \
  -Dsubsysdir=/run/lock \
  -Dscsi-crypto=ON \
  -Dndmp=ON \
  -Ddir-user=bareos \
  -Ddir-group=bareos \
  -Dsd-user=bareos \
  -Dsd-group=bareos \
  -Dfd-user=root \
  -Dfd-group=bareos \
  -Ddir-password="XXX_REPLACE_WITH_DIRECTOR_PASSWORD_XXX" \
  -Dfd-password="XXX_REPLACE_WITH_CLIENT_PASSWORD_XXX" \
  -Dsd-password="XXX_REPLACE_WITH_STORAGE_PASSWORD_XXX" \
  -Dmon-dir-password="XXX_REPLACE_WITH_DIRECTOR_MONITOR_PASSWORD_XXX" \
  -Dmon-fd-password="XXX_REPLACE_WITH_CLIENT_MONITOR_PASSWORD_XXX" \
  -Dmon-sd-password="XXX_REPLACE_WITH_STORAGE_MONITOR_PASSWORD_XXX" \
  -Dbasename="XXX_REPLACE_WITH_LOCAL_HOSTNAME_XXX" \
  -DENABLE_WEBUI=OFF \
  -DENABLE_SANITIZERS=${DOSANITIZERS:-OFF} \
  -DENABLE_GRPC=ON \
  -Dchanger-device=/dev/sch0 \
  -Dtape-devices="/dev/nst0;/dev/nst1;/dev/nst2;/dev/nst3" \
  -DMT=/usr/bin/mt \
  -DMTX=/usr/sbin/mtx'
  ../bareos 

gcc --version gcc (SUSE Linux) 15.2.0

@arogge
Copy link
Member Author

arogge commented Sep 25, 2025

On my side unifying TapeAlert word would be a significant plus. One line log has also my preference. See also my other comment about build

yep, that's reasonable. I changed the strings to TapeAlert. The log lines are one-liners, so grep TapeAlert will print all TapeAlerts from the log, just the additional information (i.e. full text and possible cause) are on separate lines.

Concerning your build, I cannot see what failed. The error is further ahead in the log. Probably easiest if you rerun with make -j1 after it failed once, so we get synchronous output.

Copy link
Contributor

@sebsura sebsura left a comment

Choose a reason for hiding this comment

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

Thanks for the great work! This will help a lot with weird tape related issues!

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.

Build is ok, nice improvement, congrats.

@arogge arogge mentioned this pull request Sep 30, 2025
7 tasks
arogge and others added 3 commits October 1, 2025 15:44
* handle more event types
* log flags as job messages
* provide T10 standardized messages
* limitations of Alert Command
* configuration of scsitapealert-sd plugin
@BareosBot BareosBot merged commit 59594fb into bareos:master Oct 1, 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.

improve tapealert plugin

4 participants