Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/bareos/bareos.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Rogge <andreas.rogge@bareos.com>2022-11-09 18:18:04 +0300
committerGitHub <noreply@github.com>2022-11-09 18:18:04 +0300
commit95f1be87cebe22d951cf9a551239632ce96e7937 (patch)
treecf43f2e98702b8b498e15256b60d28d7b56baa4a
parentec48e4513add94397e9a9ee63c8aab4fd6211a14 (diff)
parentbd4a80c1ca5db5580393e18a7b99f8b137e6a1fe (diff)
Merge pull request #1272
sd: refactor the SD's backend interface
-rw-r--r--.gitignore10
-rw-r--r--CHANGELOG.md5
-rw-r--r--CMakeLists.txt3
-rw-r--r--cmake/BareosSetVariableDefaults.cmake18
-rw-r--r--contrib/CMakeLists.txt1
-rw-r--r--core/CMakeLists.txt17
-rw-r--r--core/platforms/freebsd/bareos-freebsd/bareos.com-common/pkg-plist.storage1
-rw-r--r--core/platforms/freebsd/bareos-freebsd/bareos.com-common/pkg-plist.storage-tape1
-rw-r--r--core/platforms/packaging/bareos.spec6
-rw-r--r--core/src/droplet/CMakeLists.txt3
-rw-r--r--core/src/droplet/libdroplet/CMakeLists.txt7
-rw-r--r--core/src/fastlz/CMakeLists.txt1
-rw-r--r--core/src/lib/implementation_factory.h67
-rw-r--r--core/src/lib/parse_conf.h2
-rw-r--r--core/src/lib/res.cc2
-rw-r--r--core/src/lib/util.cc7
-rw-r--r--core/src/lib/util.h1
-rw-r--r--core/src/qt-tray-monitor/CMakeLists.txt3
-rw-r--r--core/src/stored/CMakeLists.txt42
-rw-r--r--core/src/stored/acquire.cc2
-rw-r--r--core/src/stored/backends/CMakeLists.txt56
-rw-r--r--core/src/stored/backends/cephfs_device.h61
-rw-r--r--core/src/stored/backends/droplet_device.cc19
-rw-r--r--core/src/stored/backends/droplet_device.h4
-rw-r--r--core/src/stored/backends/generic_tape_device.h3
-rw-r--r--core/src/stored/backends/gfapi_device.cc21
-rw-r--r--core/src/stored/backends/gfapi_device.h6
-rw-r--r--core/src/stored/backends/unix_fifo_device.cc21
-rw-r--r--core/src/stored/backends/unix_fifo_device.h3
-rw-r--r--core/src/stored/backends/unix_file_device.cc8
-rw-r--r--core/src/stored/backends/unix_file_device.h7
-rw-r--r--core/src/stored/backends/unix_tape_device.cc22
-rw-r--r--core/src/stored/backends/win32_fifo_device.cc (renamed from core/src/win32/stored/backends/win32_fifo_device.cc)3
-rw-r--r--core/src/stored/backends/win32_fifo_device.h (renamed from core/src/win32/stored/backends/win32_fifo_device.h)9
-rw-r--r--core/src/stored/backends/win32_file_device.cc (renamed from core/src/win32/stored/backends/win32_file_device.cc)8
-rw-r--r--core/src/stored/backends/win32_file_device.h (renamed from core/src/win32/stored/backends/win32_file_device.h)11
-rw-r--r--core/src/stored/backends/win32_tape_device.cc (renamed from core/src/win32/stored/backends/win32_tape_device.cc)3
-rw-r--r--core/src/stored/backends/win32_tape_device.h (renamed from core/src/win32/stored/backends/win32_tape_device.h)8
-rw-r--r--core/src/stored/btape.cc4
-rw-r--r--core/src/stored/dev.cc338
-rw-r--r--core/src/stored/dev.h63
-rw-r--r--core/src/stored/device_resource.cc13
-rw-r--r--core/src/stored/device_resource.h22
-rw-r--r--core/src/stored/mount.cc146
-rw-r--r--core/src/stored/scan.cc11
-rw-r--r--core/src/stored/sd_backends.cc217
-rw-r--r--core/src/stored/sd_backends.h49
-rw-r--r--core/src/stored/sd_backends_dynamic.cc78
-rw-r--r--core/src/stored/status.cc27
-rw-r--r--core/src/stored/stored.cc4
-rw-r--r--core/src/stored/stored_conf.cc125
-rw-r--r--core/src/stored/vol_mgr.cc5
-rw-r--r--core/src/tests/CMakeLists.txt2
-rw-r--r--core/src/tests/configs/bareos-configparser-tests/bareos-sd.d/device/FileStorage.conf1
-rw-r--r--core/src/tests/configs/bareos-configparser-tests/bareos-sd.d/storage/bareos-sd.conf.in (renamed from core/src/tests/configs/bareos-configparser-tests/bareos-sd.d/storage/bareos-sd.conf)2
-rw-r--r--core/src/tests/configs/droplet_backend/bareos-sd.d/device/droplet.conf.in (renamed from core/src/tests/configs/sd_backend/bareos-sd.d/device/droplet.conf.in)2
-rw-r--r--core/src/tests/configs/droplet_backend/bareos-sd.d/storage/myself.conf.in5
-rw-r--r--core/src/tests/configs/droplet_backend/droplet.profile.in (renamed from core/src/tests/configs/sd_backend/droplet.profile.in)0
-rw-r--r--core/src/tests/configs/sd_reservation/bareos-sd.d/device/auto1.conf3
-rw-r--r--core/src/tests/configs/sd_reservation/bareos-sd.d/device/auto2.conf5
-rw-r--r--core/src/tests/configs/sd_reservation/bareos-sd.d/device/single2.conf1
-rw-r--r--core/src/tests/configs/statistics_thread/sd_statistics_thread/default_config/bareos-sd.d/storage/myself.conf3
-rw-r--r--core/src/tests/configs/statistics_thread/sd_statistics_thread/default_config/bareos-sd.d/storage/myself.conf.in4
-rw-r--r--core/src/tests/configs/statistics_thread/sd_statistics_thread/only_collect_set/bareos-sd.d/storage/myself.conf4
-rw-r--r--core/src/tests/configs/statistics_thread/sd_statistics_thread/only_collect_set/bareos-sd.d/storage/myself.conf.in5
-rw-r--r--core/src/tests/configs/statistics_thread/sd_statistics_thread/only_interval_set/bareos-sd.d/storage/myself.conf4
-rw-r--r--core/src/tests/configs/statistics_thread/sd_statistics_thread/only_interval_set/bareos-sd.d/storage/myself.conf.in5
-rw-r--r--core/src/tests/configs/stored_multiplied_device/bareos-sd.d/device/FileStorage.conf9
-rw-r--r--core/src/tests/configs/stored_multiplied_device/bareos-sd.d/storage/bareos-sd.conf11
-rw-r--r--core/src/tests/configs/stored_multiplied_device/bareos-sd.d/storage/bareos-sd.conf.in4
-rw-r--r--core/src/tests/droplet_backend.cc192
-rw-r--r--core/src/tests/sd_backend.cc233
-rw-r--r--core/src/tests/sd_backend_tests.h75
-rw-r--r--core/src/tests/sd_reservation.cc7
-rw-r--r--core/src/vmware/CMakeLists.txt3
-rw-r--r--debian/bareos-storage-droplet.install.in2
-rw-r--r--debian/bareos-storage-tape.install.in1
-rw-r--r--debian/bareos-storage.install.in1
-rw-r--r--debian/control2
-rw-r--r--debian/control.src2
-rw-r--r--docs/manuals/CMakeLists.txt2
-rw-r--r--docs/manuals/source/include/autogenerated/bareos-dir-config-schema.json4
-rw-r--r--docs/manuals/source/include/autogenerated/bareos-sd-config-schema.json3
-rw-r--r--get_version.cmake5
-rw-r--r--systemtests/CMakeLists.txt1
-rw-r--r--systemtests/cmake/BareosSystemtestFunctions.cmake12
-rw-r--r--systemtests/scripts/functions3
-rwxr-xr-xsystemtests/scripts/start_bareos.sh3
-rw-r--r--systemtests/tests/acl/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/always-incremental-consolidate/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/autochanger/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in2
-rwxr-xr-xsystemtests/tests/autochanger/test-setup1
-rw-r--r--systemtests/tests/bareos-acl/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/bareos/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in2
-rwxr-xr-xsystemtests/tests/bareos/test-setup3
-rw-r--r--systemtests/tests/bconsole/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/bconsole/etc/bareos/bconsole.conf.in1
-rw-r--r--systemtests/tests/block-size/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in2
-rw-r--r--systemtests/tests/bscan-bextract-bls-bcopy/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/checkpoints/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rwxr-xr-xsystemtests/tests/checkpoints/test-setup1
-rwxr-xr-xsystemtests/tests/checkpoints/testrunner-checkpoints-on-stop1
-rw-r--r--systemtests/tests/chflags/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/client-initiated/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/commandline-options/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/config-syntax-crash/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/copy-archive-job/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/copy-migrate/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/copy-remote-bscan/etc/bareos-remote/bareos-sd.d/device/FileStorage.conf2
-rw-r--r--systemtests/tests/copy-remote-bscan/etc/bareos-remote/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/copy-remote-bscan/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/dbcopy-mysql-postgresql/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/deprecation/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/droplet-s3/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in2
-rw-r--r--systemtests/tests/encrypt-signature-no-tls/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/encrypt-signature-tls-cert/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/fileset-multiple-blocks/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/filesets/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/gfapi-fd/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/glusterfs-backend/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in2
-rw-r--r--systemtests/tests/list-backups/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/multiplied-device/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/ndmp/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/notls/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/parallel-jobs/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rwxr-xr-xsystemtests/tests/parallel-jobs/test-setup1
-rw-r--r--systemtests/tests/passive/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/pruning/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/py2plug-dir/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/py2plug-dir/lsan-suppressions.txt1
-rwxr-xr-xsystemtests/tests/py2plug-dir/testrunner3
-rw-r--r--systemtests/tests/py2plug-fd-contrib-bareos_tasks_mysql/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/py2plug-fd-ldap/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/py2plug-fd-libcloud/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/py2plug-fd-local-fileset-basic/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/py2plug-fd-local-fileset-restoreobject/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/py2plug-fd-mariabackup/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/py2plug-fd-ovirt/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/py2plug-fd-percona-xtrabackup/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/py2plug-fd-vmware/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/py2plug-sd/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/py3plug-fd-contrib-mysql_dump/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/py3plug-fd-postgres/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/python-bareos/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rwxr-xr-xsystemtests/tests/python-bareos/test-setup1
-rw-r--r--systemtests/tests/quota-softquota/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/restapi/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/scheduler-backup/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rwxr-xr-xsystemtests/tests/scheduler-backup/test-setup1
-rw-r--r--systemtests/tests/sparse-file/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/spool/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/stresstest/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rwxr-xr-xsystemtests/tests/stresstest/test-setup1
-rw-r--r--systemtests/tests/truncate-command/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/virtualfull-bscan/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/virtualfull/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/webui-common/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--systemtests/tests/xattr/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in1
-rw-r--r--webui/CMakeLists.txt3
-rw-r--r--write_version_files.cmake5
160 files changed, 1063 insertions, 1220 deletions
diff --git a/.gitignore b/.gitignore
index f6667e418..773072ed6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -110,6 +110,7 @@ core/src/defaultconfigs/tray-monitor.d/storage/StorageDaemon-local.conf
core/src/include/config.h
core/src/qt-tray-monitor/bareos-tray-monitor.desktop
core/src/tests/configs/bareos-configparser-tests/bareos-dir-CFG_TYPE_STR_VECTOR_OF_DIRS.conf
+core/src/tests/configs/bareos-configparser-tests/bareos-sd.d/storage/bareos-sd.conf
core/src/tests/configs/catalog/bareos-dir.d/catalog/MyCatalog.conf
core/src/tests/configs/console-director/tls_disabled/bareos-dir.d/director/bareos-dir.conf
core/src/tests/configs/console-director/tls_disabled/bareos-dir.d/fileset/Catalog.conf
@@ -127,10 +128,15 @@ core/src/tests/configs/console-director/tls_psk_default_enabled/bareos-dir.d/job
core/src/tests/configs/console-director/tls_psk_default_enabled/bareos-dir.d/jobdefs/DefaultJob.conf
core/src/tests/configs/console-director/tls_psk_default_enabled/bareos-dir.d/messages/Daemon.conf
core/src/tests/configs/console-director/tls_psk_default_enabled/bareos-dir.d/messages/Standard.conf
-core/src/tests/configs/sd_backend/bareos-sd.d/device/droplet.conf
+core/src/tests/configs/droplet_backend/bareos-sd.d/device/droplet.conf
+core/src/tests/configs/droplet_backend/bareos-sd.d/storage/myself.conf
+core/src/tests/configs/droplet_backend/droplet.profile
core/src/tests/configs/sd_backend/bareos-sd.d/storage/myself.conf
-core/src/tests/configs/sd_backend/droplet.profile
core/src/tests/configs/sd_reservation/bareos-sd.d/storage/myself.conf
+core/src/tests/configs/statistics_thread/sd_statistics_thread/default_config/bareos-sd.d/storage/myself.conf
+core/src/tests/configs/statistics_thread/sd_statistics_thread/only_collect_set/bareos-sd.d/storage/myself.conf
+core/src/tests/configs/statistics_thread/sd_statistics_thread/only_interval_set/bareos-sd.d/storage/myself.conf
+core/src/tests/configs/stored_multiplied_device/bareos-sd.d/storage/bareos-sd.conf
core/src/win32/console/consoleres.rc
core/src/win32/dird/dbcheckres.rc
core/src/win32/dird/dirdres.rc
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ebd5c7356..18ffca8d8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -104,7 +104,7 @@ and since Bareos version 20 this project adheres to [Semantic Versioning](https:
- testfind: remove unnecessary libraries and fix systemtest [PR #1250]
- stored: systemtests: docs: checkpoints improvements [PR #1277]
- winbareos.nsi: fix working directory in configure.sed [PR #1288]
-- core: BareosDb::FindLastJobStartTimeForJobAndClient: take into account Running job [PR #1265] [BUG #1466]
+- core: BareosDb::FindLastJobStartTimeForJobAndClient: take into account Running job [PR #1265] [Issue #1466]
- backup.cc: fail backup when `Write Bootstrap` to pipe fails [PR #1296]
- webui: fix pool link in job details formatter [PR 1306] [BUG #1489]
@@ -146,6 +146,7 @@ and since Bareos version 20 this project adheres to [Semantic Versioning](https:
- build: enable -Wextra warning level and apply required changes [PR #1261]
- lib: make foreach_res() reload-safe [PR #1279]
- Prepare Bareos for an upgrade to the C++20 standard [PR #1271]
+- stored: refactor the SD's backend interface [PR #1272]
### Deprecated
- make_catalog_backup.pl is now a shell wrapper script which will be removed in version 23.
@@ -205,6 +206,7 @@ and since Bareos version 20 this project adheres to [Semantic Versioning](https:
[Issue #1445]: https://bugs.bareos.org/view.php?id=1445
[Issue #1450]: https://bugs.bareos.org/view.php?id=1450
[Issue #1452]: https://bugs.bareos.org/view.php?id=1452
+[Issue #1466]: https://bugs.bareos.org/view.php?id=1466
[Issue #1477]: https://bugs.bareos.org/view.php?id=1477
[Issue #1480]: https://bugs.bareos.org/view.php?id=1480
[Issue #4607]: https://bugs.bareos.org/view.php?id=4607
@@ -343,6 +345,7 @@ and since Bareos version 20 this project adheres to [Semantic Versioning](https:
[PR #1268]: https://github.com/bareos/bareos/pull/1268
[PR #1270]: https://github.com/bareos/bareos/pull/1270
[PR #1271]: https://github.com/bareos/bareos/pull/1271
+[PR #1272]: https://github.com/bareos/bareos/pull/1272
[PR #1275]: https://github.com/bareos/bareos/pull/1275
[PR #1277]: https://github.com/bareos/bareos/pull/1277
[PR #1278]: https://github.com/bareos/bareos/pull/1278
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5f2690ef5..929edd985 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,7 +18,8 @@
# 02110-1301, USA.
message("Entering ${CMAKE_CURRENT_SOURCE_DIR}")
-cmake_minimum_required(VERSION 3.12)
+cmake_minimum_required(VERSION 3.17)
+cmake_policy(VERSION 3.17...3.19)
project(bareos NONE)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
diff --git a/cmake/BareosSetVariableDefaults.cmake b/cmake/BareosSetVariableDefaults.cmake
index 811298982..eb7c56087 100644
--- a/cmake/BareosSetVariableDefaults.cmake
+++ b/cmake/BareosSetVariableDefaults.cmake
@@ -1,6 +1,6 @@
# BAREOSĀ® - Backup Archiving REcovery Open Sourced
#
-# Copyright (C) 2017-2021 Bareos GmbH & Co. KG
+# Copyright (C) 2017-2022 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
@@ -394,15 +394,17 @@ else()
endif()
# dynamic-storage-backends
-if(NOT DEFINED dynamic-storage-backends)
+if(NOT DEFINED dynamic-storage-backends OR dynamic-storage-backends)
set(dynamic-storage-backends ON)
- set(HAVE_DYNAMIC_SD_BACKENDS 1)
+ set(HAVE_DYNAMIC_SD_BACKENDS
+ 1
+ CACHE INTERNAL ""
+ )
else()
- if(${dynamic-storage-backends})
- set(HAVE_DYNAMIC_SD_BACKENDS 1)
- else()
- set(HAVE_DYNAMIC_SD_BACKENDS 0)
- endif()
+ set(HAVE_DYNAMIC_SD_BACKENDS
+ 0
+ CACHE INTERNAL ""
+ )
endif()
# scsi-crypto
diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt
index e0086aa4c..45a8ee57d 100644
--- a/contrib/CMakeLists.txt
+++ b/contrib/CMakeLists.txt
@@ -17,7 +17,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
message("Entering ${CMAKE_CURRENT_SOURCE_DIR}")
-cmake_minimum_required(VERSION 3.0)
project(bareos-contrib)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt
index e8a1c1467..489b2825e 100644
--- a/core/CMakeLists.txt
+++ b/core/CMakeLists.txt
@@ -17,8 +17,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
message("Entering ${CMAKE_CURRENT_SOURCE_DIR}")
-
-cmake_minimum_required(VERSION 3.12)
project(bareos C CXX)
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
@@ -28,13 +26,6 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
)
endif()
-cmake_policy(SET CMP0054 NEW)
-cmake_policy(SET CMP0057 NEW)
-
-if(POLICY CMP0109)
- cmake_policy(SET CMP0109 NEW)
-endif(POLICY CMP0109)
-
# disable in-source builds
if("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
message(FATAL_ERROR "In-source builds are not allowed.")
@@ -422,14 +413,6 @@ if(NOT client-only
# directory it is also not safe on 32-bit systems, so we only build it on
# 64-bit
add_subdirectory(src/droplet)
- if(TARGET droplet)
- set_target_properties(
- droplet
- PROPERTIES VERSION "${BAREOS_NUMERIC_VERSION}"
- SOVERSION "${BAREOS_VERSION_MAJOR}"
- PREFIX "libbareos"
- )
- endif()
endif()
include(BareosGenerateDebianInfo)
diff --git a/core/platforms/freebsd/bareos-freebsd/bareos.com-common/pkg-plist.storage b/core/platforms/freebsd/bareos-freebsd/bareos.com-common/pkg-plist.storage
index 4e19878bb..fd456b2ec 100644
--- a/core/platforms/freebsd/bareos-freebsd/bareos.com-common/pkg-plist.storage
+++ b/core/platforms/freebsd/bareos-freebsd/bareos.com-common/pkg-plist.storage
@@ -13,6 +13,7 @@
sbin/bareos-sd
lib/bareos/scripts/disk-changer
lib/bareos/plugins/autoxflate-sd.so
+lib/libbareossd-file.so
man/man8/bareos-sd.8.gz
@dir(bareos,bareos,0775) /var/lib/bareos/storage
etc/rc.d/bareos-sd
diff --git a/core/platforms/freebsd/bareos-freebsd/bareos.com-common/pkg-plist.storage-tape b/core/platforms/freebsd/bareos-freebsd/bareos.com-common/pkg-plist.storage-tape
index b455bfc63..d1aeae197 100644
--- a/core/platforms/freebsd/bareos-freebsd/bareos.com-common/pkg-plist.storage-tape
+++ b/core/platforms/freebsd/bareos-freebsd/bareos.com-common/pkg-plist.storage-tape
@@ -1,5 +1,4 @@
-lib/libbareossd-gentape.so
lib/libbareossd-tape.so
lib/bareos/scripts/mtx-changer
@sample %%ETCDIR%%/mtx-changer.conf.sample
diff --git a/core/platforms/packaging/bareos.spec b/core/platforms/packaging/bareos.spec
index a51f5c05c..bd87de891 100644
--- a/core/platforms/packaging/bareos.spec
+++ b/core/platforms/packaging/bareos.spec
@@ -148,7 +148,7 @@ BuildRequires: git-core
Source0: %{name}-%{version}.tar.gz
-BuildRequires: cmake >= 3.12
+BuildRequires: cmake >= 3.17
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: make
@@ -1300,6 +1300,7 @@ mkdir -p %{?buildroot}/%{_libdir}/bareos/plugins/vmware_plugin
%{_sbindir}/bareos-sd
%{script_dir}/disk-changer
%{plugin_dir}/autoxflate-sd.so
+%{backend_dir}/libbareossd-file*.so
%{_mandir}/man8/bareos-sd.8.gz
%if 0%{?systemd_support}
%{_unitdir}/bareos-sd.service
@@ -1309,7 +1310,6 @@ mkdir -p %{?buildroot}/%{_libdir}/bareos/plugins/vmware_plugin
%files storage-tape
# tape specific files
%defattr(-, root, root)
-%{backend_dir}/libbareossd-gentape*.so
%{backend_dir}/libbareossd-tape*.so
%{script_dir}/mtx-changer
%config(noreplace) %{_sysconfdir}/%{name}/mtx-changer.conf
@@ -1332,9 +1332,7 @@ mkdir -p %{?buildroot}/%{_libdir}/bareos/plugins/vmware_plugin
%if 0%{?droplet}
%files storage-droplet
%defattr(-, root, root)
-%{backend_dir}/libbareossd-chunked*.so
%{backend_dir}/libbareossd-droplet*.so
-%{library_dir}/libbareosdroplet.so*
%attr(0640, %{director_daemon_user},%{daemon_group}) %{_sysconfdir}/%{name}/bareos-dir.d/storage/S3_Object.conf.example
%attr(0640, %{storage_daemon_user},%{daemon_group}) %{_sysconfdir}/%{name}/bareos-sd.d/device/S3_ObjectStorage.conf.example
%dir %{_sysconfdir}/%{name}/bareos-sd.d/device/droplet/
diff --git a/core/src/droplet/CMakeLists.txt b/core/src/droplet/CMakeLists.txt
index 42f33fceb..6ccbceec2 100644
--- a/core/src/droplet/CMakeLists.txt
+++ b/core/src/droplet/CMakeLists.txt
@@ -1,6 +1,6 @@
# BAREOSĀ® - Backup Archiving REcovery Open Sourced
#
-# Copyright (C) 2020-2020 Bareos GmbH & Co. KG
+# Copyright (C) 2020-2022 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
@@ -21,7 +21,6 @@ message("Entering ${CMAKE_CURRENT_SOURCE_DIR}")
message(STATUS "Try to configure LibDroplet")
list(APPEND CMAKE_MESSAGE_INDENT " ")
-cmake_minimum_required(VERSION 3.0)
project(droplet C)
set(default_build_type "Debug")
diff --git a/core/src/droplet/libdroplet/CMakeLists.txt b/core/src/droplet/libdroplet/CMakeLists.txt
index 9ff8108fd..52792cbc8 100644
--- a/core/src/droplet/libdroplet/CMakeLists.txt
+++ b/core/src/droplet/libdroplet/CMakeLists.txt
@@ -18,10 +18,8 @@
# 02110-1301, USA.
message("Entering ${CMAKE_CURRENT_SOURCE_DIR}")
-cmake_minimum_required(VERSION 3.0)
-
add_library(
- droplet SHARED
+ droplet STATIC
src/conn.c
src/converters.c
src/value.c
@@ -112,6 +110,7 @@ bareos_disable_warnings(
C_ONLY
ADD_FOR_LTO
)
+set_property(TARGET droplet PROPERTY POSITION_INDEPENDENT_CODE ON)
target_include_directories(
droplet PUBLIC include ${LIBXML2_INCLUDE_DIR} ${JSONC_INCLUDE_DIRS}
@@ -120,5 +119,3 @@ target_include_directories(
target_link_libraries(
droplet ${LIBXML2_LIBRARIES} ${JSONC_LIBRARIES} ${OPENSSL_LIBRARIES}
)
-
-install(TARGETS droplet DESTINATION ${libdir})
diff --git a/core/src/fastlz/CMakeLists.txt b/core/src/fastlz/CMakeLists.txt
index 57e4c425c..4bffee628 100644
--- a/core/src/fastlz/CMakeLists.txt
+++ b/core/src/fastlz/CMakeLists.txt
@@ -17,7 +17,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
message("Entering ${CMAKE_CURRENT_SOURCE_DIR}")
-cmake_minimum_required(VERSION 3.0)
project(bareosfastlz LANGUAGES C)
add_library(
diff --git a/core/src/lib/implementation_factory.h b/core/src/lib/implementation_factory.h
new file mode 100644
index 000000000..727f0e6b5
--- /dev/null
+++ b/core/src/lib/implementation_factory.h
@@ -0,0 +1,67 @@
+/*
+ BAREOSĀ® - Backup Archiving REcovery Open Sourced
+
+ Copyright (C) 2022-2022 Bareos GmbH & Co. KG
+
+ This program is Free Software; you can redistribute it and/or
+ modify it under the terms of version three of the GNU Affero General Public
+ License as published by the Free Software Foundation and included
+ in the file LICENSE.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+*/
+
+/*
+ * generic registry where you can register factory functions based on a name.
+ * The registry is templated on the implementation's interface, thus the
+ * names will be per interface.
+ */
+
+#ifndef BAREOS_LIB_IMPLEMENTATION_FACTORY_H_
+#define BAREOS_LIB_IMPLEMENTATION_FACTORY_H_
+
+#include <memory>
+#include <functional>
+#include <unordered_map>
+
+template <typename Interface> class ImplementationFactory {
+ using Factory = std::function<Interface*()>;
+ using Map = std::unordered_map<std::string, Factory>;
+
+ static Map& GetMap()
+ {
+ // this ensures thread-safe initialization (Meyers' singleton)
+ static Map factory_map;
+ return factory_map;
+ }
+
+ public:
+ // this retuns a bool, so you can initialize a global static variable from it
+ // to register your plugin when the program starts or during dl_open()
+ static bool Add(const std::string& implementation_name, Factory factory)
+ {
+ GetMap().insert({implementation_name, factory});
+ return true;
+ }
+
+ static bool IsRegistered(const std::string& implementation_name)
+ {
+ auto m = GetMap();
+ return m.find(implementation_name) != m.end();
+ }
+
+ static Interface* Create(const std::string& implementation_name)
+ {
+ Dmsg0(100, "Creating Instance for '%s'\n", implementation_name.c_str());
+ return GetMap().at(implementation_name)();
+ }
+};
+#endif // BAREOS_LIB_IMPLEMENTATION_FACTORY_H_
diff --git a/core/src/lib/parse_conf.h b/core/src/lib/parse_conf.h
index 7368224ea..9a0507df5 100644
--- a/core/src/lib/parse_conf.h
+++ b/core/src/lib/parse_conf.h
@@ -166,7 +166,7 @@ enum
CFG_TYPE_META = 91, /* Meta tag */
// Storage daemon resource types
- CFG_TYPE_DEVTYPE = 201, /* Device Type */
+ // CFG_TYPE_DEVTYPE = 201, /* Device Type */
CFG_TYPE_MAXBLOCKSIZE = 202, /* Maximum Blocksize */
CFG_TYPE_IODIRECTION = 203, /* AutoXflateMode IO Direction */
CFG_TYPE_CMPRSALGO = 204, /* Compression Algorithm */
diff --git a/core/src/lib/res.cc b/core/src/lib/res.cc
index 54c7d05f1..1279b6e50 100644
--- a/core/src/lib/res.cc
+++ b/core/src/lib/res.cc
@@ -2205,7 +2205,7 @@ static DatatypeName datatype_names[] = {
{CFG_TYPE_META, "META_TAG", "Meta tag"},
// Storage daemon resource types
- {CFG_TYPE_DEVTYPE, "DEVICE_TYPE", "Device Type"},
+ //{CFG_TYPE_DEVTYPE, "DEVICE_TYPE", "Device Type"},
{CFG_TYPE_MAXBLOCKSIZE, "MAX_BLOCKSIZE", "Maximum Blocksize"},
{CFG_TYPE_IODIRECTION, "IO_DIRECTION", "IO Direction"},
{CFG_TYPE_CMPRSALGO, "COMPRESSION_ALGORITHM", "Compression Algorithm"},
diff --git a/core/src/lib/util.cc b/core/src/lib/util.cc
index 52a96e6d6..3f7231491 100644
--- a/core/src/lib/util.cc
+++ b/core/src/lib/util.cc
@@ -35,6 +35,7 @@
#include "include/allow_deprecated.h"
#include <algorithm>
+#include <cctype>
#include <sstream>
#include <string>
#include <vector>
@@ -1182,3 +1183,9 @@ regex_t* StringToRegex(const char* input)
}
return output;
}
+
+void to_lower(std::string& s)
+{
+ std::transform(s.begin(), s.end(), s.begin(),
+ [](unsigned char c) { return std::tolower(c); });
+}
diff --git a/core/src/lib/util.h b/core/src/lib/util.h
index fdaa58b1a..d0d62c3f1 100644
--- a/core/src/lib/util.h
+++ b/core/src/lib/util.h
@@ -91,5 +91,6 @@ std::string CreateDelimitedStringForSqlQueries(
std::string TPAsString(const std::chrono::system_clock::time_point& tp);
regex_t* StringToRegex(const char* input);
+void to_lower(std::string& s);
#endif // BAREOS_LIB_UTIL_H_
diff --git a/core/src/qt-tray-monitor/CMakeLists.txt b/core/src/qt-tray-monitor/CMakeLists.txt
index 2562aace7..a4be2cf60 100644
--- a/core/src/qt-tray-monitor/CMakeLists.txt
+++ b/core/src/qt-tray-monitor/CMakeLists.txt
@@ -18,9 +18,6 @@
# 02110-1301, USA.
message("Entering ${CMAKE_CURRENT_SOURCE_DIR}")
-cmake_minimum_required(VERSION 3.0)
-# (for AUTOUIC)
-
if(HAVE_WIN32)
add_definitions(-D_STAT_DEFINED=1)
endif()
diff --git a/core/src/stored/CMakeLists.txt b/core/src/stored/CMakeLists.txt
index 97bc92ef1..60f5d284c 100644
--- a/core/src/stored/CMakeLists.txt
+++ b/core/src/stored/CMakeLists.txt
@@ -44,34 +44,6 @@ if(NOT build_client_only)
message("Backends are now ${BACKENDS}")
endif()
-if(NOT ${HAVE_DYNAMIC_SD_BACKENDS})
- set(AVAILABLE_DEVICE_API_SRCS backends/generic_tape_device.cc)
-
- if(HAVE_WIN32)
- list(
- APPEND
- AVAILABLE_DEVICE_API_SRCS
- ${PROJECT_SOURCE_DIR}/src/win32/stored/backends/win32_fifo_device.cc
- ${PROJECT_SOURCE_DIR}/src/win32/stored/backends/win32_file_device.cc
- ${PROJECT_SOURCE_DIR}/src/win32/stored/backends/win32_tape_device.cc
- )
- else()
- list(APPEND AVAILABLE_DEVICE_API_SRCS backends/unix_fifo_device.cc
- # backends/droplet_device.cc
- backends/unix_tape_device.cc backends/unix_file_device.cc
- )
- endif()
-
- if(${HAVE_GFAPI})
- list(APPEND AVAILABLE_DEVICE_API_SRCS backends/gfapi_device.cc)
- endif()
-
- if(TARGET droplet)
- list(APPEND AVAILABLE_DEVICE_API_SRCS backends/droplet_device.cc)
- list(APPEND AVAILABLE_DEVICE_API_SRCS backends/chunked_device.cc)
- endif()
-endif()
-
set(LIBBAREOSSD_SRCS
acquire.cc
ansi_label.cc
@@ -94,7 +66,6 @@ set(LIBBAREOSSD_SRCS
record.cc
reserve.cc
scan.cc
- sd_backends.cc
sd_device_control_record.cc
sd_plugins.cc
sd_stats.cc
@@ -103,7 +74,6 @@ set(LIBBAREOSSD_SRCS
stored_conf.cc
vol_mgr.cc
wait.cc
- ${AVAILABLE_DEVICE_API_SRCS}
)
set(SDSRCS
@@ -177,10 +147,6 @@ else()
message(STATUS "LIBBAREOSSD_LIBRARIES ARE ${LIBBAREOSSD_LIBRARIES}")
endif()
-if(${HAVE_DYNAMIC_SD_BACKENDS})
- list(APPEND LIBBAREOSSD_SRCS backends/unix_file_device.cc)
-endif()
-
add_library(bareossd SHARED ${LIBBAREOSSD_SRCS})
target_link_libraries(bareossd PRIVATE bareos Threads::Threads)
set_target_properties(
@@ -188,7 +154,9 @@ set_target_properties(
SOVERSION "${BAREOS_VERSION_MAJOR}"
)
-if(NOT ${HAVE_DYNAMIC_SD_BACKENDS})
+if(${HAVE_DYNAMIC_SD_BACKENDS})
+ target_sources(bareossd PRIVATE sd_backends_dynamic.cc)
+else()
target_link_libraries(bareossd PRIVATE ${LIBBAREOSSD_LIBRARIES})
endif()
@@ -240,9 +208,7 @@ install(SCRIPT ${PROJECT_SOURCE_DIR}/cmake/install-stored-configfiles.cmake)
install(DIRECTORY DESTINATION "${archivedir}")
-if(${HAVE_DYNAMIC_SD_BACKENDS})
- add_subdirectory(backends)
-endif()
+add_subdirectory(backends)
if(TARGET droplet)
target_compile_definitions(bareossd PRIVATE HAVE_BAREOSSD_DROPLET_DEVICE)
diff --git a/core/src/stored/acquire.cc b/core/src/stored/acquire.cc
index cd4e266de..76732d442 100644
--- a/core/src/stored/acquire.cc
+++ b/core/src/stored/acquire.cc
@@ -437,7 +437,7 @@ DeviceControlRecord* AcquireDeviceForAppend(DeviceControlRecord* dcr)
dev->Lock_acquire(); /* only one job at a time */
dev->Lock();
- Dmsg1(100, "acquire_append device is %s\n", dev->IsTape() ? "tape" : "disk");
+ Dmsg1(100, "acquire_append device is %s\n", dev->type().c_str());
// With the reservation system, this should not happen
if (dev->CanRead()) {
diff --git a/core/src/stored/backends/CMakeLists.txt b/core/src/stored/backends/CMakeLists.txt
index fa870ac0e..57fa560af 100644
--- a/core/src/stored/backends/CMakeLists.txt
+++ b/core/src/stored/backends/CMakeLists.txt
@@ -1,6 +1,6 @@
# BAREOSĀ® - Backup Archiving REcovery Open Sourced
#
-# Copyright (C) 2017-2022 Bareos GmbH & Co. KG
+# Copyright (C) 2022-2022 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
@@ -16,40 +16,54 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
+
message("Entering ${CMAKE_CURRENT_SOURCE_DIR}")
list(APPEND CMAKE_INSTALL_RPATH ${backenddir})
+macro(add_sd_backend backend_name)
+ if(HAVE_DYNAMIC_SD_BACKENDS)
+ add_library(${backend_name} MODULE)
+ install(TARGETS ${backend_name} DESTINATION ${backenddir})
+ else()
+ add_library(${backend_name} OBJECT)
+ target_link_libraries(bareossd PRIVATE ${backend_name})
+ endif()
+ set_property(TARGET ${backend_name} PROPERTY POSITION_INDEPENDENT_CODE ON)
+endmacro()
+
if(${HAVE_GLUSTERFS})
- add_library(bareossd-gfapi MODULE gfapi_device.cc)
- install(TARGETS bareossd-gfapi DESTINATION ${backenddir})
+ add_sd_backend(bareossd-gfapi)
+ target_sources(bareossd-gfapi PRIVATE gfapi_device.cc)
target_include_directories(bareossd-gfapi PUBLIC ${GFAPI_INCLUDE_DIRS})
target_link_libraries(bareossd-gfapi ${GFAPI_LIBRARIES})
endif()
if(TARGET droplet)
- add_library(bareossd-chunked SHARED ordered_cbuf.cc chunked_device.cc)
- target_link_libraries(bareossd-chunked droplet)
- install(TARGETS bareossd-chunked DESTINATION ${backenddir})
-
- add_library(bareossd-droplet MODULE droplet_device.cc)
- target_link_libraries(bareossd-droplet bareossd-chunked droplet)
- install(TARGETS bareossd-droplet DESTINATION ${backenddir})
+ add_sd_backend(bareossd-droplet)
+ target_sources(
+ bareossd-droplet PRIVATE droplet_device.cc ordered_cbuf.cc
+ chunked_device.cc
+ )
+ target_link_libraries(bareossd-droplet PRIVATE droplet)
endif()
-add_library(bareossd-fifo MODULE unix_fifo_device.cc)
-install(TARGETS bareossd-fifo DESTINATION ${backenddir})
-if(HAVE_DARWIN_OS)
- target_link_libraries(bareossd-fifo bareos bareossd)
+add_sd_backend(bareossd-file)
+add_sd_backend(bareossd-fifo)
+add_sd_backend(bareossd-tape)
+target_sources(bareossd-tape PRIVATE generic_tape_device.cc)
+if(HAVE_WIN32)
+ target_sources(bareossd-file PRIVATE win32_file_device.cc)
+ target_sources(bareossd-fifo PRIVATE win32_fifo_device.cc)
+ target_sources(bareossd-tape PRIVATE win32_tape_device.cc)
+ target_link_libraries(bareossd-file PRIVATE bareos)
+else()
+ target_sources(bareossd-file PRIVATE unix_file_device.cc)
+ target_sources(bareossd-fifo PRIVATE unix_fifo_device.cc)
+ target_sources(bareossd-tape PRIVATE unix_tape_device.cc)
endif()
-add_library(bareossd-gentape SHARED generic_tape_device.cc)
-install(TARGETS bareossd-gentape DESTINATION ${backenddir})
if(HAVE_DARWIN_OS)
+ target_link_libraries(bareossd-fifo bareos bareossd)
target_link_libraries(bareossd-gentape bareos bareossd)
endif()
-
-add_library(bareossd-tape MODULE unix_tape_device.cc)
-install(TARGETS bareossd-tape DESTINATION ${backenddir})
-
-target_link_libraries(bareossd-tape bareossd-gentape)
diff --git a/core/src/stored/backends/cephfs_device.h b/core/src/stored/backends/cephfs_device.h
deleted file mode 100644
index ff3ff5bc9..000000000
--- a/core/src/stored/backends/cephfs_device.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- BAREOSĀ® - Backup Archiving REcovery Open Sourced
-
- Copyright (C) 2014-2014 Planets Communications B.V.
- Copyright (C) 2014-2021 Bareos GmbH & Co. KG
-
- This program is Free Software; you can redistribute it and/or
- modify it under the terms of version three of the GNU Affero General Public
- License as published by the Free Software Foundation, which is
- listed in the file LICENSE.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301, USA.
-*/
-/*
- * CEPHFS API device abstraction.
- *
- * Marco van Wieringen, May 2014
- */
-
-#ifndef BAREOS_STORED_BACKENDS_CEPHFS_DEVICE_H_
-#define BAREOS_STORED_BACKENDS_CEPHFS_DEVICE_H_
-
-#include <cephfs/libcephfs.h>
-
-namespace storagedaemon {
-
-class cephfs_device : public Device {
- private:
- char* cephfs_configstring_;
- char* cephfs_conffile_;
- char* basedir_;
- struct ceph_mount_info* cmount_;
- POOLMEM* virtual_filename_;
-
- public:
- cephfs_device();
- ~cephfs_device();
-
- // Interface from Device
- int d_close(int) override;
- int d_open(const char* pathname, int flags, int mode) override;
- int d_ioctl(int fd, ioctl_req_t request, char* mt = NULL) override;
- boffset_t d_lseek(DeviceControlRecord* dcr,
- boffset_t offset,
- int whence) override;
- ssize_t d_read(int fd, void* buffer, size_t count) override;
- ssize_t d_write(int fd, const void* buffer, size_t count) override;
- bool d_truncate(DeviceControlRecord* dcr) override;
-};
-
-} /* namespace storagedaemon */
-
-#endif // BAREOS_STORED_BACKENDS_CEPHFS_DEVICE_H_
diff --git a/core/src/stored/backends/droplet_device.cc b/core/src/stored/backends/droplet_device.cc
index 6bf1923a0..0aaf6beaf 100644
--- a/core/src/stored/backends/droplet_device.cc
+++ b/core/src/stored/backends/droplet_device.cc
@@ -1027,23 +1027,6 @@ DropletDevice::~DropletDevice()
unlock_mutex(mutex);
}
-class Backend : public BackendInterface {
- public:
- Device* GetDevice(JobControlRecord* jcr, DeviceType device_type) override
- {
- switch (device_type) {
- case DeviceType::B_DROPLET_DEV:
- return new DropletDevice;
- default:
- Jmsg(jcr, M_FATAL, 0, _("Request for unknown devicetype: %d\n"),
- device_type);
- return nullptr;
- }
- }
- void FlushDevice(void) override {}
-};
+REGISTER_SD_BACKEND(droplet, DropletDevice)
-#ifdef HAVE_DYNAMIC_SD_BACKENDS
-extern "C" BackendInterface* GetBackend(void) { return new Backend; }
-#endif
} /* namespace storagedaemon */
diff --git a/core/src/stored/backends/droplet_device.h b/core/src/stored/backends/droplet_device.h
index 3c63dfed2..1eaae6506 100644
--- a/core/src/stored/backends/droplet_device.h
+++ b/core/src/stored/backends/droplet_device.h
@@ -2,7 +2,7 @@
BAREOSĀ® - Backup Archiving REcovery Open Sourced
Copyright (C) 2014-2017 Planets Communications B.V.
- Copyright (C) 2014-2021 Bareos GmbH & Co. KG
+ Copyright (C) 2014-2022 Bareos GmbH & Co. KG
This program is Free Software; you can redistribute it and/or
modify it under the terms of version three of the GNU Affero General Public
@@ -80,6 +80,8 @@ class DropletDevice : public ChunkedDevice {
~DropletDevice();
// Interface from Device
+ SeekMode GetSeekMode() const override { return SeekMode::BYTES; }
+ bool CanReadConcurrently() const override { return true; }
int d_close(int fd) override;
int d_open(const char* pathname, int flags, int mode) override;
int d_ioctl(int fd, ioctl_req_t request, char* mt = NULL) override;
diff --git a/core/src/stored/backends/generic_tape_device.h b/core/src/stored/backends/generic_tape_device.h
index 65c2a5b80..c6924e25b 100644
--- a/core/src/stored/backends/generic_tape_device.h
+++ b/core/src/stored/backends/generic_tape_device.h
@@ -2,7 +2,7 @@
BAREOSĀ® - Backup Archiving REcovery Open Sourced
Copyright (C) 2014-2014 Planets Communications B.V.
- Copyright (C) 2014-2021 Bareos GmbH & Co. KG
+ Copyright (C) 2014-2022 Bareos GmbH & Co. KG
This program is Free Software; you can redistribute it and/or
modify it under the terms of version three of the GNU Affero General Public
@@ -38,6 +38,7 @@ class generic_tape_device : public Device {
virtual ~generic_tape_device() { close(nullptr); }
// Interface from Device
+ virtual SeekMode GetSeekMode() const override { return SeekMode::FILE_BLOCK; }
virtual void OpenDevice(DeviceControlRecord* dcr, DeviceMode omode) override;
virtual char* StatusDev() override;
virtual bool eod(DeviceControlRecord* dcr) override;
diff --git a/core/src/stored/backends/gfapi_device.cc b/core/src/stored/backends/gfapi_device.cc
index b2a74a1b7..0497c9278 100644
--- a/core/src/stored/backends/gfapi_device.cc
+++ b/core/src/stored/backends/gfapi_device.cc
@@ -575,26 +575,7 @@ gfapi_device::gfapi_device()
virtual_filename_ = GetPoolMemory(PM_FNAME);
}
-class Backend : public BackendInterface {
- public:
- Device* GetDevice(JobControlRecord* jcr, DeviceType device_type) override
- {
- switch (device_type) {
- case DeviceType::B_GFAPI_DEV:
- return new gfapi_device;
- default:
- Jmsg(jcr, M_FATAL, 0, _("Request for unknown devicetype: %d\n"),
- device_type);
- return nullptr;
- }
- }
- void FlushDevice(void) override {}
-};
-
-# ifdef HAVE_DYNAMIC_SD_BACKENDS
-extern "C" BackendInterface* GetBackend(void) { return new Backend; }
-# endif
-
+REGISTER_SD_BACKEND(gfapi, gfapi_device);
} /* namespace storagedaemon */
#endif /* HAVE_GFAPI */
diff --git a/core/src/stored/backends/gfapi_device.h b/core/src/stored/backends/gfapi_device.h
index 282865f42..049cfaeb8 100644
--- a/core/src/stored/backends/gfapi_device.h
+++ b/core/src/stored/backends/gfapi_device.h
@@ -2,7 +2,7 @@
BAREOSĀ® - Backup Archiving REcovery Open Sourced
Copyright (C) 2014-2014 Planets Communications B.V.
- Copyright (C) 2014-2021 Bareos GmbH & Co. KG
+ Copyright (C) 2014-2022 Bareos GmbH & Co. KG
This program is Free Software; you can redistribute it and/or
modify it under the terms of version three of the GNU Affero General Public
@@ -56,6 +56,8 @@ class gfapi_device : public Device {
~gfapi_device();
// Interface from Device
+ SeekMode GetSeekMode() const override { return SeekMode::BYTES; }
+ bool CanReadConcurrently() const override { return true; }
int d_close(int) override;
int d_open(const char* pathname, int flags, int mode) override;
int d_ioctl(int fd, ioctl_req_t request, char* mt = NULL) override;
@@ -65,6 +67,6 @@ class gfapi_device : public Device {
ssize_t d_read(int fd, void* buffer, size_t count) override;
ssize_t d_write(int fd, const void* buffer, size_t count) override;
bool d_truncate(DeviceControlRecord* dcr) override;
-} override;
+};
} /* namespace storagedaemon */
#endif // BAREOS_STORED_BACKENDS_GFAPI_DEVICE_H_
diff --git a/core/src/stored/backends/unix_fifo_device.cc b/core/src/stored/backends/unix_fifo_device.cc
index 60e8a7ef3..558d1e56d 100644
--- a/core/src/stored/backends/unix_fifo_device.cc
+++ b/core/src/stored/backends/unix_fifo_device.cc
@@ -315,25 +315,6 @@ boffset_t unix_fifo_device::d_lseek(DeviceControlRecord*, boffset_t, int)
bool unix_fifo_device::d_truncate(DeviceControlRecord*) { return true; }
-class Backend : public BackendInterface {
- public:
- Device* GetDevice(JobControlRecord* jcr, DeviceType device_type) override
- {
- switch (device_type) {
- case DeviceType::B_FIFO_DEV:
- return new unix_fifo_device;
- default:
- Jmsg(jcr, M_FATAL, 0, _("Request for unknown devicetype: %d\n"),
- device_type);
- return nullptr;
- }
- }
- void FlushDevice(void) override {}
-};
-
-#ifdef HAVE_DYNAMIC_SD_BACKENDS
-extern "C" BackendInterface* GetBackend(void) { return new Backend; }
-#endif
-
+REGISTER_SD_BACKEND(fifo, unix_fifo_device);
} /* namespace storagedaemon */
diff --git a/core/src/stored/backends/unix_fifo_device.h b/core/src/stored/backends/unix_fifo_device.h
index 6e6d31bbf..078795db7 100644
--- a/core/src/stored/backends/unix_fifo_device.h
+++ b/core/src/stored/backends/unix_fifo_device.h
@@ -2,7 +2,7 @@
BAREOSĀ® - Backup Archiving REcovery Open Sourced
Copyright (C) 2013-2013 Planets Communications B.V.
- Copyright (C) 2013-2021 Bareos GmbH & Co. KG
+ Copyright (C) 2013-2022 Bareos GmbH & Co. KG
This program is Free Software; you can redistribute it and/or
modify it under the terms of version three of the GNU Affero General Public
@@ -40,6 +40,7 @@ class unix_fifo_device : public Device {
~unix_fifo_device() { close(nullptr); }
// Interface from Device
+ SeekMode GetSeekMode() const override { return SeekMode::NOSEEK; }
void OpenDevice(DeviceControlRecord* dcr, DeviceMode omode) override;
bool eod(DeviceControlRecord* dcr) override;
bool MountBackend(DeviceControlRecord* dcr, int timeout) override;
diff --git a/core/src/stored/backends/unix_file_device.cc b/core/src/stored/backends/unix_file_device.cc
index 363762c77..3d7b4e160 100644
--- a/core/src/stored/backends/unix_file_device.cc
+++ b/core/src/stored/backends/unix_file_device.cc
@@ -32,6 +32,7 @@
#include "include/bareos.h"
#include "stored/stored.h"
#include "stored/stored_globals.h"
+#include "stored/sd_backends.h"
#include "stored/device_control_record.h"
#include "unix_file_device.h"
#include "lib/berrno.h"
@@ -205,6 +206,11 @@ bool unix_file_device::UnmountBackend(DeviceControlRecord* dcr, int timeout)
return retval;
}
+bool unix_file_device::ScanForVolumeImpl(DeviceControlRecord* dcr)
+{
+ return ScanDirectoryForVolume(dcr);
+}
+
int unix_file_device::d_open(const char* pathname, int flags, int mode)
{
return ::open(pathname, flags, mode);
@@ -310,4 +316,6 @@ bail_out:
return true;
}
+REGISTER_SD_BACKEND(file, unix_file_device);
+
} /* namespace storagedaemon */
diff --git a/core/src/stored/backends/unix_file_device.h b/core/src/stored/backends/unix_file_device.h
index 51eb5aaa2..9b4847c5f 100644
--- a/core/src/stored/backends/unix_file_device.h
+++ b/core/src/stored/backends/unix_file_device.h
@@ -2,7 +2,7 @@
BAREOSĀ® - Backup Archiving REcovery Open Sourced
Copyright (C) 2013-2013 Planets Communications B.V.
- Copyright (C) 2013-2021 Bareos GmbH & Co. KG
+ Copyright (C) 2013-2022 Bareos GmbH & Co. KG
This program is Free Software; you can redistribute it and/or
modify it under the terms of version three of the GNU Affero General Public
@@ -28,6 +28,8 @@
#ifndef BAREOS_STORED_BACKENDS_UNIX_FILE_DEVICE_H_
#define BAREOS_STORED_BACKENDS_UNIX_FILE_DEVICE_H_
+#include "stored/dev.h"
+
namespace storagedaemon {
class unix_file_device : public Device {
@@ -36,8 +38,11 @@ class unix_file_device : public Device {
~unix_file_device() { close(nullptr); }
// Interface from Device
+ SeekMode GetSeekMode() const override { return SeekMode::BYTES; }
+ bool CanReadConcurrently() const override { return true; }
bool MountBackend(DeviceControlRecord* dcr, int timeout) override;
bool UnmountBackend(DeviceControlRecord* dcr, int timeout) override;
+ bool ScanForVolumeImpl(DeviceControlRecord* dcr) override;
int d_close(int) override;
int d_open(const char* pathname, int flags, int mode) override;
int d_ioctl(int fd, ioctl_req_t request, char* mt = NULL) override;
diff --git a/core/src/stored/backends/unix_tape_device.cc b/core/src/stored/backends/unix_tape_device.cc
index 042443470..b196b0f09 100644
--- a/core/src/stored/backends/unix_tape_device.cc
+++ b/core/src/stored/backends/unix_tape_device.cc
@@ -3,7 +3,7 @@
Copyright (C) 2000-2012 Free Software Foundation Europe e.V.
Copyright (C) 2013-2013 Planets Communications B.V.
- Copyright (C) 2013-2020 Bareos GmbH & Co. KG
+ Copyright (C) 2013-2022 Bareos GmbH & Co. KG
This program is Free Software; you can redistribute it and/or
modify it under the terms of version three of the GNU Affero General Public
@@ -59,24 +59,6 @@ unix_tape_device::unix_tape_device()
SetCap(CAP_ADJWRITESIZE); /* Adjust write size to min/max */
}
-class Backend : public BackendInterface {
- public:
- Device* GetDevice(JobControlRecord* jcr, DeviceType device_type) override
- {
- switch (device_type) {
- case DeviceType::B_TAPE_DEV:
- return new unix_tape_device;
- default:
- Jmsg(jcr, M_FATAL, 0, _("Request for unknown devicetype: %d\n"),
- device_type);
- return nullptr;
- }
- }
- void FlushDevice(void) override {}
-};
-
-#ifdef HAVE_DYNAMIC_SD_BACKENDS
-extern "C" BackendInterface* GetBackend(void) { return new Backend; }
-#endif
+REGISTER_SD_BACKEND(tape, unix_tape_device)
} /* namespace storagedaemon */
diff --git a/core/src/win32/stored/backends/win32_fifo_device.cc b/core/src/stored/backends/win32_fifo_device.cc
index 373ea5224..cb4ad27fa 100644
--- a/core/src/win32/stored/backends/win32_fifo_device.cc
+++ b/core/src/stored/backends/win32_fifo_device.cc
@@ -36,6 +36,7 @@
#include "stored/device_control_record.h"
#include "stored/stored.h"
#include "stored/autochanger.h"
+#include "stored/sd_backends.h"
namespace storagedaemon {
@@ -318,4 +319,6 @@ boffset_t win32_fifo_device::d_lseek(DeviceControlRecord*, boffset_t, int)
bool win32_fifo_device::d_truncate(DeviceControlRecord*) { return true; }
+REGISTER_SD_BACKEND(fifo, win32_fifo_device);
+
} /* namespace storagedaemon */
diff --git a/core/src/win32/stored/backends/win32_fifo_device.h b/core/src/stored/backends/win32_fifo_device.h
index 744cb06f8..080e0489f 100644
--- a/core/src/win32/stored/backends/win32_fifo_device.h
+++ b/core/src/stored/backends/win32_fifo_device.h
@@ -2,7 +2,7 @@
BAREOSĀ® - Backup Archiving REcovery Open Sourced
Copyright (C) 2015-2015 Planets Communications B.V.
- Copyright (C) 2015-2021 Bareos GmbH & Co. KG
+ Copyright (C) 2015-2022 Bareos GmbH & Co. KG
This program is Free Software; you can redistribute it and/or
modify it under the terms of version three of the GNU Affero General Public
@@ -25,8 +25,8 @@
* Marco van Wieringen, June 2014
*/
-#ifndef BAREOS_WIN32_STORED_BACKENDS_WIN32_FIFO_DEVICE_H_
-#define BAREOS_WIN32_STORED_BACKENDS_WIN32_FIFO_DEVICE_H_
+#ifndef BAREOS_STORED_BACKENDS_WIN32_FIFO_DEVICE_H_
+#define BAREOS_STORED_BACKENDS_WIN32_FIFO_DEVICE_H_
#include "stored/dev.h"
#include "lib/btimers.h"
@@ -42,6 +42,7 @@ class win32_fifo_device : public Device {
~win32_fifo_device() { close(nullptr); }
// Interface from Device
+ SeekMode GetSeekMode() const override { return SeekMode::NOSEEK; }
void OpenDevice(DeviceControlRecord* dcr, DeviceMode omode) override;
bool eod(DeviceControlRecord* dcr) override;
bool MountBackend(DeviceControlRecord* dcr, int timeout) override;
@@ -61,4 +62,4 @@ class win32_fifo_device : public Device {
};
} /* namespace storagedaemon */
-#endif // BAREOS_WIN32_STORED_BACKENDS_WIN32_FIFO_DEVICE_H_
+#endif // BAREOS_STORED_BACKENDS_WIN32_FIFO_DEVICE_H_
diff --git a/core/src/win32/stored/backends/win32_file_device.cc b/core/src/stored/backends/win32_file_device.cc
index e0b8bd1e2..e75fbf880 100644
--- a/core/src/win32/stored/backends/win32_file_device.cc
+++ b/core/src/stored/backends/win32_file_device.cc
@@ -30,6 +30,7 @@
#include "lib/berrno.h"
#include "stored/device_control_record.h"
#include "stored/stored.h"
+#include "stored/sd_backends.h"
#include "win32_file_device.h"
namespace storagedaemon {
@@ -195,6 +196,11 @@ bool win32_file_device::UnmountBackend(DeviceControlRecord* dcr, int timeout)
return retval;
}
+bool win32_file_device::ScanForVolumeImpl(DeviceControlRecord* dcr)
+{
+ return ScanDirectoryForVolume(dcr);
+}
+
int win32_file_device::d_open(const char* pathname, int flags, int mode)
{
return ::open(pathname, flags, mode);
@@ -290,4 +296,6 @@ bool win32_file_device::d_truncate(DeviceControlRecord* dcr)
win32_file_device::win32_file_device() {}
+REGISTER_SD_BACKEND(file, win32_file_device);
+
} /* namespace storagedaemon */
diff --git a/core/src/win32/stored/backends/win32_file_device.h b/core/src/stored/backends/win32_file_device.h
index 07ac30049..ba2655438 100644
--- a/core/src/win32/stored/backends/win32_file_device.h
+++ b/core/src/stored/backends/win32_file_device.h
@@ -2,7 +2,7 @@
BAREOSĀ® - Backup Archiving REcovery Open Sourced
Copyright (C) 2013-2014 Planets Communications B.V.
- Copyright (C) 2013-2021 Bareos GmbH & Co. KG
+ Copyright (C) 2013-2022 Bareos GmbH & Co. KG
This program is Free Software; you can redistribute it and/or
modify it under the terms of version three of the GNU Affero General Public
@@ -25,8 +25,8 @@
* Marco van Wieringen, December 2013
*/
-#ifndef BAREOS_WIN32_STORED_BACKENDS_WIN32_FILE_DEVICE_H_
-#define BAREOS_WIN32_STORED_BACKENDS_WIN32_FILE_DEVICE_H_
+#ifndef BAREOS_STORED_BACKENDS_WIN32_FILE_DEVICE_H_
+#define BAREOS_STORED_BACKENDS_WIN32_FILE_DEVICE_H_
#include "lib/util.h"
namespace storagedaemon {
@@ -37,8 +37,11 @@ class win32_file_device : public Device {
~win32_file_device() { close(nullptr); }
// Interface from Device
+ SeekMode GetSeekMode() const override { return SeekMode::BYTES; }
+ bool CanReadConcurrently() const override { return true; }
bool MountBackend(DeviceControlRecord* dcr, int timeout) override;
bool UnmountBackend(DeviceControlRecord* dcr, int timeout) override;
+ bool ScanForVolumeImpl(DeviceControlRecord* dcr) override;
int d_close(int) override;
int d_open(const char* pathname, int flags, int mode) override;
int d_ioctl(int fd, ioctl_req_t request, char* mt = NULL) override;
@@ -51,4 +54,4 @@ class win32_file_device : public Device {
};
} /* namespace storagedaemon */
-#endif // BAREOS_WIN32_STORED_BACKENDS_WIN32_FILE_DEVICE_H_
+#endif // BAREOS_STORED_BACKENDS_WIN32_FILE_DEVICE_H_
diff --git a/core/src/win32/stored/backends/win32_tape_device.cc b/core/src/stored/backends/win32_tape_device.cc
index 35e6954a2..6f666217e 100644
--- a/core/src/win32/stored/backends/win32_tape_device.cc
+++ b/core/src/stored/backends/win32_tape_device.cc
@@ -43,6 +43,7 @@
#include "include/bareos.h"
#include "stored/stored.h"
+#include "stored/sd_backends.h"
#include "generic_tape_device.h"
#include "win32_tape_device.h"
@@ -1110,4 +1111,6 @@ win32_tape_device::win32_tape_device()
SetCap(CAP_ADJWRITESIZE); /* Adjust write size to min/max */
}
+REGISTER_SD_BACKEND(tape, win32_tape_device)
+
} /* namespace storagedaemon */
diff --git a/core/src/win32/stored/backends/win32_tape_device.h b/core/src/stored/backends/win32_tape_device.h
index a62d07dce..b5aad9609 100644
--- a/core/src/win32/stored/backends/win32_tape_device.h
+++ b/core/src/stored/backends/win32_tape_device.h
@@ -1,7 +1,7 @@
/*
BAREOSĀ® - Backup Archiving REcovery Open Sourced
- Copyright (C) 2013-2021 Bareos GmbH & Co. KG
+ Copyright (C) 2013-2022 Bareos GmbH & Co. KG
Copyright (C) 2013-2014 Planets Communications B.V.
This program is Free Software; you can redistribute it and/or
@@ -25,8 +25,8 @@
* Marco van Wieringen, December 2013
*/
-#ifndef BAREOS_WIN32_STORED_BACKENDS_WIN32_TAPE_DEVICE_H_
-#define BAREOS_WIN32_STORED_BACKENDS_WIN32_TAPE_DEVICE_H_
+#ifndef BAREOS_STORED_BACKENDS_WIN32_TAPE_DEVICE_H_
+#define BAREOS_STORED_BACKENDS_WIN32_TAPE_DEVICE_H_
namespace storagedaemon {
@@ -46,4 +46,4 @@ class win32_tape_device : public generic_tape_device {
};
} /* namespace storagedaemon */
-#endif // BAREOS_WIN32_STORED_BACKENDS_WIN32_TAPE_DEVICE_H_
+#endif // BAREOS_STORED_BACKENDS_WIN32_TAPE_DEVICE_H_
diff --git a/core/src/stored/btape.cc b/core/src/stored/btape.cc
index 9a1c63a1a..39ae5ca7c 100644
--- a/core/src/stored/btape.cc
+++ b/core/src/stored/btape.cc
@@ -359,10 +359,6 @@ static void TerminateBtape(int status)
if (dev) { delete dev; }
-#if defined(HAVE_DYNAMIC_SD_BACKENDS)
- FlushAndCloseBackendDevices();
-#endif
-
if (configfile) { free(configfile); }
if (my_config) {
diff --git a/core/src/stored/dev.cc b/core/src/stored/dev.cc
index 971a7ec18..f5374c1ca 100644
--- a/core/src/stored/dev.cc
+++ b/core/src/stored/dev.cc
@@ -82,36 +82,14 @@
#include "include/jcr.h"
#include "lib/berrno.h"
-#ifndef HAVE_DYNAMIC_SD_BACKENDS
-# ifdef HAVE_GFAPI
-# include "backends/gfapi_device.h"
-# endif
-# ifdef HAVE_BAREOSSD_DROPLET_DEVICE
-# include "backends/chunked_device.h"
-# include "backends/droplet_device.h"
-# endif
-# include "backends/generic_tape_device.h"
-# ifdef HAVE_WIN32
-# include "backends/win32_tape_device.h"
-# include "backends/win32_fifo_device.h"
-# else
-# include "backends/unix_tape_device.h"
-# include "backends/unix_fifo_device.h"
-# endif
-#endif /* HAVE_DYNAMIC_SD_BACKENDS */
-
-#ifdef HAVE_WIN32
-# include "backends/win32_file_device.h"
-#else
-# include "backends/unix_file_device.h"
-#endif
-
#ifndef O_NONBLOCK
# define O_NONBLOCK 0
#endif
namespace storagedaemon {
+static void InitiateDevice(JobControlRecord* jcr, Device* dev);
+
const char* Device::mode_to_str(DeviceMode mode)
{
static const char* modes[] = {"CREATE_READ_WRITE", "OPEN_READ_WRITE",
@@ -144,162 +122,89 @@ Device* FactoryCreateDevice(JobControlRecord* jcr,
Dmsg1(400, "max_block_size in device_resource res is %u\n",
device_resource->max_block_size);
- // If no device type specified, try to guess
- if (device_resource->dev_type == DeviceType::B_UNKNOWN_DEV) {
- struct stat statp;
- // Check that device is available
- if (stat(device_resource->archive_device_string, &statp) < 0) {
- BErrNo be;
- Jmsg2(jcr, M_ERROR, 0, _("Unable to stat device %s: ERR=%s\n"),
- device_resource->archive_device_string, be.bstrerror());
- return nullptr;
- }
- if (S_ISDIR(statp.st_mode)) {
- device_resource->dev_type = DeviceType::B_FILE_DEV;
- } else if (S_ISCHR(statp.st_mode)) {
- device_resource->dev_type = DeviceType::B_TAPE_DEV;
- } else if (S_ISFIFO(statp.st_mode)) {
- device_resource->dev_type = DeviceType::B_FIFO_DEV;
- } else if (!BitIsSet(CAP_REQMOUNT, device_resource->cap_bits)) {
- Jmsg2(jcr, M_ERROR, 0,
- _("%s is an unknown device type. Must be tape or directory, "
- "st_mode=%04o\n"),
- device_resource->archive_device_string, (statp.st_mode & ~S_IFMT));
- return nullptr;
- }
+ if (!ImplementationFactory<Device>::IsRegistered(
+ device_resource->device_type)) {
+ Jmsg2(jcr, M_ERROR, 0, _("%s has an unsupported Device Type %s\n"),
+ device_resource->archive_device_string,
+ device_resource->device_type.c_str());
+ return nullptr;
}
- Device* dev = nullptr;
+ Device* dev
+ = ImplementationFactory<Device>::Create(device_resource->device_type);
- switch (device_resource->dev_type) {
- /*
- * When using dynamic loading use the InitBackendDevice() function
- * for any type of device not being of the type file.
- */
-#ifndef HAVE_DYNAMIC_SD_BACKENDS
-# ifdef HAVE_GFAPI
- case DeviceType::B_GFAPI_DEV:
- dev = new gfapi_device;
- break;
-# endif
-# ifdef HAVE_BAREOSSD_DROPLET_DEVICE
- case DeviceType::B_DROPLET_DEV:
- dev = new DropletDevice;
- break;
-# endif
-# ifdef HAVE_WIN32
- case DeviceType::B_TAPE_DEV:
- dev = new win32_tape_device;
- break;
- case DeviceType::B_FIFO_DEV:
- dev = new win32_fifo_device;
- break;
-# else
- case DeviceType::B_TAPE_DEV:
- dev = new unix_tape_device;
- break;
- case DeviceType::B_FIFO_DEV:
- dev = new unix_fifo_device;
- break;
-# endif
-#endif /* HAVE_DYNAMIC_SD_BACKENDS */
-#ifdef HAVE_WIN32
- case DeviceType::B_FILE_DEV:
- dev = new win32_file_device;
- break;
-#else
- case DeviceType::B_FILE_DEV:
- dev = new unix_file_device;
- break;
-#endif
- default:
-#ifdef HAVE_DYNAMIC_SD_BACKENDS
- dev = InitBackendDevice(jcr, device_resource->dev_type);
- if (!dev) {
- try {
- Jmsg2(jcr, M_ERROR, 0,
- _("Initialization of dynamic %s device \"%s\" with archive "
- "device \"%s\" failed. Backend "
- "library might be missing or backend directory incorrect.\n"),
- device_type_to_name_mapping.at(device_resource->dev_type),
- device_resource->resource_name_,
- device_resource->archive_device_string);
- } catch (const std::out_of_range&) {
- // device_resource->dev_type could exceed limits of map
- }
- return nullptr;
- }
-#endif
- break;
- }
+ dev->device_resource = device_resource;
+ device_resource->dev = dev;
- if (!dev) {
- Jmsg2(jcr, M_ERROR, 0, _("%s has an unknown device type %d\n"),
- device_resource->archive_device_string, device_resource->dev_type);
- return nullptr;
- }
+ InitiateDevice(jcr, dev);
+ return dev;
+}
+
+static void InitiateDevice(JobControlRecord* jcr, Device* dev)
+{
dev->InvalidateSlotNumber(); /* unknown */
// Copy user supplied device parameters from Resource
dev->archive_device_string
- = GetMemory(strlen(device_resource->archive_device_string) + 1);
- PmStrcpy(dev->archive_device_string, device_resource->archive_device_string);
- if (device_resource->device_options) {
- dev->dev_options = GetMemory(strlen(device_resource->device_options) + 1);
- PmStrcpy(dev->dev_options, device_resource->device_options);
+ = GetMemory(strlen(dev->device_resource->archive_device_string) + 1);
+ PmStrcpy(dev->archive_device_string,
+ dev->device_resource->archive_device_string);
+ if (dev->device_resource->device_options) {
+ dev->dev_options
+ = GetMemory(strlen(dev->device_resource->device_options) + 1);
+ PmStrcpy(dev->dev_options, dev->device_resource->device_options);
}
- dev->prt_name = GetMemory(strlen(device_resource->archive_device_string)
- + strlen(device_resource->resource_name_) + 20);
+ dev->prt_name
+ = GetMemory(strlen(dev->device_resource->archive_device_string)
+ + strlen(dev->device_resource->resource_name_) + 20);
- Mmsg(dev->prt_name, "\"%s\" (%s)", device_resource->resource_name_,
- device_resource->archive_device_string);
+ Mmsg(dev->prt_name, "\"%s\" (%s)", dev->device_resource->resource_name_,
+ dev->device_resource->archive_device_string);
Dmsg1(400, "Allocate dev=%s\n", dev->print_name());
- CopySetBits(CAP_MAX, device_resource->cap_bits, dev->capabilities);
+ CopySetBits(CAP_MAX, dev->device_resource->cap_bits, dev->capabilities);
- dev->min_block_size = device_resource->min_block_size;
- dev->max_block_size = device_resource->max_block_size;
+ dev->min_block_size = dev->device_resource->min_block_size;
+ dev->max_block_size = dev->device_resource->max_block_size;
dev->max_volume_size = 0;
- dev->max_file_size = device_resource->max_file_size;
- dev->max_concurrent_jobs = device_resource->max_concurrent_jobs;
- dev->volume_capacity = device_resource->volume_capacity;
- dev->max_rewind_wait = device_resource->max_rewind_wait;
- dev->max_open_wait = device_resource->max_open_wait;
- dev->max_open_vols = device_resource->max_open_vols;
- dev->vol_poll_interval = device_resource->vol_poll_interval;
- dev->max_spool_size = device_resource->max_spool_size;
- dev->drive = device_resource->drive;
- dev->drive_index = device_resource->drive_index;
- dev->autoselect = device_resource->autoselect;
- dev->norewindonclose = device_resource->norewindonclose;
- dev->dev_type = device_resource->dev_type;
- dev->device_resource = device_resource;
-
- device_resource->dev = dev;
+ dev->max_file_size = dev->device_resource->max_file_size;
+ dev->max_concurrent_jobs = dev->device_resource->max_concurrent_jobs;
+ dev->volume_capacity = dev->device_resource->volume_capacity;
+ dev->max_rewind_wait = dev->device_resource->max_rewind_wait;
+ dev->max_open_wait = dev->device_resource->max_open_wait;
+ dev->max_open_vols = dev->device_resource->max_open_vols;
+ dev->vol_poll_interval = dev->device_resource->vol_poll_interval;
+ dev->max_spool_size = dev->device_resource->max_spool_size;
+ dev->drive = dev->device_resource->drive;
+ dev->drive_index = dev->device_resource->drive_index;
+ dev->autoselect = dev->device_resource->autoselect;
+ dev->norewindonclose = dev->device_resource->norewindonclose;
+ dev->device_type = dev->device_resource->device_type;
if (dev->vol_poll_interval && dev->vol_poll_interval < 60) {
dev->vol_poll_interval = 60;
}
- if (dev->IsFifo()) { dev->SetCap(CAP_STREAM); }
+ if (dev->GetSeekMode() == SeekMode::NOSEEK) { dev->SetCap(CAP_STREAM); }
/*
* If the device requires mount :
* - Check that the mount point is available
* - Check that (un)mount commands are defined
*/
- if (dev->IsFile() && dev->RequiresMount()) {
+ if (dev->RequiresMount()) {
struct stat statp;
- if (!device_resource->mount_point
- || stat(device_resource->mount_point, &statp) < 0) {
+ if (!dev->device_resource->mount_point
+ || stat(dev->device_resource->mount_point, &statp) < 0) {
BErrNo be;
dev->dev_errno = errno;
Jmsg2(jcr, M_ERROR_TERM, 0, _("Unable to stat mount point %s: ERR=%s\n"),
- device_resource->mount_point, be.bstrerror());
+ dev->device_resource->mount_point, be.bstrerror());
}
- if (!device_resource->mount_command || !device_resource->unmount_command) {
+ if (!dev->device_resource->mount_command
+ || !dev->device_resource->unmount_command) {
Jmsg0(jcr, M_ERROR_TERM, 0,
_("Mount and unmount commands must defined for a device which "
"requires mount.\n"));
@@ -389,8 +294,6 @@ Device* FactoryCreateDevice(JobControlRecord* jcr,
dev->initiated = true;
Dmsg3(100, "dev=%s dev_max_bs=%u max_bs=%u\n", dev->archive_device_string,
dev->device_resource->max_block_size, dev->max_block_size);
-
- return dev;
}
// This routine initializes the device wait timers
@@ -603,7 +506,7 @@ bool Device::open(DeviceControlRecord* dcr, DeviceMode omode)
}
Dmsg4(100, "open dev: type=%d archive_device_string=%s vol=%s mode=%s\n",
- dev_type, print_name(), getVolCatName(), mode_to_str(omode));
+ device_type.c_str(), print_name(), getVolCatName(), mode_to_str(omode));
ClearBit(ST_LABEL, state);
ClearBit(ST_APPENDREADY, state);
@@ -732,15 +635,25 @@ bool Device::rewind(DeviceControlRecord* dcr)
if (fd < 0) { return false; }
- if (IsFifo() || IsVtl()) { return true; }
-
- if (d_lseek(dcr, (boffset_t)0, SEEK_SET) < 0) {
- BErrNo be;
- dev_errno = errno;
- Mmsg2(errmsg, _("lseek error on %s. ERR=%s"), print_name(), be.bstrerror());
- return false;
+ switch (GetSeekMode()) {
+ case SeekMode::NOSEEK: {
+ return true;
+ } break;
+ case SeekMode::BYTES: {
+ if (d_lseek(dcr, (boffset_t)0, SEEK_SET) < 0) {
+ BErrNo be;
+ dev_errno = errno;
+ Mmsg2(errmsg, _("lseek error on %s. ERR=%s"), print_name(),
+ be.bstrerror());
+ return false;
+ }
+ } break;
+ case SeekMode::FILE_BLOCK: {
+ dev_errno = EINVAL;
+ Mmsg(errmsg, "Block addressed backends must override rewind().");
+ return false;
+ } break;
}
-
return true;
}
@@ -782,8 +695,6 @@ bool Device::eod(DeviceControlRecord* dcr)
return false;
}
- if (IsVtl()) { return true; }
-
Dmsg0(100, "Enter eod\n");
if (AtEot()) { return true; }
@@ -820,7 +731,6 @@ bool Device::eod(DeviceControlRecord* dcr)
bool Device::UpdatePos(DeviceControlRecord* dcr)
{
boffset_t pos;
- bool ok = true;
if (!IsOpen()) {
dev_errno = EBADF;
@@ -829,25 +739,34 @@ bool Device::UpdatePos(DeviceControlRecord* dcr)
return false;
}
- if (IsFifo() || IsVtl()) { return true; }
-
- file = 0;
- file_addr = 0;
- pos = d_lseek(dcr, (boffset_t)0, SEEK_CUR);
- if (pos < 0) {
- BErrNo be;
- dev_errno = errno;
- Pmsg1(000, _("Seek error: ERR=%s\n"), be.bstrerror());
- Mmsg2(errmsg, _("lseek error on %s. ERR=%s.\n"), print_name(),
- be.bstrerror());
- ok = false;
- } else {
- file_addr = pos;
- block_num = (uint32_t)pos;
- file = (uint32_t)(pos >> 32);
+ switch (GetSeekMode()) {
+ case SeekMode::NOSEEK: {
+ return true;
+ } break;
+ case SeekMode::BYTES: {
+ file = 0;
+ file_addr = 0;
+ pos = d_lseek(dcr, (boffset_t)0, SEEK_CUR);
+ if (pos < 0) {
+ BErrNo be;
+ dev_errno = errno;
+ Pmsg1(000, _("Seek error: ERR=%s\n"), be.bstrerror());
+ Mmsg2(errmsg, _("lseek error on %s. ERR=%s.\n"), print_name(),
+ be.bstrerror());
+ return false;
+ } else {
+ file_addr = pos;
+ block_num = (uint32_t)pos;
+ file = (uint32_t)(pos >> 32);
+ }
+ } break;
+ case SeekMode::FILE_BLOCK: {
+ dev_errno = EINVAL;
+ Mmsg(errmsg, "Block addressed backends must override UpdatePos().");
+ return false;
+ } break;
}
-
- return ok;
+ return true;
}
char* Device::StatusDev()
@@ -920,20 +839,30 @@ bool Device::Reposition(DeviceControlRecord* dcr,
return false;
}
- if (IsFifo() || IsVtl()) { return true; }
-
- boffset_t pos = (((boffset_t)rfile) << 32) | rblock;
- Dmsg1(100, "===== lseek to %d\n", (int)pos);
- if (d_lseek(dcr, pos, SEEK_SET) == (boffset_t)-1) {
- BErrNo be;
- dev_errno = errno;
- Mmsg2(errmsg, _("lseek error on %s. ERR=%s.\n"), print_name(),
- be.bstrerror());
- return false;
+ switch (GetSeekMode()) {
+ case SeekMode::NOSEEK: {
+ return true;
+ } break;
+ case SeekMode::BYTES: {
+ boffset_t pos = (((boffset_t)rfile) << 32) | rblock;
+ Dmsg1(100, "===== lseek to %d\n", (int)pos);
+ if (d_lseek(dcr, pos, SEEK_SET) == (boffset_t)-1) {
+ BErrNo be;
+ dev_errno = errno;
+ Mmsg2(errmsg, _("lseek error on %s. ERR=%s.\n"), print_name(),
+ be.bstrerror());
+ return false;
+ }
+ file = rfile;
+ block_num = rblock;
+ file_addr = pos;
+ } break;
+ case SeekMode::FILE_BLOCK: {
+ dev_errno = EINVAL;
+ Mmsg(errmsg, "Block addressed backends must override Reposition().");
+ return false;
+ } break;
}
- file = rfile;
- block_num = rblock;
- file_addr = pos;
return true;
}
@@ -971,22 +900,15 @@ bool Device::close(DeviceControlRecord* dcr)
if (!norewindonclose) { OfflineOrRewind(); }
- switch (dev_type) {
- case DeviceType::B_VTL_DEV:
- case DeviceType::B_TAPE_DEV:
- UnlockDoor();
- [[fallthrough]];
- default:
- status = d_close(fd);
- if (status < 0) {
- BErrNo be;
+ if (device_type == DeviceType::B_TAPE_DEV) { UnlockDoor(); }
+ status = d_close(fd);
+ if (status < 0) {
+ BErrNo be;
- Mmsg2(errmsg, _("Unable to close device %s. ERR=%s\n"), print_name(),
- be.bstrerror());
- dev_errno = errno;
- retval = false;
- }
- break;
+ Mmsg2(errmsg, _("Unable to close device %s. ERR=%s\n"), print_name(),
+ be.bstrerror());
+ dev_errno = errno;
+ retval = false;
}
unmount(dcr, 1); /* do unmount if required */
diff --git a/core/src/stored/dev.h b/core/src/stored/dev.h
index 4aca812ad..ad27ae7b1 100644
--- a/core/src/stored/dev.h
+++ b/core/src/stored/dev.h
@@ -86,19 +86,6 @@ enum class DeviceMode : int
OPEN_WRITE_ONLY
};
-enum class DeviceType : int
-{
- B_UNKNOWN_DEV = 0,
- B_FILE_DEV = 1,
- B_TAPE_DEV,
- B_FIFO_DEV,
- B_VTL_DEV,
- B_GFAPI_DEV,
- B_DROPLET_DEV,
- B_RADOS_DEV,
- B_CEPHFS_DEV
-};
-
// Generic status bits returned from StatusDev()
enum
{
@@ -183,6 +170,22 @@ enum
// Make sure you have enough bits to store all above bit fields.
#define ST_BYTES NbytesForBits(ST_MAX + 1)
+enum class SeekMode
+{
+ NOSEEK, // device cannot be seeked (e.g. a FIFO)
+ FILE_BLOCK, // device works with file and blocknum (like a tape)
+ BYTES // device uses byte offsets (like a plain file)
+};
+
+// incomplete list of device types for GuessMissingDeviceTypes()
+struct DeviceType {
+ static constexpr std::string_view B_DROPLET_DEV = "droplet";
+ static constexpr std::string_view B_FIFO_DEV = "fifo";
+ static constexpr std::string_view B_FILE_DEV = "file";
+ static constexpr std::string_view B_TAPE_DEV = "tape";
+ static constexpr std::string_view B_UNKNOWN_DEV = "";
+};
+
/*
* Device structure definition.
*
@@ -205,7 +208,11 @@ class Device {
public:
Device() = default;
virtual ~Device();
- Device* swap_dev{}; /**< Swap vol from this device */
+ Device(const Device&) = delete;
+ Device& operator=(const Device&) = delete;
+ Device(Device&&) = delete;
+ Device& operator=(Device&&) = delete;
+ Device* swap_dev{}; /**< Swap vol from this device */
std::vector<DeviceControlRecord*> attached_dcrs; /**< Attached DeviceControlRecords */
pthread_mutex_t mutex_ = PTHREAD_MUTEX_INITIALIZER; /**< Access control */
pthread_mutex_t spool_mutex = PTHREAD_MUTEX_INITIALIZER; /**< Mutex for updating spool_size */
@@ -222,7 +229,7 @@ class Device {
int dev_errno{}; /**< Our own errno */
int oflags{}; /**< Read/write flags */
DeviceMode open_mode{DeviceMode::kUndefined};
- DeviceType dev_type{DeviceType::B_UNKNOWN_DEV};
+ std::string device_type{};
bool autoselect{}; /**< Autoselect in autochanger */
bool norewindonclose{}; /**< Don't rewind tape drive on close */
bool initiated{}; /**< Set when FactoryCreateDevice() called */
@@ -291,20 +298,12 @@ class Device {
bool AttachedToAutochanger() const { return BitIsSet(CAP_ATTACHED_TO_AUTOCHANGER, capabilities); }
bool RequiresMount() const { return BitIsSet(CAP_REQMOUNT, capabilities); }
bool IsRemovable() const { return BitIsSet(CAP_REM, capabilities); }
- bool IsTape() const { return (dev_type == DeviceType::B_TAPE_DEV); }
- bool IsFile() const
- {
- return (dev_type == DeviceType::B_FILE_DEV || dev_type == DeviceType::B_GFAPI_DEV ||
- dev_type == DeviceType::B_DROPLET_DEV || dev_type == DeviceType::B_RADOS_DEV ||
- dev_type == DeviceType::B_CEPHFS_DEV);
- }
- bool IsFifo() const { return dev_type == DeviceType::B_FIFO_DEV; }
- bool IsVtl() const { return dev_type == DeviceType::B_VTL_DEV; }
+ bool IsTape() const { return (device_type == DeviceType::B_TAPE_DEV); }
bool IsOpen() const { return fd >= 0; }
bool IsOffline() const { return BitIsSet(ST_OFFLINE, state); }
bool IsLabeled() const { return BitIsSet(ST_LABEL, state); }
bool IsMounted() const { return BitIsSet(ST_MOUNTED, state); }
- bool IsUnmountable() const { return ((IsFile() && IsRemovable())); }
+ bool IsUnmountable() const { return (IsRemovable() && RequiresMount()); }
int NumReserved() const { return num_reserved_; }
bool is_part_spooled() const { return BitIsSet(ST_PART_SPOOLED, state); }
bool have_media() const { return BitIsSet(ST_MEDIA, state); }
@@ -336,6 +335,7 @@ class Device {
const char* strerror() const;
const char* archive_name() const;
const char* name() const;
+ const std::string& type() const { return device_type; }
const char* print_name() const; /**< Name for display purposes */
void SetEot() { SetBit(ST_EOT, state); }
void SetEof() { SetBit(ST_EOF, state); }
@@ -405,7 +405,11 @@ class Device {
bool unmount(DeviceControlRecord* dcr, int timeout);
void EditMountCodes(PoolMem& omsg, const char* imsg);
bool OfflineOrRewind();
- bool ScanDirForVolume(DeviceControlRecord* dcr);
+protected:
+ bool ScanDirectoryForVolume(DeviceControlRecord* dcr);
+ virtual bool ScanForVolumeImpl(DeviceControlRecord* dcr);
+public:
+ bool ScanForVolume(DeviceControlRecord* dcr);
void SetSlotNumber(slot_number_t slot);
void InvalidateSlotNumber();
@@ -449,6 +453,8 @@ class Device {
return true;
}
virtual bool DeviceStatus(DeviceStatusInformation*) { return false; }
+ virtual SeekMode GetSeekMode() const = 0;
+ virtual bool CanReadConcurrently() const { return false; }
// Low level operations
virtual int d_ioctl(int fd, ioctl_req_t request, char* mt_com = NULL) = 0;
@@ -495,14 +501,13 @@ class SpoolDevice :public Device
public:
SpoolDevice() = default;
~SpoolDevice() { close(nullptr); }
+ SeekMode GetSeekMode() const override { return SeekMode::NOSEEK; }
int d_ioctl(int, ioctl_req_t, char*) override {return -1;}
int d_open(const char*, int, int) override {return -1;}
int d_close(int) override {return -1;}
ssize_t d_read(int, void*, size_t) override { return 0;}
ssize_t d_write(int, const void*, size_t) override { return 0;}
- boffset_t d_lseek(DeviceControlRecord*,
- boffset_t,
- int) override { return 0;}
+ boffset_t d_lseek(DeviceControlRecord*, boffset_t, int) override { return 0;}
bool d_truncate(DeviceControlRecord*) override {return false;}
};
/* clang-format on */
diff --git a/core/src/stored/device_resource.cc b/core/src/stored/device_resource.cc
index 35e1e861e..7fb59d7de 100644
--- a/core/src/stored/device_resource.cc
+++ b/core/src/stored/device_resource.cc
@@ -3,7 +3,7 @@
Copyright (C) 2000-2011 Free Software Foundation Europe e.V.
Copyright (C) 2011-2012 Planets Communications B.V.
- Copyright (C) 2013-2021 Bareos GmbH & Co. KG
+ Copyright (C) 2013-2022 Bareos GmbH & Co. KG
This program is Free Software; you can redistribute it and/or
modify it under the terms of version three of the GNU Affero General Public
@@ -38,7 +38,7 @@ DeviceResource::DeviceResource()
, changer_command(nullptr)
, alert_command(nullptr)
, spool_directory(nullptr)
- , dev_type(DeviceType::B_UNKNOWN_DEV)
+ , device_type(DeviceType::B_UNKNOWN_DEV)
, label_type(B_BAREOS_LABEL)
, autoselect(true)
, norewindonclose(true)
@@ -115,7 +115,7 @@ DeviceResource::DeviceResource(const DeviceResource& other)
if (other.spool_directory) {
spool_directory = strdup(other.spool_directory);
}
- dev_type = other.dev_type;
+ device_type = other.device_type;
label_type = other.label_type;
autoselect = other.autoselect;
norewindonclose = other.norewindonclose;
@@ -170,7 +170,7 @@ DeviceResource& DeviceResource::operator=(const DeviceResource& rhs)
changer_command = rhs.changer_command;
alert_command = rhs.alert_command;
spool_directory = rhs.spool_directory;
- dev_type = rhs.dev_type;
+ device_type = rhs.device_type;
label_type = rhs.label_type;
autoselect = rhs.autoselect;
norewindonclose = rhs.norewindonclose;
@@ -274,13 +274,10 @@ void DeviceResource::CreateAndAssignSerialNumber(uint16_t number)
bool DeviceResource::Validate()
{
- if (max_block_size > 0 && dev_type != DeviceType::B_TAPE_DEV) {
+ if (max_block_size > 0 && device_type != DeviceType::B_TAPE_DEV) {
my_config->AddWarning(
"Setting 'Maximum Block Size' on a non-tape device is unsupported");
}
- if (dev_type == DeviceType::B_RADOS_DEV) {
- my_config->AddWarning("The Rados Storage Backend Device is deprecated");
- }
return true;
}
diff --git a/core/src/stored/device_resource.h b/core/src/stored/device_resource.h
index 987cf2708..1a115ef0b 100644
--- a/core/src/stored/device_resource.h
+++ b/core/src/stored/device_resource.h
@@ -3,7 +3,7 @@
Copyright (C) 2000-2011 Free Software Foundation Europe e.V.
Copyright (C) 2011-2012 Planets Communications B.V.
- Copyright (C) 2013-2021 Bareos GmbH & Co. KG
+ Copyright (C) 2013-2022 Bareos GmbH & Co. KG
This program is Free Software; you can redistribute it and/or
modify it under the terms of version three of the GNU Affero General Public
@@ -35,16 +35,16 @@ class AutochangerResource;
class DeviceResource : public BareosResource {
public:
- char* media_type; /**< User assigned media type */
- char* archive_device_string; /**< Archive device name */
- char* device_options; /**< Device specific option string */
- char* diag_device_name; /**< Diagnostic device name */
- char* changer_name; /**< Changer device name */
- char* changer_command; /**< Changer command -- external program */
- char* alert_command; /**< Alert command -- external program */
- char* spool_directory; /**< Spool file directory */
- DeviceType dev_type; /**< device type */
- uint32_t label_type; /**< label type */
+ char* media_type; /**< User assigned media type */
+ char* archive_device_string; /**< Archive device name */
+ char* device_options; /**< Device specific option string */
+ char* diag_device_name; /**< Diagnostic device name */
+ char* changer_name; /**< Changer device name */
+ char* changer_command; /**< Changer command -- external program */
+ char* alert_command; /**< Alert command -- external program */
+ char* spool_directory; /**< Spool file directory */
+ std::string device_type;
+ uint32_t label_type;
bool autoselect; /**< Automatically select from AutoChanger */
bool norewindonclose; /**< Don't rewind tape drive on close */
bool drive_tapealert_enabled; /**< Enable Tape Alert monitoring */
diff --git a/core/src/stored/mount.cc b/core/src/stored/mount.cc
index 73d2de8b4..5f2891d06 100644
--- a/core/src/stored/mount.cc
+++ b/core/src/stored/mount.cc
@@ -244,11 +244,10 @@ mount_next_vol:
while (!dev->open(dcr, mode)) {
Dmsg1(150, "OpenDevice failed: ERR=%s\n", dev->bstrerror());
- if (dev->IsFile() && dev->IsRemovable()) {
- bool ok = true;
- Dmsg0(150, "call scan_dir_for_vol\n");
- if (ok && dev->ScanDirForVolume(dcr)) {
- if (dev->open(dcr, mode)) { break; /* got a valid volume */ }
+ if (dev->IsRemovable()) {
+ Dmsg0(150, "call ScanForVolume\n");
+ if (dev->ScanForVolume(dcr) && dev->open(dcr, mode)) {
+ break; /* got a valid volume */
}
}
if (TryAutolabel(false) == try_read_vol) {
@@ -654,85 +653,78 @@ void DeviceControlRecord::DoSwapping(bool)
*/
bool DeviceControlRecord::is_eod_valid()
{
- DeviceControlRecord* dcr = this;
-
- if (dev->IsTape()) {
- /*
- * Check if we are positioned on the tape at the same place
- * that the database says we should be.
- */
- if (dev->VolCatInfo.VolCatFiles == dev->GetFile()) {
- Jmsg(jcr, M_INFO, 0,
- _("Ready to append to end of Volume \"%s\" at file=%d.\n"),
- VolumeName, dev->GetFile());
- } else if (dev->GetFile() > dev->VolCatInfo.VolCatFiles) {
- Jmsg(jcr, M_WARNING, 0,
- _("For Volume \"%s\":\n"
- "The number of files mismatch! Volume=%u Catalog=%u\n"
- "Correcting Catalog\n"),
- VolumeName, dev->GetFile(), dev->VolCatInfo.VolCatFiles);
- dev->VolCatInfo.VolCatFiles = dev->GetFile();
- dev->VolCatInfo.VolCatBlocks = dev->GetBlockNum();
- if (!dcr->DirUpdateVolumeInfo(false, true)) {
- Jmsg(jcr, M_WARNING, 0, _("Error updating Catalog\n"));
+ switch (dev->GetSeekMode()) {
+ case SeekMode::FILE_BLOCK: {
+ /*
+ * Check if we are positioned on the tape at the same place
+ * that the database says we should be.
+ */
+ if (dev->VolCatInfo.VolCatFiles == dev->GetFile()) {
+ Jmsg(jcr, M_INFO, 0,
+ _("Ready to append to end of Volume \"%s\" at file=%d.\n"),
+ VolumeName, dev->GetFile());
+ } else if (dev->GetFile() > dev->VolCatInfo.VolCatFiles) {
+ Jmsg(jcr, M_WARNING, 0,
+ _("For Volume \"%s\":\n"
+ "The number of files mismatch! Volume=%u Catalog=%u\n"
+ "Correcting Catalog\n"),
+ VolumeName, dev->GetFile(), dev->VolCatInfo.VolCatFiles);
+ dev->VolCatInfo.VolCatFiles = dev->GetFile();
+ dev->VolCatInfo.VolCatBlocks = dev->GetBlockNum();
+ if (!DirUpdateVolumeInfo(false, true)) {
+ Jmsg(jcr, M_WARNING, 0, _("Error updating Catalog\n"));
+ MarkVolumeInError();
+ return false;
+ }
+ } else {
+ Jmsg(jcr, M_ERROR, 0,
+ _("Bareos cannot write on tape Volume \"%s\" because:\n"
+ "The number of files mismatch! Volume=%u Catalog=%u\n"),
+ VolumeName, dev->GetFile(), dev->VolCatInfo.VolCatFiles);
MarkVolumeInError();
return false;
}
- } else {
- Jmsg(jcr, M_ERROR, 0,
- _("Bareos cannot write on tape Volume \"%s\" because:\n"
- "The number of files mismatch! Volume=%u Catalog=%u\n"),
- VolumeName, dev->GetFile(), dev->VolCatInfo.VolCatFiles);
- MarkVolumeInError();
- return false;
- }
- } else if (dev->IsFile()) {
- char ed1[50], ed2[50];
-
- boffset_t pos;
- pos = dev->d_lseek(dcr, (boffset_t)0, SEEK_CUR);
- if (dev->VolCatInfo.VolCatBytes == (uint64_t)pos) {
- Jmsg(jcr, M_INFO, 0,
- _("Ready to append to end of Volume \"%s\""
- " size=%s\n"),
- VolumeName, edit_uint64(dev->VolCatInfo.VolCatBytes, ed1));
- } else if ((uint64_t)pos > dev->VolCatInfo.VolCatBytes) {
- Jmsg(jcr, M_WARNING, 0,
- _("For Volume \"%s\":\n"
- "The sizes do not match! Volume=%s Catalog=%s\n"
- "Correcting Catalog\n"),
- VolumeName, edit_uint64(pos, ed1),
- edit_uint64(dev->VolCatInfo.VolCatBytes, ed2));
- dev->VolCatInfo.VolCatBytes = (uint64_t)pos;
- dev->VolCatInfo.VolCatFiles = (uint32_t)(pos >> 32);
- if (!dcr->DirUpdateVolumeInfo(false, true)) {
- Jmsg(jcr, M_WARNING, 0, _("Error updating Catalog\n"));
+ } break;
+ case SeekMode::BYTES: {
+ char ed1[50], ed2[50];
+
+ boffset_t pos;
+ pos = dev->d_lseek(this, (boffset_t)0, SEEK_CUR);
+ if (dev->VolCatInfo.VolCatBytes == (uint64_t)pos) {
+ Jmsg(jcr, M_INFO, 0,
+ _("Ready to append to end of Volume \"%s\""
+ " size=%s\n"),
+ VolumeName, edit_uint64(dev->VolCatInfo.VolCatBytes, ed1));
+ } else if ((uint64_t)pos > dev->VolCatInfo.VolCatBytes) {
+ Jmsg(jcr, M_WARNING, 0,
+ _("For Volume \"%s\":\n"
+ "The sizes do not match! Volume=%s Catalog=%s\n"
+ "Correcting Catalog\n"),
+ VolumeName, edit_uint64(pos, ed1),
+ edit_uint64(dev->VolCatInfo.VolCatBytes, ed2));
+ dev->VolCatInfo.VolCatBytes = (uint64_t)pos;
+ dev->VolCatInfo.VolCatFiles = (uint32_t)(pos >> 32);
+ if (!DirUpdateVolumeInfo(false, true)) {
+ Jmsg(jcr, M_WARNING, 0, _("Error updating Catalog\n"));
+ MarkVolumeInError();
+ return false;
+ }
+ } else {
+ Mmsg(jcr->errmsg,
+ _("Bareos cannot write on disk Volume \"%s\" because: "
+ "The sizes do not match! Volume=%s Catalog=%s\n"),
+ VolumeName, edit_uint64(pos, ed1),
+ edit_uint64(dev->VolCatInfo.VolCatBytes, ed2));
+ Jmsg(jcr, M_ERROR, 0, jcr->errmsg);
+ Dmsg0(050, jcr->errmsg);
MarkVolumeInError();
return false;
}
- } else {
- Mmsg(jcr->errmsg,
- _("Bareos cannot write on disk Volume \"%s\" because: "
- "The sizes do not match! Volume=%s Catalog=%s\n"),
- VolumeName, edit_uint64(pos, ed1),
- edit_uint64(dev->VolCatInfo.VolCatBytes, ed2));
- Jmsg(jcr, M_ERROR, 0, jcr->errmsg);
- Dmsg0(050, jcr->errmsg);
- MarkVolumeInError();
- return false;
- }
- } else if (dev->IsFifo() || dev->IsVtl()) {
- return true;
- } else {
- Mmsg1(
- jcr->errmsg,
- _("Don't know how to check if EOD is valid for a device of type %d\n"),
- dev->dev_type);
- Jmsg(jcr, M_ERROR, 0, jcr->errmsg);
- Dmsg0(050, jcr->errmsg);
- return false;
+ } break;
+ case SeekMode::NOSEEK: {
+ return true;
+ } break;
}
-
return true;
}
diff --git a/core/src/stored/scan.cc b/core/src/stored/scan.cc
index 4d6d271ce..857a877f2 100644
--- a/core/src/stored/scan.cc
+++ b/core/src/stored/scan.cc
@@ -2,7 +2,7 @@
BAREOSĀ® - Backup Archiving REcovery Open Sourced
Copyright (C) 2006-2011 Free Software Foundation Europe e.V.
- Copyright (C) 2016-2021 Bareos GmbH & Co. KG
+ Copyright (C) 2016-2022 Bareos GmbH & Co. KG
This program is Free Software; you can redistribute it and/or
modify it under the terms of version three of the GNU Affero General Public
@@ -35,8 +35,15 @@ namespace storagedaemon {
/* Forward referenced functions */
static bool IsVolumeNameLegal(char* name);
+bool Device::ScanForVolume(DeviceControlRecord* dcr)
+{
+ return ScanForVolumeImpl(dcr); // call virtual implementation
+}
+
+/* default implementation: don't scan at all */
+bool Device::ScanForVolumeImpl(DeviceControlRecord*) { return false; }
-bool Device::ScanDirForVolume(DeviceControlRecord* dcr)
+bool Device::ScanDirectoryForVolume(DeviceControlRecord* dcr)
{
DIR* dp;
struct dirent* result;
diff --git a/core/src/stored/sd_backends.cc b/core/src/stored/sd_backends.cc
deleted file mode 100644
index 0c3916b25..000000000
--- a/core/src/stored/sd_backends.cc
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- BAREOSĀ® - Backup Archiving REcovery Open Sourced
-
- Copyright (C) 2014-2014 Planets Communications B.V.
- Copyright (C) 2014-2022 Bareos GmbH & Co. KG
-
- This program is Free Software; you can redistribute it and/or
- modify it under the terms of version three of the GNU Affero General Public
- License as published by the Free Software Foundation and included
- in the file LICENSE.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301, USA.
-*/
-// Marco van Wieringen, June 2014
-/**
- * @file
- * Dynamic loading of SD backend plugins.
- */
-
-#include "include/bareos.h"
-
-#if defined(HAVE_DYNAMIC_SD_BACKENDS)
-
-# include "stored/stored.h"
-# include "sd_backends.h"
-
-# include <cstdlib>
-# include <dlfcn.h>
-# include <map>
-# include <memory>
-# include <stdexcept>
-# include <vector>
-
-namespace storagedaemon {
-
-struct BackendDeviceLibraryDescriptor {
- public:
- DeviceType device_type{DeviceType::B_UNKNOWN_DEV};
-
- private:
- void* dynamic_library_handle{};
- BackendInterface* backend_interface{};
-
- public:
- BackendDeviceLibraryDescriptor(DeviceType t_device_type,
- void* t_dynamic_library_handle,
- BackendInterface* t_backend_interface)
- : device_type(t_device_type)
- , dynamic_library_handle(t_dynamic_library_handle)
- , backend_interface(t_backend_interface)
- {
- }
-
- ~BackendDeviceLibraryDescriptor()
- {
- FlushDevice();
- delete backend_interface;
- dlclose(dynamic_library_handle);
- }
-
- BackendDeviceLibraryDescriptor(const BackendDeviceLibraryDescriptor& other)
- = delete;
- BackendDeviceLibraryDescriptor& operator=(
- const BackendDeviceLibraryDescriptor& other)
- = delete;
- BackendDeviceLibraryDescriptor(BackendDeviceLibraryDescriptor&& other)
- {
- device_type = other.device_type;
- std::swap(dynamic_library_handle, other.dynamic_library_handle);
- std::swap(backend_interface, other.backend_interface);
- }
- BackendDeviceLibraryDescriptor& operator=(
- BackendDeviceLibraryDescriptor&& other)
- {
- device_type = other.device_type;
- std::swap(dynamic_library_handle, other.dynamic_library_handle);
- std::swap(backend_interface, other.backend_interface);
- return *this;
- }
-
- Device* GetDevice(JobControlRecord* jcr, DeviceType device_type)
- {
- return backend_interface->GetDevice(jcr, device_type);
- }
- void FlushDevice() { backend_interface->FlushDevice(); }
-};
-
-const std::map<DeviceType, const char*> device_type_to_name_mapping
- = {{DeviceType::B_FIFO_DEV, "fifo"},
- {DeviceType::B_TAPE_DEV, "tape"},
- {DeviceType::B_GFAPI_DEV, "gfapi"},
- {DeviceType::B_DROPLET_DEV, "droplet"},
- {DeviceType::B_UNKNOWN_DEV, nullptr}};
-
-static std::vector<std::unique_ptr<BackendDeviceLibraryDescriptor>>
- loaded_backends;
-static std::vector<std::string> backend_directories;
-
-void SetBackendDeviceDirectories(
- std::vector<std::string>&& new_backend_directories)
-{
- backend_directories = new_backend_directories;
-}
-
-static inline const char* get_dlerror()
-{
- const char* error = dlerror();
- return error != nullptr ? error : "";
-}
-
-Device* InitBackendDevice(JobControlRecord* jcr, DeviceType device_type)
-{
- if (backend_directories.empty()) {
- Jmsg(jcr, M_ERROR_TERM, 0, _("Catalog Backends Dir not configured.\n"));
- // does not return
- }
-
- const char* interface_name = nullptr;
-
- try {
- interface_name = device_type_to_name_mapping.at(device_type);
- } catch (const std::out_of_range&) {
- return nullptr;
- }
-
- for (const auto& b : loaded_backends) {
- if (b->device_type == device_type) {
- return b->GetDevice(jcr, device_type);
- }
- }
-
- t_backend_base GetBackend{nullptr};
- void* dynamic_library_handle{nullptr};
-
- for (const auto& backend_dir : backend_directories) {
- if (dynamic_library_handle != nullptr) { break; }
-
- std::string shared_library_name = backend_dir + "/libbareossd-";
- shared_library_name += interface_name;
- shared_library_name += DYN_LIB_EXTENSION;
-
- Dmsg3(100, "InitBackendDevice: checking backend %s/libbareossd-%s%s\n",
- backend_dir.c_str(), interface_name, DYN_LIB_EXTENSION);
-
- struct stat st;
- if (stat(shared_library_name.c_str(), &st) != 0) {
- Dmsg3(100,
- "InitBackendDevice: backend does not exist %s/libbareossd-%s%s\n",
- backend_dir.c_str(), interface_name, DYN_LIB_EXTENSION);
- return nullptr;
- }
-
- dynamic_library_handle = dlopen(shared_library_name.c_str(), RTLD_NOW);
-
- if (dynamic_library_handle == nullptr) {
- const char* error = get_dlerror();
- Jmsg(jcr, M_ERROR, 0, _("Unable to load shared library: %s ERR=%s\n"),
- shared_library_name.c_str(), error);
- Dmsg2(100, _("Unable to load shared library: %s ERR=%s\n"),
- shared_library_name.c_str(), error);
- continue;
- }
-
- GetBackend = reinterpret_cast<t_backend_base>(
- dlsym(dynamic_library_handle, "GetBackend"));
-
- if (GetBackend == nullptr) {
- const char* error = get_dlerror();
- Jmsg(jcr, M_ERROR, 0,
- _("Lookup of GetBackend in shared library %s failed: "
- "ERR=%s\n"),
- shared_library_name.c_str(), error);
- Dmsg2(100,
- _("Lookup of GetBackend in shared library %s failed: "
- "ERR=%s\n"),
- shared_library_name.c_str(), error);
- dlclose(dynamic_library_handle);
- dynamic_library_handle = nullptr;
- continue;
- }
- }
-
- if (dynamic_library_handle == nullptr) {
- Jmsg(jcr, M_ERROR_TERM, 0,
- _("Unable to load any shared library for libbareossd-%s%s\n"),
- interface_name, DYN_LIB_EXTENSION);
- return nullptr;
- }
- if (!GetBackend) {
- Jmsg(jcr, M_ERROR_TERM, 0,
- _("Unable to locate GetBackend() function in shared backend library "
- "for libbareossd-%s%s\n"),
- interface_name, DYN_LIB_EXTENSION);
- return nullptr;
- }
-
- auto b = std::make_unique<BackendDeviceLibraryDescriptor>(
- device_type, dynamic_library_handle, GetBackend());
-
- Device* d = b->GetDevice(jcr, device_type);
- loaded_backends.push_back(std::move(b));
- return d;
-}
-
-void FlushAndCloseBackendDevices() { loaded_backends.clear(); }
-
-} /* namespace storagedaemon */
-
-#endif /* HAVE_DYNAMIC_SD_BACKENDS */
diff --git a/core/src/stored/sd_backends.h b/core/src/stored/sd_backends.h
index 9ba9840b1..cb8b834d0 100644
--- a/core/src/stored/sd_backends.h
+++ b/core/src/stored/sd_backends.h
@@ -1,8 +1,7 @@
/*
BAREOSĀ® - Backup Archiving REcovery Open Sourced
- Copyright (C) 2014-2014 Planets Communications B.V.
- Copyright (C) 2014-2022 Bareos GmbH & Co. KG
+ Copyright (C) 2022-2022 Bareos GmbH & Co. KG
This program is Free Software; you can redistribute it and/or
modify it under the terms of version three of the GNU Affero General Public
@@ -19,49 +18,27 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
-// Marco van Wieringen, June 2014
-/**
- * @file
- * Dynamic loading of SD backend plugins.
- */
#ifndef BAREOS_STORED_SD_BACKENDS_H_
#define BAREOS_STORED_SD_BACKENDS_H_
-namespace storagedaemon {
-
-class BackendInterface {
- public:
- virtual ~BackendInterface() {}
- virtual Device* GetDevice(JobControlRecord* jcr, DeviceType device_type) = 0;
- virtual void FlushDevice(void) = 0;
-};
+#include <lib/implementation_factory.h>
+namespace storagedaemon {
-extern "C" {
-typedef BackendInterface* (*t_backend_base)(void);
-BackendInterface* GetBackend(void);
-}
+class Device;
+template <typename T> Device* DeviceFactory(void) { return new T(); }
-#if defined(HAVE_WIN32)
-# define DYN_LIB_EXTENSION ".dll"
-#elif defined(HAVE_DARWIN_OS)
-/* cmake MODULE creates a .so files; cmake SHARED creates .dylib */
-// #define DYN_LIB_EXTENSION ".dylib"
-# define DYN_LIB_EXTENSION ".so"
-#else
-# define DYN_LIB_EXTENSION ".so"
+#if defined(HAVE_DYNAMIC_SD_BACKENDS)
+bool LoadStorageBackend(const std::string& device_type,
+ const std::vector<std::string>& backend_directories);
#endif
+#define REGISTER_SD_BACKEND(backend_name, backend_class) \
+ [[maybe_unused]] static bool backend_name##_backend_ \
+ = ImplementationFactory<Device>::Add(#backend_name, \
+ DeviceFactory<backend_class>);
-#if defined(HAVE_DYNAMIC_SD_BACKENDS)
-# include <map>
-void SetBackendDeviceDirectories(std::vector<std::string>&& new_backend_dirs);
-Device* InitBackendDevice(JobControlRecord* jcr, DeviceType device_type);
-void FlushAndCloseBackendDevices();
-
-extern const std::map<DeviceType, const char*> device_type_to_name_mapping;
-#endif
-} /* namespace storagedaemon */
+} // namespace storagedaemon
#endif // BAREOS_STORED_SD_BACKENDS_H_
diff --git a/core/src/stored/sd_backends_dynamic.cc b/core/src/stored/sd_backends_dynamic.cc
new file mode 100644
index 000000000..2d4fcf9e6
--- /dev/null
+++ b/core/src/stored/sd_backends_dynamic.cc
@@ -0,0 +1,78 @@
+/*
+ BAREOSĀ® - Backup Archiving REcovery Open Sourced
+
+ Copyright (C) 2022-2022 Bareos GmbH & Co. KG
+
+ This program is Free Software; you can redistribute it and/or
+ modify it under the terms of version three of the GNU Affero General Public
+ License as published by the Free Software Foundation and included
+ in the file LICENSE.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+*/
+/**
+ * @file
+ * Dynamic loading of SD backend plugins.
+ */
+
+#include "include/bareos.h"
+
+#include "stored/stored.h"
+#include "sd_backends.h"
+#include <dlfcn.h>
+
+namespace storagedaemon {
+
+#if defined(HAVE_WIN32)
+static const char* kDynLibExtension = ".dll";
+#else
+static const char* kDynLibExtension = ".so";
+#endif
+
+static bool LoadDynamicLibrary(
+ const std::string& library_file,
+ const std::vector<std::string>& library_directories)
+{
+ for (const auto& library_dir : library_directories) {
+ if (dlopen((library_dir + "/" + library_file).c_str(), RTLD_NOW)) {
+ Dmsg0(50, "Loaded dynamic library %s/%s\n", library_dir.c_str(),
+ library_file.c_str());
+ return true;
+ }
+ Dmsg0(50, "Could not load library %s/%s: %s\n", library_dir.c_str(),
+ library_file.c_str(), dlerror());
+ }
+ return false;
+}
+
+bool LoadStorageBackend(const std::string& device_type,
+ const std::vector<std::string>& backend_directories)
+{
+ using namespace std::string_literals;
+
+ if (device_type.empty() || backend_directories.empty()) { return false; }
+
+ if (!LoadDynamicLibrary("libbareossd-"s + device_type + kDynLibExtension,
+ backend_directories)) {
+ return false;
+ }
+
+ if (!ImplementationFactory<Device>::IsRegistered(device_type)) {
+ Jmsg(nullptr, M_ERROR_TERM, 0,
+ "Loaded backend library for %s did not register its backend. This is "
+ "probably a bug in the backend library.\n",
+ device_type.c_str());
+ }
+
+ return true;
+}
+
+} /* namespace storagedaemon */
diff --git a/core/src/stored/status.cc b/core/src/stored/status.cc
index 7a662f69c..3e76b991f 100644
--- a/core/src/stored/status.cc
+++ b/core/src/stored/status.cc
@@ -597,18 +597,17 @@ static void SendDeviceStatus(Device* dev, StatusPacket* sp)
len = Mmsg(msg, _("Device state:\n"));
sp->send(msg, len);
- len = Mmsg(
- msg,
- " %sOPENED %sTAPE %sLABEL %sMALLOC %sAPPEND %sREAD %sEOT %sWEOT %sEOF "
- "%sNEXTVOL %sSHORT %sMOUNTED\n",
- dev->IsOpen() ? "" : "!", dev->IsTape() ? "" : "!",
- dev->IsLabeled() ? "" : "!",
- BitIsSet(ST_ALLOCATED, dev->state) ? "" : "!",
- dev->CanAppend() ? "" : "!", dev->CanRead() ? "" : "!",
- dev->AtEot() ? "" : "!", BitIsSet(ST_WEOT, dev->state) ? "" : "!",
- dev->AtEof() ? "" : "!", BitIsSet(ST_NEXTVOL, dev->state) ? "" : "!",
- BitIsSet(ST_SHORT, dev->state) ? "" : "!",
- BitIsSet(ST_MOUNTED, dev->state) ? "" : "!");
+ len = Mmsg(msg,
+ " %sOPENED %sLABEL %sMALLOC %sAPPEND %sREAD %sEOT %sWEOT %sEOF "
+ "%sNEXTVOL %sSHORT %sMOUNTED\n",
+ dev->IsOpen() ? "" : "!", dev->IsLabeled() ? "" : "!",
+ BitIsSet(ST_ALLOCATED, dev->state) ? "" : "!",
+ dev->CanAppend() ? "" : "!", dev->CanRead() ? "" : "!",
+ dev->AtEot() ? "" : "!", BitIsSet(ST_WEOT, dev->state) ? "" : "!",
+ dev->AtEof() ? "" : "!",
+ BitIsSet(ST_NEXTVOL, dev->state) ? "" : "!",
+ BitIsSet(ST_SHORT, dev->state) ? "" : "!",
+ BitIsSet(ST_MOUNTED, dev->state) ? "" : "!");
sp->send(msg, len);
len = Mmsg(msg, _(" num_writers=%d reserves=%d block=%d\n"),
@@ -634,8 +633,8 @@ static void SendDeviceStatus(Device* dev, StatusPacket* sp)
len = Mmsg(msg, _("Device parameters:\n"));
sp->send(msg, len);
- len = Mmsg(msg, _(" Archive name: %s Device name: %s\n"),
- dev->archive_name(), dev->name());
+ len = Mmsg(msg, _(" Archive name: %s\nDevice name: %s\nDevice Type: %s\n"),
+ dev->archive_name(), dev->name(), dev->type().c_str());
sp->send(msg, len);
len = Mmsg(msg, _(" File=%u block=%u\n"), dev->file, dev->block_num);
sp->send(msg, len);
diff --git a/core/src/stored/stored.cc b/core/src/stored/stored.cc
index 1c329549d..57e19939c 100644
--- a/core/src/stored/stored.cc
+++ b/core/src/stored/stored.cc
@@ -663,10 +663,6 @@ static
}
}
-#if defined(HAVE_DYNAMIC_SD_BACKENDS)
- FlushAndCloseBackendDevices();
-#endif
-
if (configfile) {
free(configfile);
configfile = nullptr;
diff --git a/core/src/stored/stored_conf.cc b/core/src/stored/stored_conf.cc
index 736cf00f4..6ef9e1d40 100644
--- a/core/src/stored/stored_conf.cc
+++ b/core/src/stored/stored_conf.cc
@@ -43,6 +43,7 @@
#define NEED_JANSSON_NAMESPACE 1
#include "lib/output_formatter.h"
#include "lib/output_formatter_resource.h"
+#include "lib/implementation_factory.h"
#include "include/auth_types.h"
#include "include/jcr.h"
@@ -147,7 +148,7 @@ static ResourceItem dev_items[] = {
{"Description", CFG_TYPE_STR, ITEM(res_dev, description_), 0, 0, NULL, NULL,
"The Description directive provides easier human recognition, but is not used by Bareos directly."},
{"MediaType", CFG_TYPE_STRNAME, ITEM(res_dev, media_type), 0, CFG_ITEM_REQUIRED, NULL, NULL, NULL},
- {"DeviceType", CFG_TYPE_DEVTYPE, ITEM(res_dev, dev_type), 0, 0, NULL, NULL, NULL},
+ {"DeviceType", CFG_TYPE_STDSTR, ITEM(res_dev, device_type), 0, CFG_ITEM_DEFAULT, "", NULL, NULL},
{"ArchiveDevice", CFG_TYPE_STRNAME, ITEM(res_dev, archive_device_string), 0, CFG_ITEM_REQUIRED, NULL, NULL, NULL},
{"DeviceOptions", CFG_TYPE_STR, ITEM(res_dev, device_options), 0, 0, NULL, "15.2.0-", NULL},
{"DiagnosticDevice", CFG_TYPE_STRNAME, ITEM(res_dev, diag_device_name), 0, 0, NULL, NULL, NULL},
@@ -247,22 +248,6 @@ static ResourceTable resources[] = {
static struct s_kw authentication_methods[]
= {{"None", AT_NONE}, {"Clear", AT_CLEAR}, {"MD5", AT_MD5}, {NULL, 0}};
-struct s_dvt_kw {
- const char* name;
- DeviceType token;
-};
-
-static s_dvt_kw device_types[]
- = {{"file", DeviceType::B_FILE_DEV},
- {"tape", DeviceType::B_TAPE_DEV},
- {"fifo", DeviceType::B_FIFO_DEV},
- {"vtl", DeviceType::B_VTL_DEV},
- {"gfapi", DeviceType::B_GFAPI_DEV},
- /* compatibility: object have been renamed to droplet */
- {"object", DeviceType::B_DROPLET_DEV},
- {"droplet", DeviceType::B_DROPLET_DEV},
- {nullptr, DeviceType::B_UNKNOWN_DEV}};
-
struct s_io_kw {
const char* name;
AutoXflateMode token;
@@ -329,27 +314,6 @@ static void StoreAutopassword(LEX* lc, ResourceItem* item, int index, int pass)
}
}
-static void StoreDeviceType(LEX* lc, ResourceItem* item, int index, int)
-{
- int i;
-
- LexGetToken(lc, BCT_NAME);
- // Store the label pass 2 so that type is defined
- for (i = 0; device_types[i].name; i++) {
- if (Bstrcasecmp(lc->str, device_types[i].name)) {
- SetItemVariable<DeviceType>(*item, device_types[i].token);
- i = 0;
- break;
- }
- }
- if (i != 0) {
- scan_err1(lc, _("Expected a Device Type keyword, got: %s"), lc->str);
- }
- ScanToEol(lc);
- SetBit(index, (*item->allocated_resource)->item_present_);
- ClearBit(index, (*item->allocated_resource)->inherit_content_);
-}
-
// Store Maximum Block Size, and check it is not greater than MAX_BLOCK_LENGTH
static void StoreMaxblocksize(LEX* lc, ResourceItem* item, int index, int pass)
{
@@ -448,9 +412,6 @@ static void ParseConfigCb(LEX* lc,
case CFG_TYPE_AUTHTYPE:
StoreAuthenticationType(lc, item, index, pass);
break;
- case CFG_TYPE_DEVTYPE:
- StoreDeviceType(lc, item, index, pass);
- break;
case CFG_TYPE_MAXBLOCKSIZE:
StoreMaxblocksize(lc, item, index, pass);
break;
@@ -528,11 +489,11 @@ static void CheckDropletDevices(ConfigurationParser& my_config)
while ((p = my_config.GetNextRes(R_DEVICE, p)) != nullptr) {
DeviceResource* d = dynamic_cast<DeviceResource*>(p);
- if (d && d->dev_type == DeviceType::B_DROPLET_DEV) {
+ if (d && d->device_type == DeviceType::B_DROPLET_DEV) {
if (d->max_concurrent_jobs == 0) {
/*
- * 0 is the general default. However, for this dev_type, only 1 works.
- * So we set it to this value.
+ * 0 is the general default. However, for this device_type, only 1
+ * works. So we set it to this value.
*/
Jmsg1(nullptr, M_WARNING, 0,
_("device %s is set to the default 'Maximum Concurrent Jobs' = "
@@ -549,9 +510,81 @@ static void CheckDropletDevices(ConfigurationParser& my_config)
}
}
+static void GuessMissingDeviceTypes(ConfigurationParser& my_config)
+{
+ BareosResource* p = nullptr;
+
+ while ((p = my_config.GetNextRes(R_DEVICE, p)) != nullptr) {
+ DeviceResource* d = dynamic_cast<DeviceResource*>(p);
+ if (d && d->device_type == DeviceType::B_UNKNOWN_DEV) {
+ struct stat statp;
+ // Check that device is available
+ if (stat(d->archive_device_string, &statp) < 0) {
+ BErrNo be;
+ Jmsg2(nullptr, M_ERROR_TERM, 0,
+ _("Unable to stat path '%s' for device %s: ERR=%s\n"
+ "Consider setting Device Type if device is not available when "
+ "daemon starts.\n"),
+ d->archive_device_string, d->resource_name_, be.bstrerror());
+ return;
+ }
+ if (S_ISDIR(statp.st_mode)) {
+ d->device_type = DeviceType::B_FILE_DEV;
+ } else if (S_ISCHR(statp.st_mode)) {
+ d->device_type = DeviceType::B_TAPE_DEV;
+ } else if (S_ISFIFO(statp.st_mode)) {
+ d->device_type = DeviceType::B_FIFO_DEV;
+ } else if (!BitIsSet(CAP_REQMOUNT, d->cap_bits)) {
+ Jmsg2(nullptr, M_ERROR_TERM, 0,
+ "cannot deduce Device Type from '%s'. Must be tape or directory, "
+ "st_mode=%04o\n",
+ d->archive_device_string, (statp.st_mode & ~S_IFMT));
+ return;
+ }
+ }
+ }
+}
+
+static void CheckAndLoadDeviceBackends(ConfigurationParser& my_config)
+{
+#if defined(HAVE_DYNAMIC_SD_BACKENDS)
+ auto storage_res
+ = dynamic_cast<StorageResource*>(my_config.GetNextRes(R_STORAGE, NULL));
+#endif
+
+ BareosResource* p = nullptr;
+ while ((p = my_config.GetNextRes(R_DEVICE, p)) != nullptr) {
+ DeviceResource* d = dynamic_cast<DeviceResource*>(p);
+ if (d) {
+ to_lower(d->device_type);
+ if (!ImplementationFactory<Device>::IsRegistered(d->device_type)) {
+#if defined(HAVE_DYNAMIC_SD_BACKENDS)
+ if (!storage_res || storage_res->backend_directories.empty()) {
+ Jmsg2(nullptr, M_ERROR_TERM, 0,
+ "Backend Directory not set. Cannot load dynamic backend %s\n",
+ d->device_type.c_str());
+ }
+ if (!LoadStorageBackend(d->device_type,
+ storage_res->backend_directories)) {
+ Jmsg2(nullptr, M_ERROR_TERM, 0,
+ "Could not load storage backend %s for device %s.\n",
+ d->device_type.c_str(), d->resource_name_);
+ }
+#else
+ Jmsg2(nullptr, M_ERROR_TERM, 0,
+ "Backend %s for device %s not available.\n",
+ d->device_type.c_str(), d->resource_name_);
+#endif
+ }
+ }
+ }
+}
+
static void ConfigReadyCallback(ConfigurationParser& my_config)
{
MultiplyConfiguredDevices(my_config);
+ GuessMissingDeviceTypes(my_config);
+ CheckAndLoadDeviceBackends(my_config);
CheckDropletDevices(my_config);
}
@@ -581,10 +614,6 @@ bool ParseSdConfig(const char* configfile, int exit_code)
configfile);
return retval;
}
-
-#if defined(HAVE_DYNAMIC_SD_BACKENDS)
- SetBackendDeviceDirectories(std::move(me->backend_directories));
-#endif
}
return retval;
diff --git a/core/src/stored/vol_mgr.cc b/core/src/stored/vol_mgr.cc
index b4eff74cc..0d4b69516 100644
--- a/core/src/stored/vol_mgr.cc
+++ b/core/src/stored/vol_mgr.cc
@@ -420,7 +420,7 @@ VolumeReservationItem* reserve_volume(DeviceControlRecord* dcr,
* accesses by multiple readers at once without disturbing each other.
*/
if (me->filedevice_concurrent_read && !dcr->IsWriting()
- && dcr->dev->IsFile()) {
+ && dcr->dev->CanReadConcurrently()) {
nvol->SetJobid(dcr->jcr->JobId);
nvol->SetReading();
vol = nvol;
@@ -761,7 +761,8 @@ bool FreeVolume(Device* dev)
* - Config option filedevice_concurrent_read is not on.
* - The device is not of type File.
*/
- if (vol->IsWriting() || !me->filedevice_concurrent_read || !dev->IsFile()) {
+ if (vol->IsWriting() || !me->filedevice_concurrent_read
+ || !dev->CanReadConcurrently()) {
vol_list->remove(vol);
}
Dmsg2(debuglevel, "=== remove volume %s dev=%s\n", vol->vol_name,
diff --git a/core/src/tests/CMakeLists.txt b/core/src/tests/CMakeLists.txt
index ccd063f8a..80b6f2836 100644
--- a/core/src/tests/CMakeLists.txt
+++ b/core/src/tests/CMakeLists.txt
@@ -249,7 +249,7 @@ if(NOT client-only)
)
bareos_add_test(sd_backend LINK_LIBRARIES ${LINK_LIBRARIES})
if(TARGET droplet)
- target_compile_definitions(sd_backend PRIVATE HAVE_DROPLET)
+ bareos_add_test(droplet_backend LINK_LIBRARIES ${LINK_LIBRARIES})
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS") # disable on solaris
set(disable "DISABLE")
diff --git a/core/src/tests/configs/bareos-configparser-tests/bareos-sd.d/device/FileStorage.conf b/core/src/tests/configs/bareos-configparser-tests/bareos-sd.d/device/FileStorage.conf
index 88c5391b4..d967bc4d6 100644
--- a/core/src/tests/configs/bareos-configparser-tests/bareos-sd.d/device/FileStorage.conf
+++ b/core/src/tests/configs/bareos-configparser-tests/bareos-sd.d/device/FileStorage.conf
@@ -2,6 +2,7 @@ Device {
Name = FileStorage
Media Type = File
Archive Device = /tmp/tests/backup-bareos-test/storage
+ Device Type = File
LabelMedia = yes; # lets Bareos label unlabeled media
Random Access = yes;
AutomaticMount = yes; # when device opened, read it
diff --git a/core/src/tests/configs/bareos-configparser-tests/bareos-sd.d/storage/bareos-sd.conf b/core/src/tests/configs/bareos-configparser-tests/bareos-sd.d/storage/bareos-sd.conf.in
index 9f4f96c31..c0174978b 100644
--- a/core/src/tests/configs/bareos-configparser-tests/bareos-sd.d/storage/bareos-sd.conf
+++ b/core/src/tests/configs/bareos-configparser-tests/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,6 @@ Storage {
# Plugin Names = ""
Working Directory = "/tmp/tests/backup-bareos-test/working"
SD Port = 42003
+
+ @UNCOMMENT_SD_BACKEND_DIRECTORY@Backend Directory = @PROJECT_BINARY_DIR@/src/stored/backends
}
diff --git a/core/src/tests/configs/sd_backend/bareos-sd.d/device/droplet.conf.in b/core/src/tests/configs/droplet_backend/bareos-sd.d/device/droplet.conf.in
index b93c0b119..9fb80a40c 100644
--- a/core/src/tests/configs/sd_backend/bareos-sd.d/device/droplet.conf.in
+++ b/core/src/tests/configs/droplet_backend/bareos-sd.d/device/droplet.conf.in
@@ -2,7 +2,7 @@ Device {
Name = droplet
Media Type = S3
Device Type = droplet
- Device Options = "profile=@CMAKE_CURRENT_SOURCE_DIR@/src/tests/configs/sd_backend/droplet.profile,bucket=bareos-test,chunksize=10M"
+ Device Options = "profile=@CMAKE_CURRENT_SOURCE_DIR@/src/tests/configs/droplet_backend/droplet.profile,bucket=bareos-test,chunksize=10M"
Maximum Concurrent Jobs = 1
Archive Device = "Cloud Storage"
LabelMedia = yes
diff --git a/core/src/tests/configs/droplet_backend/bareos-sd.d/storage/myself.conf.in b/core/src/tests/configs/droplet_backend/bareos-sd.d/storage/myself.conf.in
new file mode 100644
index 000000000..bc16b3bda
--- /dev/null
+++ b/core/src/tests/configs/droplet_backend/bareos-sd.d/storage/myself.conf.in
@@ -0,0 +1,5 @@
+Storage {
+ Name = test-sd
+ @UNCOMMENT_SD_BACKEND_DIRECTORY@Backend Directory = @PROJECT_BINARY_DIR@/src/stored/backends
+ Working Directory = @PROJECT_BINARY_DIR@/
+}
diff --git a/core/src/tests/configs/sd_backend/droplet.profile.in b/core/src/tests/configs/droplet_backend/droplet.profile.in
index 9d161c8cf..9d161c8cf 100644
--- a/core/src/tests/configs/sd_backend/droplet.profile.in
+++ b/core/src/tests/configs/droplet_backend/droplet.profile.in
diff --git a/core/src/tests/configs/sd_reservation/bareos-sd.d/device/auto1.conf b/core/src/tests/configs/sd_reservation/bareos-sd.d/device/auto1.conf
index 97a2b3d71..117532956 100644
--- a/core/src/tests/configs/sd_reservation/bareos-sd.d/device/auto1.conf
+++ b/core/src/tests/configs/sd_reservation/bareos-sd.d/device/auto1.conf
@@ -14,8 +14,9 @@ Device {
Device {
Name = auto1dev1
- Media Type = File
+ Media Type = NonMatchingMediaType
Archive Device = ./non-existent
+ Device Type = File
LabelMedia = yes
Random Access = yes
Autochanger = yes
diff --git a/core/src/tests/configs/sd_reservation/bareos-sd.d/device/auto2.conf b/core/src/tests/configs/sd_reservation/bareos-sd.d/device/auto2.conf
index d5a748805..ff6296683 100644
--- a/core/src/tests/configs/sd_reservation/bareos-sd.d/device/auto2.conf
+++ b/core/src/tests/configs/sd_reservation/bareos-sd.d/device/auto2.conf
@@ -1,6 +1,7 @@
Device {
Name = auto2dev0
Media Type = NotFile
+ Device Type = File
Archive Device = .
LabelMedia = yes
Random Access = yes
@@ -14,6 +15,7 @@ Device {
Device {
Name = auto2dev1
Media Type = NotFile
+ Device Type = File
Archive Device = ./non-existent
LabelMedia = yes
Random Access = yes
@@ -26,6 +28,7 @@ Device {
Device {
Name = auto2dev2
Media Type = NotFile
+ Device Type = File
Archive Device = .
LabelMedia = yes
Random Access = yes
@@ -38,6 +41,7 @@ Device {
Device {
Name = auto2dev3
Media Type = NotFile
+ Device Type = File
Archive Device = .
LabelMedia = yes
Random Access = yes
@@ -50,6 +54,7 @@ Device {
Device {
Name = auto2dev4
Media Type = NotFile
+ Device Type = File
Archive Device = .
LabelMedia = yes
Random Access = yes
diff --git a/core/src/tests/configs/sd_reservation/bareos-sd.d/device/single2.conf b/core/src/tests/configs/sd_reservation/bareos-sd.d/device/single2.conf
index eab446cc2..2ec9006a7 100644
--- a/core/src/tests/configs/sd_reservation/bareos-sd.d/device/single2.conf
+++ b/core/src/tests/configs/sd_reservation/bareos-sd.d/device/single2.conf
@@ -2,4 +2,5 @@ Device {
Name = single2
Media Type = NotFile
Archive Device = .
+ Device Type = tape
}
diff --git a/core/src/tests/configs/statistics_thread/sd_statistics_thread/default_config/bareos-sd.d/storage/myself.conf b/core/src/tests/configs/statistics_thread/sd_statistics_thread/default_config/bareos-sd.d/storage/myself.conf
deleted file mode 100644
index b791506cf..000000000
--- a/core/src/tests/configs/statistics_thread/sd_statistics_thread/default_config/bareos-sd.d/storage/myself.conf
+++ /dev/null
@@ -1,3 +0,0 @@
-Storage {
- Name = test-sd
-}
diff --git a/core/src/tests/configs/statistics_thread/sd_statistics_thread/default_config/bareos-sd.d/storage/myself.conf.in b/core/src/tests/configs/statistics_thread/sd_statistics_thread/default_config/bareos-sd.d/storage/myself.conf.in
new file mode 100644
index 000000000..394794a44
--- /dev/null
+++ b/core/src/tests/configs/statistics_thread/sd_statistics_thread/default_config/bareos-sd.d/storage/myself.conf.in
@@ -0,0 +1,4 @@
+Storage {
+ Name = test-sd
+ @UNCOMMENT_SD_BACKEND_DIRECTORY@Backend Directory = @PROJECT_BINARY_DIR@/src/stored/backends
+}
diff --git a/core/src/tests/configs/statistics_thread/sd_statistics_thread/only_collect_set/bareos-sd.d/storage/myself.conf b/core/src/tests/configs/statistics_thread/sd_statistics_thread/only_collect_set/bareos-sd.d/storage/myself.conf
deleted file mode 100644
index d952a4d5d..000000000
--- a/core/src/tests/configs/statistics_thread/sd_statistics_thread/only_collect_set/bareos-sd.d/storage/myself.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-Storage {
- Name = test-sd
- Collect Device Statistics = yes
-}
diff --git a/core/src/tests/configs/statistics_thread/sd_statistics_thread/only_collect_set/bareos-sd.d/storage/myself.conf.in b/core/src/tests/configs/statistics_thread/sd_statistics_thread/only_collect_set/bareos-sd.d/storage/myself.conf.in
new file mode 100644
index 000000000..5e5be67f4
--- /dev/null
+++ b/core/src/tests/configs/statistics_thread/sd_statistics_thread/only_collect_set/bareos-sd.d/storage/myself.conf.in
@@ -0,0 +1,5 @@
+Storage {
+ Name = test-sd
+ Collect Device Statistics = yes
+ @UNCOMMENT_SD_BACKEND_DIRECTORY@Backend Directory = @PROJECT_BINARY_DIR@/src/stored/backends
+}
diff --git a/core/src/tests/configs/statistics_thread/sd_statistics_thread/only_interval_set/bareos-sd.d/storage/myself.conf b/core/src/tests/configs/statistics_thread/sd_statistics_thread/only_interval_set/bareos-sd.d/storage/myself.conf
deleted file mode 100644
index 45e845000..000000000
--- a/core/src/tests/configs/statistics_thread/sd_statistics_thread/only_interval_set/bareos-sd.d/storage/myself.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-Storage {
- Name = test-sd
- Statistics Collect Interval = 150
-}
diff --git a/core/src/tests/configs/statistics_thread/sd_statistics_thread/only_interval_set/bareos-sd.d/storage/myself.conf.in b/core/src/tests/configs/statistics_thread/sd_statistics_thread/only_interval_set/bareos-sd.d/storage/myself.conf.in
new file mode 100644
index 000000000..db56afcad
--- /dev/null
+++ b/core/src/tests/configs/statistics_thread/sd_statistics_thread/only_interval_set/bareos-sd.d/storage/myself.conf.in
@@ -0,0 +1,5 @@
+Storage {
+ Name = test-sd
+ Statistics Collect Interval = 150
+ @UNCOMMENT_SD_BACKEND_DIRECTORY@Backend Directory = @PROJECT_BINARY_DIR@/src/stored/backends
+}
diff --git a/core/src/tests/configs/stored_multiplied_device/bareos-sd.d/device/FileStorage.conf b/core/src/tests/configs/stored_multiplied_device/bareos-sd.d/device/FileStorage.conf
index d05993e6c..41776e110 100644
--- a/core/src/tests/configs/stored_multiplied_device/bareos-sd.d/device/FileStorage.conf
+++ b/core/src/tests/configs/stored_multiplied_device/bareos-sd.d/device/FileStorage.conf
@@ -1,7 +1,8 @@
Device {
Name = MultipliedDeviceResource
Media Type = File
- Archive Device = /dev/null/
+ Archive Device = /dev/null
+ Device Type = File
LabelMedia = yes; # lets Bareos label unlabeled media
Random Access = yes;
AutomaticMount = yes; # when device opened, read it
@@ -14,7 +15,8 @@ Device {
Device {
Name = AnotherMultipliedDeviceResource
Media Type = File
- Archive Device = /dev/null/
+ Archive Device = /dev/null
+ Device Type = File
LabelMedia = yes; # lets Bareos label unlabeled media
Random Access = yes;
AutomaticMount = yes; # when device opened, read it
@@ -27,7 +29,8 @@ Device {
Device {
Name = JustADeviceResource
Media Type = File
- Archive Device = /dev/null/
+ Archive Device = /dev/null
+ Device Type = File
LabelMedia = yes; # lets Bareos label unlabeled media
Random Access = yes;
AutomaticMount = yes; # when device opened, read it
diff --git a/core/src/tests/configs/stored_multiplied_device/bareos-sd.d/storage/bareos-sd.conf b/core/src/tests/configs/stored_multiplied_device/bareos-sd.d/storage/bareos-sd.conf
deleted file mode 100644
index e73e2417f..000000000
--- a/core/src/tests/configs/stored_multiplied_device/bareos-sd.d/storage/bareos-sd.conf
+++ /dev/null
@@ -1,11 +0,0 @@
-Storage {
- Name = bareos-sd
- Maximum Concurrent Jobs = 20
-
- # remove comment from "Plugin Directory" to load plugins from specified directory.
- # if "Plugin Names" is defined, only the specified plugins will be loaded,
- # otherwise all storage plugins (*-sd.so) from the "Plugin Directory".
- #
- # Plugin Directory = "/dev/null"
- # Plugin Names = ""
-}
diff --git a/core/src/tests/configs/stored_multiplied_device/bareos-sd.d/storage/bareos-sd.conf.in b/core/src/tests/configs/stored_multiplied_device/bareos-sd.d/storage/bareos-sd.conf.in
new file mode 100644
index 000000000..ee02d180e
--- /dev/null
+++ b/core/src/tests/configs/stored_multiplied_device/bareos-sd.d/storage/bareos-sd.conf.in
@@ -0,0 +1,4 @@
+Storage {
+ Name = bareos-sd
+ @UNCOMMENT_SD_BACKEND_DIRECTORY@Backend Directory = @PROJECT_BINARY_DIR@/src/stored/backends
+}
diff --git a/core/src/tests/droplet_backend.cc b/core/src/tests/droplet_backend.cc
new file mode 100644
index 000000000..261e12a0d
--- /dev/null
+++ b/core/src/tests/droplet_backend.cc
@@ -0,0 +1,192 @@
+/*
+ BAREOSĀ® - Backup Archiving REcovery Open Sourced
+
+ Copyright (C) 2021-2022 Bareos GmbH & Co. KG
+
+ This program is Free Software; you can redistribute it and/or
+ modify it under the terms of version three of the GNU Affero General Public
+ License as published by the Free Software Foundation, which is
+ listed in the file LICENSE.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+*/
+
+#if defined(HAVE_MINGW)
+# include "include/bareos.h"
+# include "gtest/gtest.h"
+#else
+# include "gtest/gtest.h"
+# include "include/bareos.h"
+#endif
+
+
+#include <chrono>
+#include <future>
+
+#define STORAGE_DAEMON 1
+#include "include/jcr.h"
+#include "lib/crypto_cache.h"
+#include "lib/edit.h"
+#include "lib/parse_conf.h"
+#include "stored/butil.h"
+#include "stored/device_control_record.h"
+#include "stored/jcr_private.h"
+#include "stored/job.h"
+#include "stored/sd_plugins.h"
+#include "stored/sd_stats.h"
+#include "stored/stored.h"
+#include "stored/stored_globals.h"
+#include "stored/wait.h"
+#include "stored/sd_backends.h"
+
+#define CONFIG_SUBDIR "droplet_backend"
+#include "sd_backend_tests.h"
+
+using namespace storagedaemon;
+
+void droplet_write_reread_testdata(std::vector<std::vector<char>>& test_data)
+{
+ const char* name = "sd_backend_test";
+ const char* dev_name = "droplet";
+ const char* volname
+ = ::testing::UnitTest::GetInstance()->current_test_info()->name();
+
+ JobControlRecord* jcr = SetupDummyJcr(name, nullptr, nullptr);
+ ASSERT_TRUE(jcr);
+
+ DeviceResource* device_resource
+ = (DeviceResource*)my_config->GetResWithName(R_DEVICE, dev_name);
+
+ Device* dev = FactoryCreateDevice(jcr, device_resource);
+ ASSERT_TRUE(dev);
+
+ // write to device
+ {
+ dev->setVolCatName(volname);
+ auto fd = dev->d_open(volname, O_CREAT | O_RDWR | O_BINARY, 0640);
+ dev->d_truncate(
+ nullptr); // dcr parameter is unused, so nullptr should be fine
+
+ for (auto& buf : test_data) { dev->d_write(fd, buf.data(), buf.size()); }
+ dev->d_close(fd);
+ }
+
+ // read from device
+ {
+ dev->setVolCatName(volname);
+ auto fd = dev->d_open(volname, O_CREAT | O_RDWR | O_BINARY, 0640);
+
+ for (auto& buf : test_data) {
+ std::vector<char> tmp(buf.size());
+ dev->d_read(fd, tmp.data(), buf.size());
+ ASSERT_EQ(buf, tmp);
+ }
+ dev->d_close(fd);
+ }
+ delete dev;
+ FreeJcr(jcr);
+}
+
+// write-request writing 1 byte to this chunk and rest to next chunk
+TEST_F(sd, droplet_off_by_one_short)
+{
+ using namespace std::string_literals;
+ std::vector<std::vector<char>> test_data;
+
+ {
+ std::vector<char> tmp(1024 * 1024 - 1);
+ std::fill(tmp.begin(), tmp.end(), '0');
+ test_data.push_back(tmp);
+ }
+ for (char& c : "123456789abcdefghijklmnopqrstuvwxyz"s) {
+ std::vector<char> tmp(1024 * 1024);
+ std::fill(tmp.begin(), tmp.end(), c);
+ test_data.push_back(tmp);
+ }
+
+ droplet_write_reread_testdata(test_data);
+}
+
+// write-request crossing the chunk-border by exactly 1 byte
+TEST_F(sd, droplet_off_by_one_long)
+{
+ using namespace std::string_literals;
+ std::vector<std::vector<char>> test_data;
+
+ {
+ std::vector<char> tmp(1024 * 1024 + 1);
+ std::fill(tmp.begin(), tmp.end(), '0');
+ test_data.push_back(tmp);
+ }
+ for (char& c : "123456789abcdefghijklmnopqrstuvwxyz"s) {
+ std::vector<char> tmp(1024 * 1024);
+ std::fill(tmp.begin(), tmp.end(), c);
+ test_data.push_back(tmp);
+ }
+
+ droplet_write_reread_testdata(test_data);
+}
+
+// write-request hitting chunk-border exactly
+TEST_F(sd, droplet_aligned)
+{
+ using namespace std::string_literals;
+ std::vector<std::vector<char>> test_data;
+ for (char& c : "0123456789abcdefghijklmnopqrstuvwxyz"s) {
+ std::vector<char> tmp(1024 * 1024);
+ std::fill(tmp.begin(), tmp.end(), c);
+ test_data.push_back(tmp);
+ }
+
+ droplet_write_reread_testdata(test_data);
+}
+
+// write-request same size as chunk
+TEST_F(sd, droplet_fullchunk)
+{
+ using namespace std::string_literals;
+ std::vector<std::vector<char>> test_data;
+ for (char& c : "0123"s) {
+ std::vector<char> tmp(10 * 1024 * 1024);
+ std::fill(tmp.begin(), tmp.end(), c);
+ test_data.push_back(tmp);
+ }
+
+ droplet_write_reread_testdata(test_data);
+}
+
+// write-request larger than chunk
+TEST_F(sd, droplet_oversized_write)
+{
+ using namespace std::string_literals;
+ std::vector<std::vector<char>> test_data;
+ for (char& c : "0123"s) {
+ std::vector<char> tmp(11 * 1024 * 1024);
+ std::fill(tmp.begin(), tmp.end(), c);
+ test_data.push_back(tmp);
+ }
+
+ droplet_write_reread_testdata(test_data);
+}
+
+// write-request larger than two chunks
+TEST_F(sd, droplet_double_oversized_write)
+{
+ using namespace std::string_literals;
+ std::vector<std::vector<char>> test_data;
+ for (char& c : "0123"s) {
+ std::vector<char> tmp(21 * 1024 * 1024);
+ std::fill(tmp.begin(), tmp.end(), c);
+ test_data.push_back(tmp);
+ }
+
+ droplet_write_reread_testdata(test_data);
+}
diff --git a/core/src/tests/sd_backend.cc b/core/src/tests/sd_backend.cc
index 701382b04..89b6c6365 100644
--- a/core/src/tests/sd_backend.cc
+++ b/core/src/tests/sd_backend.cc
@@ -45,63 +45,13 @@
#include "stored/stored.h"
#include "stored/stored_globals.h"
#include "stored/wait.h"
-#if defined(HAVE_DYNAMIC_SD_BACKENDS)
-# include "stored/sd_backends.h"
-#endif
-
-using namespace storagedaemon;
-
-namespace storagedaemon {
-/* import this to parse the config */
-extern bool ParseSdConfig(const char* configfile, int exit_code);
-} // namespace storagedaemon
-
-class sd : public ::testing::Test {
- protected:
- void SetUp() override;
- void TearDown() override;
-};
+#include "stored/sd_backends.h"
-void sd::SetUp()
-{
- OSDependentInit();
-
- debug_level = 900;
+#define CONFIG_SUBDIR "sd_backend"
+#include "sd_backend_tests.h"
- /* configfile is a global char* from stored_globals.h */
- configfile = strdup(RELATIVE_PROJECT_SOURCE_DIR "/configs/sd_backend/");
- my_config = InitSdConfig(configfile, M_ERROR_TERM);
- ParseSdConfig(configfile, M_ERROR_TERM);
- /*
- * we do not run CheckResources() here, so take care the test configration
- * is not broken. Also autochangers will not work.
- */
-}
-void sd::TearDown()
-{
- Dmsg0(100, "TearDown start\n");
-
- {
- DeviceResource* d = nullptr;
- foreach_res (d, R_DEVICE) {
- Dmsg1(10, "Term device %s (%s)\n", d->resource_name_,
- d->archive_device_string);
- if (d->dev) {
- d->dev->ClearVolhdr();
- delete d->dev;
- d->dev = nullptr;
- }
- }
- }
-#if defined(HAVE_DYNAMIC_SD_BACKENDS)
- FlushAndCloseBackendDevices();
-#endif
+using namespace storagedaemon;
- if (configfile) { free(configfile); }
- if (my_config) { delete my_config; }
-
- TermReservationsLock();
-}
// Test that load and unloads a tape device.
TEST_F(sd, backend_load_unload)
@@ -140,178 +90,3 @@ TEST_F(sd, backend_load_unload)
Dmsg0(100, "cleanup\n");
FreeJcr(jcr);
}
-
-void droplet_write_reread_testdata(std::vector<std::vector<char>>& test_data)
-{
- const char* name = "sd_backend_test";
- const char* dev_name = "droplet";
- const char* volname
- = ::testing::UnitTest::GetInstance()->current_test_info()->name();
-
- JobControlRecord* jcr = SetupDummyJcr(name, nullptr, nullptr);
- ASSERT_TRUE(jcr);
-
- DeviceResource* device_resource
- = (DeviceResource*)my_config->GetResWithName(R_DEVICE, dev_name);
-
- Device* dev = FactoryCreateDevice(jcr, device_resource);
- ASSERT_TRUE(dev);
-
- // write to device
- {
- dev->setVolCatName(volname);
- auto fd = dev->d_open(volname, O_CREAT | O_RDWR | O_BINARY, 0640);
- dev->d_truncate(
- nullptr); // dcr parameter is unused, so nullptr should be fine
-
- for (auto& buf : test_data) { dev->d_write(fd, buf.data(), buf.size()); }
- dev->d_close(fd);
- }
-
- // read from device
- {
- dev->setVolCatName(volname);
- auto fd = dev->d_open(volname, O_CREAT | O_RDWR | O_BINARY, 0640);
-
- for (auto& buf : test_data) {
- std::vector<char> tmp(buf.size());
- dev->d_read(fd, tmp.data(), buf.size());
- ASSERT_EQ(buf, tmp);
- }
- dev->d_close(fd);
- }
- delete dev;
- FreeJcr(jcr);
-}
-
-// write-request writing 1 byte to this chunk and rest to next chunk
-TEST_F(sd, droplet_off_by_one_short)
-{
-#if !defined HAVE_DROPLET
- std::cerr << "\nThis test requires droplet backend, which has not been "
- "built. Skipping.\n";
- exit(77);
-#else
- using namespace std::string_literals;
- std::vector<std::vector<char>> test_data;
-
- {
- std::vector<char> tmp(1024 * 1024 - 1);
- std::fill(tmp.begin(), tmp.end(), '0');
- test_data.push_back(tmp);
- }
- for (char& c : "123456789abcdefghijklmnopqrstuvwxyz"s) {
- std::vector<char> tmp(1024 * 1024);
- std::fill(tmp.begin(), tmp.end(), c);
- test_data.push_back(tmp);
- }
-
- droplet_write_reread_testdata(test_data);
-#endif
-}
-
-// write-request crossing the chunk-border by exactly 1 byte
-TEST_F(sd, droplet_off_by_one_long)
-{
-#if !defined HAVE_DROPLET
- std::cerr << "\nThis test requires droplet backend, which has not been "
- "built. Skipping.\n";
- exit(77);
-#else
- using namespace std::string_literals;
- std::vector<std::vector<char>> test_data;
-
- {
- std::vector<char> tmp(1024 * 1024 + 1);
- std::fill(tmp.begin(), tmp.end(), '0');
- test_data.push_back(tmp);
- }
- for (char& c : "123456789abcdefghijklmnopqrstuvwxyz"s) {
- std::vector<char> tmp(1024 * 1024);
- std::fill(tmp.begin(), tmp.end(), c);
- test_data.push_back(tmp);
- }
-
- droplet_write_reread_testdata(test_data);
-#endif
-}
-
-// write-request hitting chunk-border exactly
-TEST_F(sd, droplet_aligned)
-{
-#if !defined HAVE_DROPLET
- std::cerr << "\nThis test requires droplet backend, which has not been "
- "built. Skipping.\n";
- exit(77);
-#else
- using namespace std::string_literals;
- std::vector<std::vector<char>> test_data;
- for (char& c : "0123456789abcdefghijklmnopqrstuvwxyz"s) {
- std::vector<char> tmp(1024 * 1024);
- std::fill(tmp.begin(), tmp.end(), c);
- test_data.push_back(tmp);
- }
-
- droplet_write_reread_testdata(test_data);
-#endif
-}
-
-// write-request same size as chunk
-TEST_F(sd, droplet_fullchunk)
-{
-#if !defined HAVE_DROPLET
- std::cerr << "\nThis test requires droplet backend, which has not been "
- "built. Skipping.\n";
- exit(77);
-#else
- using namespace std::string_literals;
- std::vector<std::vector<char>> test_data;
- for (char& c : "0123"s) {
- std::vector<char> tmp(10 * 1024 * 1024);
- std::fill(tmp.begin(), tmp.end(), c);
- test_data.push_back(tmp);
- }
-
- droplet_write_reread_testdata(test_data);
-#endif
-}
-
-// write-request larger than chunk
-TEST_F(sd, droplet_oversized_write)
-{
-#if !defined HAVE_DROPLET
- std::cerr << "\nThis test requires droplet backend, which has not been "
- "built. Skipping.\n";
- exit(77);
-#else
- using namespace std::string_literals;
- std::vector<std::vector<char>> test_data;
- for (char& c : "0123"s) {
- std::vector<char> tmp(11 * 1024 * 1024);
- std::fill(tmp.begin(), tmp.end(), c);
- test_data.push_back(tmp);
- }
-
- droplet_write_reread_testdata(test_data);
-#endif
-}
-
-// write-request larger than two chunks
-TEST_F(sd, droplet_double_oversized_write)
-{
-#if !defined HAVE_DROPLET
- std::cerr << "\nThis test requires droplet backend, which has not been "
- "built. Skipping.\n";
- exit(77);
-#else
- using namespace std::string_literals;
- std::vector<std::vector<char>> test_data;
- for (char& c : "0123"s) {
- std::vector<char> tmp(21 * 1024 * 1024);
- std::fill(tmp.begin(), tmp.end(), c);
- test_data.push_back(tmp);
- }
-
- droplet_write_reread_testdata(test_data);
-#endif
-}
diff --git a/core/src/tests/sd_backend_tests.h b/core/src/tests/sd_backend_tests.h
new file mode 100644
index 000000000..c47fe75f7
--- /dev/null
+++ b/core/src/tests/sd_backend_tests.h
@@ -0,0 +1,75 @@
+/*
+ BAREOSĀ® - Backup Archiving REcovery Open Sourced
+
+ Copyright (C) 2022-2022 Bareos GmbH & Co. KG
+
+ This program is Free Software; you can redistribute it and/or
+ modify it under the terms of version three of the GNU Affero General Public
+ License as published by the Free Software Foundation and included
+ in the file LICENSE.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+*/
+
+#ifndef BAREOS_TESTS_SD_BACKEND_TESTS_H_
+#define BAREOS_TESTS_SD_BACKEND_TESTS_H_
+namespace storagedaemon {
+/* import this to parse the config */
+extern bool ParseSdConfig(const char* configfile, int exit_code);
+} // namespace storagedaemon
+
+class sd : public ::testing::Test {
+ protected:
+ void SetUp() override;
+ void TearDown() override;
+};
+
+void sd::SetUp()
+{
+ using namespace storagedaemon;
+ OSDependentInit();
+
+ debug_level = 900;
+
+ /* configfile is a global char* from stored_globals.h */
+ configfile
+ = strdup(RELATIVE_PROJECT_SOURCE_DIR "/configs/" CONFIG_SUBDIR "/");
+ my_config = InitSdConfig(configfile, M_ERROR_TERM);
+ ParseSdConfig(configfile, M_ERROR_TERM);
+ /*
+ * we do not run CheckResources() here, so take care the test configration
+ * is not broken. Also autochangers will not work.
+ */
+}
+void sd::TearDown()
+{
+ using namespace storagedaemon;
+ Dmsg0(100, "TearDown start\n");
+
+ {
+ DeviceResource* d = nullptr;
+ foreach_res (d, R_DEVICE) {
+ Dmsg1(10, "Term device %s (%s)\n", d->resource_name_,
+ d->archive_device_string);
+ if (d->dev) {
+ d->dev->ClearVolhdr();
+ delete d->dev;
+ d->dev = nullptr;
+ }
+ }
+ }
+
+ if (configfile) { free(configfile); }
+ if (my_config) { delete my_config; }
+
+ TermReservationsLock();
+}
+#endif // BAREOS_TESTS_SD_BACKEND_TESTS_H_
diff --git a/core/src/tests/sd_reservation.cc b/core/src/tests/sd_reservation.cc
index 1e651106c..748dc8886 100644
--- a/core/src/tests/sd_reservation.cc
+++ b/core/src/tests/sd_reservation.cc
@@ -47,9 +47,7 @@
#include "stored/stored.h"
#include "stored/stored_globals.h"
#include "stored/wait.h"
-#if defined(HAVE_DYNAMIC_SD_BACKENDS)
-# include "stored/sd_backends.h"
-#endif
+#include "stored/sd_backends.h"
#include "bsock_mock.h"
@@ -99,9 +97,6 @@ void ReservationTest::TearDown()
}
}
}
-#if defined(HAVE_DYNAMIC_SD_BACKENDS)
- FlushAndCloseBackendDevices();
-#endif
if (configfile) { free(configfile); }
if (my_config) { delete my_config; }
diff --git a/core/src/vmware/CMakeLists.txt b/core/src/vmware/CMakeLists.txt
index 43ac195b9..407d69d16 100644
--- a/core/src/vmware/CMakeLists.txt
+++ b/core/src/vmware/CMakeLists.txt
@@ -1,7 +1,7 @@
#
# BAREOS - Backup Archiving REcovery Open Sourced
#
-# Copyright (C) 2017-2020 Bareos GmbH & Co. KG
+# Copyright (C) 2017-2022 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
@@ -19,6 +19,5 @@
# 02110-1301, USA.
message("Entering ${CMAKE_CURRENT_SOURCE_DIR}")
-cmake_minimum_required(VERSION 3.0)
add_subdirectory(vadp_dumper)
add_subdirectory(vmware_cbt_tool)
diff --git a/debian/bareos-storage-droplet.install.in b/debian/bareos-storage-droplet.install.in
index 84010ec30..1be86d8e8 100644
--- a/debian/bareos-storage-droplet.install.in
+++ b/debian/bareos-storage-droplet.install.in
@@ -1,5 +1,3 @@
-@libdir@/libbareosdroplet.so*
-@backenddir@/libbareossd-chunked.so*
@backenddir@/libbareossd-droplet.so*
@configtemplatedir@/bareos-dir.d/storage/S3_Object.conf.example
@configtemplatedir@/bareos-sd.d/device/S3_ObjectStorage.conf.example
diff --git a/debian/bareos-storage-tape.install.in b/debian/bareos-storage-tape.install.in
index cfa0d5e74..8f505071e 100644
--- a/debian/bareos-storage-tape.install.in
+++ b/debian/bareos-storage-tape.install.in
@@ -2,7 +2,6 @@
@configtemplatedir@/bareos-dir.d/storage/Tape.conf.example
@configtemplatedir@/bareos-sd.d/autochanger/autochanger-0.conf.example
@configtemplatedir@/bareos-sd.d/device/tapedrive-0.conf.example
-@backenddir@/libbareossd-gentape.so*
@backenddir@/libbareossd-tape.so*
@plugindir@/scsicrypto-sd.so
@plugindir@/scsitapealert-sd.so
diff --git a/debian/bareos-storage.install.in b/debian/bareos-storage.install.in
index 101deba2d..de1fa14d6 100644
--- a/debian/bareos-storage.install.in
+++ b/debian/bareos-storage.install.in
@@ -1,4 +1,5 @@
@plugindir@/autoxflate-sd.so
+@backenddir@/libbareossd-file.so*
@scriptdir@/disk-changer
@configtemplatedir@/bareos-sd.d/device/FileStorage.conf
@configtemplatedir@/bareos-sd.d/director/bareos-dir.conf
diff --git a/debian/control b/debian/control
index dc19efc08..fd2ea6e7a 100644
--- a/debian/control
+++ b/debian/control
@@ -21,7 +21,7 @@ Build-Depends: acl-dev,
apache2 | httpd,
bc,
chrpath,
- cmake (>= 3.12.0) | cmake-mozilla,
+ cmake (>= 3.17.0) | cmake-mozilla,
debhelper (>= 7.0.50~),
dpkg-dev (>= 1.13.19),
libacl1-dev,
diff --git a/debian/control.src b/debian/control.src
index 08f9b0d17..52e39a910 100644
--- a/debian/control.src
+++ b/debian/control.src
@@ -13,7 +13,7 @@ Build-Depends: acl-dev,
apache2 | httpd,
bc,
chrpath,
- cmake (>= 3.12.0) | cmake-mozilla,
+ cmake (>= 3.17.0) | cmake-mozilla,
debhelper (>= 7.0.50~),
dpkg-dev (>= 1.13.19),
libacl1-dev,
diff --git a/docs/manuals/CMakeLists.txt b/docs/manuals/CMakeLists.txt
index b36ef6c65..ae48cec74 100644
--- a/docs/manuals/CMakeLists.txt
+++ b/docs/manuals/CMakeLists.txt
@@ -17,8 +17,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
-cmake_minimum_required(VERSION 3.0)
-
project(bareos-docs NONE)
set_directory_properties(PROPERTIES CLEAN_NO_CUSTOM 1)
diff --git a/docs/manuals/source/include/autogenerated/bareos-dir-config-schema.json b/docs/manuals/source/include/autogenerated/bareos-dir-config-schema.json
index 9e408c4d3..66cccf090 100644
--- a/docs/manuals/source/include/autogenerated/bareos-dir-config-schema.json
+++ b/docs/manuals/source/include/autogenerated/bareos-dir-config-schema.json
@@ -3393,10 +3393,6 @@
"number": 91,
"description": "Meta tag"
},
- "DEVICE_TYPE": {
- "number": 201,
- "description": "Device Type"
- },
"MAX_BLOCKSIZE": {
"number": 202,
"description": "Maximum Blocksize"
diff --git a/docs/manuals/source/include/autogenerated/bareos-sd-config-schema.json b/docs/manuals/source/include/autogenerated/bareos-sd-config-schema.json
index 41d3c8208..0275769df 100644
--- a/docs/manuals/source/include/autogenerated/bareos-sd-config-schema.json
+++ b/docs/manuals/source/include/autogenerated/bareos-sd-config-schema.json
@@ -505,8 +505,9 @@
"required": true
},
"DeviceType": {
- "datatype": "DEVICE_TYPE",
+ "datatype": "STRING",
"code": 0,
+ "default_value": "",
"equals": true
},
"ArchiveDevice": {
diff --git a/get_version.cmake b/get_version.cmake
index dc6bc98a4..3111fc751 100644
--- a/get_version.cmake
+++ b/get_version.cmake
@@ -1,6 +1,6 @@
# BAREOSĀ® - Backup Archiving REcovery Open Sourced
#
-# Copyright (C) 2019-2019 Bareos GmbH & Co. KG
+# Copyright (C) 2019-2022 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or modify it under
# the terms of version three of the GNU Affero General Public License as
@@ -15,7 +15,8 @@
# with this program; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-cmake_minimum_required(VERSION 3.0)
+cmake_minimum_required(VERSION 3.17)
+cmake_policy(VERSION 3.17...3.19)
if(NOT DEFINED VERSION_STRING)
set(CMAKE_MODULE_PATH
diff --git a/systemtests/CMakeLists.txt b/systemtests/CMakeLists.txt
index e49b7dff0..58d334fd1 100644
--- a/systemtests/CMakeLists.txt
+++ b/systemtests/CMakeLists.txt
@@ -19,7 +19,6 @@
message("Entering ${CMAKE_CURRENT_SOURCE_DIR}")
-cmake_minimum_required(VERSION 3.3)
project(bareos-systemtests)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
diff --git a/systemtests/cmake/BareosSystemtestFunctions.cmake b/systemtests/cmake/BareosSystemtestFunctions.cmake
index 05862ff67..f7f6d93cb 100644
--- a/systemtests/cmake/BareosSystemtestFunctions.cmake
+++ b/systemtests/cmake/BareosSystemtestFunctions.cmake
@@ -17,10 +17,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
-cmake_policy(SET CMP0057 NEW) # IF(.. IN_LIST ..)
-cmake_policy(SET CMP0053 NEW)
-cmake_policy(SET CMP0064 NEW) # IF(TEST ...)
-
macro(create_systemtests_directory)
configurefilestosystemtest("systemtests" "data" "*.tgz" COPYONLY "")
configurefilestosystemtest("systemtests" "data" "*.gz" COPYONLY "")
@@ -347,6 +343,14 @@ macro(prepare_testdir_for_daemon_run)
set(backenddir ${BACKEND_DIR_TO_TEST})
set(sd_backenddir ${SD_BACKEND_DIR_TO_TEST})
+ # the SD will not suppot the BackendDirectory setting if it was not built with
+ # HAVE_DYNAMIC_SD_BACKENDS, thus we declare `sd_backend_config` that will
+ # evaluate to nothing if we don't have dynamic backends enabled.
+ if(HAVE_DYNAMIC_SD_BACKENDS)
+ set(sd_backend_config "BackendDirectory = \"${SD_BACKEND_DIR_TO_TEST}\"")
+ else()
+ set(sd_backend_config "")
+ endif()
set(BAREOS_WEBUI_PUBLIC_DIR ${WEBUI_PUBLIC_DIR_TO_TEST})
set(dbHost ${current_test_directory}/tmp)
diff --git a/systemtests/scripts/functions b/systemtests/scripts/functions
index 413684176..051035f2b 100644
--- a/systemtests/scripts/functions
+++ b/systemtests/scripts/functions
@@ -411,16 +411,19 @@ check_duration_lt()
}
start_dir() {
+ "${BAREOS_DIRECTOR_BINARY}" -c "${BAREOS_CONFIG_DIR}" -t </dev/null
"${BAREOS_DIRECTOR_BINARY}" -c "${BAREOS_CONFIG_DIR}" -f </dev/null &
dir_pid=$!
}
start_fd() {
+ "${BAREOS_FILEDAEMON_BINARY}" -c "${BAREOS_CONFIG_DIR}" -t </dev/null
"${BAREOS_FILEDAEMON_BINARY}" -c "${BAREOS_CONFIG_DIR}" -f </dev/null &
fd_pid=$!
}
start_sd() {
+ "${BAREOS_STORAGEDAEMON_BINARY}" -c "${BAREOS_CONFIG_DIR}" -t </dev/null
"${BAREOS_STORAGEDAEMON_BINARY}" -c "${BAREOS_CONFIG_DIR}" -f </dev/null &
sd_pid=$!
}
diff --git a/systemtests/scripts/start_bareos.sh b/systemtests/scripts/start_bareos.sh
index d04454a04..73b70c7ef 100755
--- a/systemtests/scripts/start_bareos.sh
+++ b/systemtests/scripts/start_bareos.sh
@@ -2,7 +2,7 @@
# BAREOSĀ® - Backup Archiving REcovery Open Sourced
#
-# Copyright (C) 2021-2021 Bareos GmbH & Co. KG
+# Copyright (C) 2021-2022 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
@@ -32,6 +32,7 @@ set -u
"${rscripts}"/setup
bin/bareos start
+bin/bareos status
# make sure, director is up and running.
print_debug "$(bin/bconsole <<< "status dir")"
diff --git a/systemtests/tests/acl/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/acl/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c10462de6..14e2fd4eb 100644
--- a/systemtests/tests/acl/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/acl/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/always-incremental-consolidate/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/always-incremental-consolidate/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c10462de6..14e2fd4eb 100644
--- a/systemtests/tests/always-incremental-consolidate/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/always-incremental-consolidate/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/autochanger/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/autochanger/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index 45c1fa0cf..14e2fd4eb 100644
--- a/systemtests/tests/autochanger/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/autochanger/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,5 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
- BackendDirectory = @sd_backenddir@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/autochanger/test-setup b/systemtests/tests/autochanger/test-setup
index bc74d296a..5d4579396 100755
--- a/systemtests/tests/autochanger/test-setup
+++ b/systemtests/tests/autochanger/test-setup
@@ -48,6 +48,7 @@ fi
setup_data
bin/bareos start
+bin/bareos status
# make sure, director is up and running.
print_debug "$(bin/bconsole <<< "status dir")"
diff --git a/systemtests/tests/bareos-acl/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/bareos-acl/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c10462de6..14e2fd4eb 100644
--- a/systemtests/tests/bareos-acl/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/bareos-acl/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/bareos/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/bareos/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index 5dc406dca..ed2f80e4c 100644
--- a/systemtests/tests/bareos/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/bareos/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,6 @@ Storage {
Plugin Names = "autoxflate"
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
+ ## @sd_backend_config@ ##
}
diff --git a/systemtests/tests/bareos/test-setup b/systemtests/tests/bareos/test-setup
index 3b467ba11..824c7a1cc 100755
--- a/systemtests/tests/bareos/test-setup
+++ b/systemtests/tests/bareos/test-setup
@@ -2,7 +2,7 @@
# BAREOSĀ® - Backup Archiving REcovery Open Sourced
#
-# Copyright (C) 2021-2021 Bareos GmbH & Co. KG
+# Copyright (C) 2021-2022 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
@@ -35,6 +35,7 @@ set -u
setup_data
bin/bareos start
+bin/bareos status
# make sure, director is up and running.
print_debug "$(bin/bconsole <<< "status dir")"
diff --git a/systemtests/tests/bconsole/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/bconsole/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c10462de6..14e2fd4eb 100644
--- a/systemtests/tests/bconsole/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/bconsole/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/bconsole/etc/bareos/bconsole.conf.in b/systemtests/tests/bconsole/etc/bareos/bconsole.conf.in
index 50b647c1d..df3050688 100644
--- a/systemtests/tests/bconsole/etc/bareos/bconsole.conf.in
+++ b/systemtests/tests/bconsole/etc/bareos/bconsole.conf.in
@@ -1,7 +1,6 @@
#
# Bareos User Agent (or Console) Configuration File
#
-
Director {
Name = @basename@-dir
DIRport = @dir_port@
diff --git a/systemtests/tests/block-size/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/block-size/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index 45c1fa0cf..14e2fd4eb 100644
--- a/systemtests/tests/block-size/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/block-size/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,5 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
- BackendDirectory = @sd_backenddir@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/bscan-bextract-bls-bcopy/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/bscan-bextract-bls-bcopy/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c10462de6..14e2fd4eb 100644
--- a/systemtests/tests/bscan-bextract-bls-bcopy/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/bscan-bextract-bls-bcopy/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/checkpoints/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/checkpoints/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index 92656f4b5..f0d7f842d 100644
--- a/systemtests/tests/checkpoints/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/checkpoints/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -8,5 +8,6 @@ Storage {
#
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
Checkpoint Interval = 3
}
diff --git a/systemtests/tests/checkpoints/test-setup b/systemtests/tests/checkpoints/test-setup
index 9f7be3d9b..c48c83ec8 100755
--- a/systemtests/tests/checkpoints/test-setup
+++ b/systemtests/tests/checkpoints/test-setup
@@ -35,6 +35,7 @@ set -u
setup_data
bin/bareos start
+bin/bareos status
# make sure, director is up and running.
print_debug "$(bin/bconsole <<< "status dir")"
diff --git a/systemtests/tests/checkpoints/testrunner-checkpoints-on-stop b/systemtests/tests/checkpoints/testrunner-checkpoints-on-stop
index 96177339d..55c6fbe8f 100755
--- a/systemtests/tests/checkpoints/testrunner-checkpoints-on-stop
+++ b/systemtests/tests/checkpoints/testrunner-checkpoints-on-stop
@@ -63,6 +63,7 @@ fi
bin/bareos stop
bin/bareos start
+bin/bareos status
slowjobid=$(grep 'Job queued. JobId=' "$backup_log" | sed -n -e 's/^.*JobId=//p')
diff --git a/systemtests/tests/chflags/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/chflags/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c10462de6..14e2fd4eb 100644
--- a/systemtests/tests/chflags/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/chflags/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/client-initiated/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/client-initiated/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c10462de6..14e2fd4eb 100644
--- a/systemtests/tests/client-initiated/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/client-initiated/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/commandline-options/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/commandline-options/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index d555776e0..e8518885b 100644
--- a/systemtests/tests/commandline-options/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/commandline-options/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -8,4 +8,5 @@ Storage {
#
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/config-syntax-crash/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/config-syntax-crash/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c10462de6..14e2fd4eb 100644
--- a/systemtests/tests/config-syntax-crash/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/config-syntax-crash/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/copy-archive-job/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/copy-archive-job/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index 622a6d444..ed481dae4 100644
--- a/systemtests/tests/copy-archive-job/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/copy-archive-job/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/copy-migrate/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/copy-migrate/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c10462de6..14e2fd4eb 100644
--- a/systemtests/tests/copy-migrate/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/copy-migrate/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/copy-remote-bscan/etc/bareos-remote/bareos-sd.d/device/FileStorage.conf b/systemtests/tests/copy-remote-bscan/etc/bareos-remote/bareos-sd.d/device/FileStorage.conf
index 41d7a2ea8..c78922256 100644
--- a/systemtests/tests/copy-remote-bscan/etc/bareos-remote/bareos-sd.d/device/FileStorage.conf
+++ b/systemtests/tests/copy-remote-bscan/etc/bareos-remote/bareos-sd.d/device/FileStorage.conf
@@ -2,6 +2,7 @@ Device {
Name = RemoteFileStorage
Media Type = File
Archive Device = storage-remote
+ Device Type = File
LabelMedia = yes; # lets Bareos label unlabeled media
Random Access = yes;
AutomaticMount = yes; # when device opened, read it
@@ -13,6 +14,7 @@ Device {
Name = RemoteFileStorage2
Media Type = File
Archive Device = storage2-remote
+ Device Type = File
LabelMedia = yes; # lets Bareos label unlabeled media
Random Access = yes;
AutomaticMount = yes; # when device opened, read it
diff --git a/systemtests/tests/copy-remote-bscan/etc/bareos-remote/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/copy-remote-bscan/etc/bareos-remote/bareos-sd.d/storage/bareos-sd.conf.in
index 2fb2d6411..a16df7669 100644
--- a/systemtests/tests/copy-remote-bscan/etc/bareos-remote/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/copy-remote-bscan/etc/bareos-remote/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd2_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/copy-remote-bscan/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/copy-remote-bscan/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c10462de6..14e2fd4eb 100644
--- a/systemtests/tests/copy-remote-bscan/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/copy-remote-bscan/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/dbcopy-mysql-postgresql/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/dbcopy-mysql-postgresql/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c10462de6..14e2fd4eb 100644
--- a/systemtests/tests/dbcopy-mysql-postgresql/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/dbcopy-mysql-postgresql/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/deprecation/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/deprecation/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c10462de6..14e2fd4eb 100644
--- a/systemtests/tests/deprecation/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/deprecation/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/droplet-s3/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/droplet-s3/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c2d9bfadd..14e2fd4eb 100644
--- a/systemtests/tests/droplet-s3/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/droplet-s3/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -8,7 +8,7 @@ Storage {
#
# Plugin Directory = "@python_plugin_module_src_sd@"
# Plugin Names = ""
- BackendDirectory = "@sd_backenddir@"
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/encrypt-signature-no-tls/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/encrypt-signature-no-tls/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c10462de6..14e2fd4eb 100644
--- a/systemtests/tests/encrypt-signature-no-tls/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/encrypt-signature-no-tls/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/encrypt-signature-tls-cert/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/encrypt-signature-tls-cert/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c03e379d5..d4a918273 100644
--- a/systemtests/tests/encrypt-signature-tls-cert/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/encrypt-signature-tls-cert/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,6 +10,7 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
TLS Enable = yes
TLS Require = yes
diff --git a/systemtests/tests/fileset-multiple-blocks/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/fileset-multiple-blocks/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c10462de6..14e2fd4eb 100644
--- a/systemtests/tests/fileset-multiple-blocks/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/fileset-multiple-blocks/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/filesets/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/filesets/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c10462de6..14e2fd4eb 100644
--- a/systemtests/tests/filesets/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/filesets/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/gfapi-fd/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/gfapi-fd/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c10462de6..14e2fd4eb 100644
--- a/systemtests/tests/gfapi-fd/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/gfapi-fd/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/glusterfs-backend/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/glusterfs-backend/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index ee35c51d6..14e2fd4eb 100644
--- a/systemtests/tests/glusterfs-backend/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/glusterfs-backend/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -9,6 +9,6 @@ Storage {
# Plugin Directory = "@python_plugin_module_src_sd@"
# Plugin Names = ""
Working Directory = "@working_dir@"
- Backend Directory = "@sd_backenddir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/list-backups/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/list-backups/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c10462de6..14e2fd4eb 100644
--- a/systemtests/tests/list-backups/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/list-backups/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/multiplied-device/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/multiplied-device/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c10462de6..14e2fd4eb 100644
--- a/systemtests/tests/multiplied-device/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/multiplied-device/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/ndmp/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/ndmp/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index 373a13239..ed3478721 100644
--- a/systemtests/tests/ndmp/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/ndmp/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -8,4 +8,5 @@ Storage {
Plugin Names = "autoxflate"
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/notls/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/notls/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c10462de6..14e2fd4eb 100644
--- a/systemtests/tests/notls/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/notls/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/parallel-jobs/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/parallel-jobs/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index d555776e0..e8518885b 100644
--- a/systemtests/tests/parallel-jobs/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/parallel-jobs/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -8,4 +8,5 @@ Storage {
#
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/parallel-jobs/test-setup b/systemtests/tests/parallel-jobs/test-setup
index 9f7be3d9b..c48c83ec8 100755
--- a/systemtests/tests/parallel-jobs/test-setup
+++ b/systemtests/tests/parallel-jobs/test-setup
@@ -35,6 +35,7 @@ set -u
setup_data
bin/bareos start
+bin/bareos status
# make sure, director is up and running.
print_debug "$(bin/bconsole <<< "status dir")"
diff --git a/systemtests/tests/passive/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/passive/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c10462de6..14e2fd4eb 100644
--- a/systemtests/tests/passive/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/passive/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/pruning/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/pruning/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c10462de6..14e2fd4eb 100644
--- a/systemtests/tests/pruning/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/pruning/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/py2plug-dir/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/py2plug-dir/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index de00c2e35..763fcad3c 100644
--- a/systemtests/tests/py2plug-dir/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/py2plug-dir/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/py2plug-dir/lsan-suppressions.txt b/systemtests/tests/py2plug-dir/lsan-suppressions.txt
new file mode 100644
index 000000000..a58a0cab0
--- /dev/null
+++ b/systemtests/tests/py2plug-dir/lsan-suppressions.txt
@@ -0,0 +1 @@
+leak:libpython*
diff --git a/systemtests/tests/py2plug-dir/testrunner b/systemtests/tests/py2plug-dir/testrunner
index 323a5fe06..e0f985950 100755
--- a/systemtests/tests/py2plug-dir/testrunner
+++ b/systemtests/tests/py2plug-dir/testrunner
@@ -19,6 +19,9 @@ export TestName
#shellcheck source=../environment.in
. ./environment
+LSAN_OPTIONS=suppressions="$(pwd)/lsan-suppressions.txt"
+export LSAN_OPTIONS
+
#shellcheck source=../scripts/functions
. "${rscripts}"/functions
"${rscripts}"/cleanup
diff --git a/systemtests/tests/py2plug-fd-contrib-bareos_tasks_mysql/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/py2plug-fd-contrib-bareos_tasks_mysql/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c10462de6..14e2fd4eb 100644
--- a/systemtests/tests/py2plug-fd-contrib-bareos_tasks_mysql/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/py2plug-fd-contrib-bareos_tasks_mysql/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/py2plug-fd-ldap/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/py2plug-fd-ldap/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c10462de6..14e2fd4eb 100644
--- a/systemtests/tests/py2plug-fd-ldap/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/py2plug-fd-ldap/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/py2plug-fd-libcloud/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/py2plug-fd-libcloud/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c10462de6..14e2fd4eb 100644
--- a/systemtests/tests/py2plug-fd-libcloud/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/py2plug-fd-libcloud/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/py2plug-fd-local-fileset-basic/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/py2plug-fd-local-fileset-basic/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c10462de6..14e2fd4eb 100644
--- a/systemtests/tests/py2plug-fd-local-fileset-basic/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/py2plug-fd-local-fileset-basic/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/py2plug-fd-local-fileset-restoreobject/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/py2plug-fd-local-fileset-restoreobject/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c10462de6..14e2fd4eb 100644
--- a/systemtests/tests/py2plug-fd-local-fileset-restoreobject/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/py2plug-fd-local-fileset-restoreobject/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/py2plug-fd-mariabackup/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/py2plug-fd-mariabackup/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index 3e1723fa6..3e8d20d14 100644
--- a/systemtests/tests/py2plug-fd-mariabackup/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/py2plug-fd-mariabackup/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -11,4 +11,5 @@ Storage {
Working Directory = "@working_dir@"
Pid Directory = "@piddir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/py2plug-fd-ovirt/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/py2plug-fd-ovirt/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c10462de6..14e2fd4eb 100644
--- a/systemtests/tests/py2plug-fd-ovirt/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/py2plug-fd-ovirt/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/py2plug-fd-percona-xtrabackup/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/py2plug-fd-percona-xtrabackup/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c10462de6..14e2fd4eb 100644
--- a/systemtests/tests/py2plug-fd-percona-xtrabackup/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/py2plug-fd-percona-xtrabackup/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/py2plug-fd-vmware/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/py2plug-fd-vmware/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c10462de6..14e2fd4eb 100644
--- a/systemtests/tests/py2plug-fd-vmware/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/py2plug-fd-vmware/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/py2plug-sd/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/py2plug-sd/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index 66ee623e6..623634277 100644
--- a/systemtests/tests/py2plug-sd/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/py2plug-sd/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
Plugin Names = "@python_module_name@"
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/py3plug-fd-contrib-mysql_dump/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/py3plug-fd-contrib-mysql_dump/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c10462de6..14e2fd4eb 100644
--- a/systemtests/tests/py3plug-fd-contrib-mysql_dump/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/py3plug-fd-contrib-mysql_dump/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/py3plug-fd-postgres/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/py3plug-fd-postgres/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c10462de6..14e2fd4eb 100644
--- a/systemtests/tests/py3plug-fd-postgres/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/py3plug-fd-postgres/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/python-bareos/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/python-bareos/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c10462de6..14e2fd4eb 100644
--- a/systemtests/tests/python-bareos/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/python-bareos/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/python-bareos/test-setup b/systemtests/tests/python-bareos/test-setup
index 5fa79d635..1c138dbbe 100755
--- a/systemtests/tests/python-bareos/test-setup
+++ b/systemtests/tests/python-bareos/test-setup
@@ -21,5 +21,6 @@ setup_data
echo "${BackupDirectory}/build" >"$tmp/file-list-simple"
bin/bareos start
+bin/bareos status
print_debug "$(bin/bconsole <<< "status dir")"
diff --git a/systemtests/tests/quota-softquota/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/quota-softquota/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c10462de6..14e2fd4eb 100644
--- a/systemtests/tests/quota-softquota/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/quota-softquota/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/restapi/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/restapi/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c10462de6..14e2fd4eb 100644
--- a/systemtests/tests/restapi/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/restapi/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/scheduler-backup/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/scheduler-backup/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c10462de6..14e2fd4eb 100644
--- a/systemtests/tests/scheduler-backup/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/scheduler-backup/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/scheduler-backup/test-setup b/systemtests/tests/scheduler-backup/test-setup
index 30231d4c2..85695c25e 100755
--- a/systemtests/tests/scheduler-backup/test-setup
+++ b/systemtests/tests/scheduler-backup/test-setup
@@ -53,6 +53,7 @@ echo "Schedule {
}" > "$conf"/bareos-dir.d/schedule/schedule.conf
bin/bareos start
+bin/bareos status
# make sure, director is up and running.
print_debug "$(bin/bconsole <<< "status dir")"
diff --git a/systemtests/tests/sparse-file/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/sparse-file/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c10462de6..14e2fd4eb 100644
--- a/systemtests/tests/sparse-file/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/sparse-file/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/spool/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/spool/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c10462de6..14e2fd4eb 100644
--- a/systemtests/tests/spool/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/spool/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/stresstest/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/stresstest/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index 8847967d8..99b0aa967 100644
--- a/systemtests/tests/stresstest/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/stresstest/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -8,5 +8,6 @@ Storage {
#
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
#Checkpoint Interval = 30
}
diff --git a/systemtests/tests/stresstest/test-setup b/systemtests/tests/stresstest/test-setup
index 1207a7dce..31c0e2b6f 100755
--- a/systemtests/tests/stresstest/test-setup
+++ b/systemtests/tests/stresstest/test-setup
@@ -38,6 +38,7 @@ fi
echo "$1" >$tmp/file-list
bin/bareos start
+bin/bareos status
# make sure, director is up and running.
print_debug "$(bin/bconsole <<< "status dir")"
diff --git a/systemtests/tests/truncate-command/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/truncate-command/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c10462de6..14e2fd4eb 100644
--- a/systemtests/tests/truncate-command/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/truncate-command/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/virtualfull-bscan/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/virtualfull-bscan/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c10462de6..14e2fd4eb 100644
--- a/systemtests/tests/virtualfull-bscan/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/virtualfull-bscan/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/virtualfull/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/virtualfull/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c10462de6..14e2fd4eb 100644
--- a/systemtests/tests/virtualfull/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/virtualfull/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/webui-common/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/webui-common/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c10462de6..14e2fd4eb 100644
--- a/systemtests/tests/webui-common/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/webui-common/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/systemtests/tests/xattr/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in b/systemtests/tests/xattr/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
index c10462de6..14e2fd4eb 100644
--- a/systemtests/tests/xattr/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
+++ b/systemtests/tests/xattr/etc/bareos/bareos-sd.d/storage/bareos-sd.conf.in
@@ -10,4 +10,5 @@ Storage {
# Plugin Names = ""
Working Directory = "@working_dir@"
SD Port = @sd_port@
+ @sd_backend_config@
}
diff --git a/webui/CMakeLists.txt b/webui/CMakeLists.txt
index 0c75fc989..288be678b 100644
--- a/webui/CMakeLists.txt
+++ b/webui/CMakeLists.txt
@@ -1,6 +1,6 @@
# BAREOSĀ® - Backup Archiving REcovery Open Sourced
#
-# Copyright (C) 2018-2021 Bareos GmbH & Co. KG
+# Copyright (C) 2018-2022 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
@@ -17,7 +17,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
message("Entering ${CMAKE_CURRENT_SOURCE_DIR}")
-cmake_minimum_required(VERSION 3.0)
project(bareos-webui)
include(GNUInstallDirs)
diff --git a/write_version_files.cmake b/write_version_files.cmake
index ecfa9613a..8d812c46b 100644
--- a/write_version_files.cmake
+++ b/write_version_files.cmake
@@ -1,6 +1,6 @@
# BAREOSĀ® - Backup Archiving REcovery Open Sourced
#
-# Copyright (C) 2019-2021 Bareos GmbH & Co. KG
+# Copyright (C) 2019-2022 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or modify it under
# the terms of version three of the GNU Affero General Public License as
@@ -15,7 +15,8 @@
# with this program; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-cmake_minimum_required(VERSION 3.0)
+cmake_minimum_required(VERSION 3.17)
+cmake_policy(VERSION 3.17...3.19)
set(CMAKE_MODULE_PATH
"${CMAKE_CURRENT_LIST_DIR}/cmake" "${CMAKE_CURRENT_LIST_DIR}/core/cmake"