From d5588edc807c934c3967b8eec94fab83ba8870ad Mon Sep 17 00:00:00 2001 From: Joerg Steffens Date: Mon, 15 Sep 2014 20:22:02 +0200 Subject: [PATCH] added storage device example configuration files added configuration files for the Storage Daemon backends tape and fifo. Also setting file permissions properly. Signed-off-by: Marco van Wieringen --- autoconf/configure.in | 6 +-- debian/bareos-storage-fifo.install.in | 1 + debian/bareos-storage-fifo.postinst | 45 +++++++++++++++++ debian/bareos-storage-tape.install.in | 1 + debian/bareos-storage-tape.postinst | 45 +++++++++++++++++ platforms/packaging/bareos.spec | 14 +++--- .../bareos-sd.d/device-ceph-rados.conf | 10 ++-- .../bareos-sd.d/device-fifo.conf | 26 ++++++++++ .../bareos-sd.d/device-gluster.conf | 10 ++-- .../device-tape-with-autoloader.conf | 49 +++++++++++++++++++ src/defaultconfigs/diskonly/bareos-sd.conf.in | 2 +- 11 files changed, 189 insertions(+), 20 deletions(-) create mode 100644 debian/bareos-storage-fifo.postinst create mode 100644 debian/bareos-storage-tape.postinst create mode 100644 src/defaultconfigs/bareos-sd.d/device-fifo.conf create mode 100644 src/defaultconfigs/bareos-sd.d/device-tape-with-autoloader.conf diff --git a/autoconf/configure.in b/autoconf/configure.in index 7ed759b0496..4a1ccfc9776 100644 --- a/autoconf/configure.in +++ b/autoconf/configure.in @@ -4207,12 +4207,12 @@ AC_SUBST(BUILD_SD_BACKENDS) dnl install storage backend config files -INSTALL_SD_CONFS="" +INSTALL_SD_CONFS="device-fifo.conf device-tape-with-autoloader.conf" if test X"$have_glusterfs" = "Xyes" ; then - INSTALL_SD_CONFS="${INSTALL_SD_BACKEND_CONFS} device-gluster.conf" + INSTALL_SD_CONFS="${INSTALL_SD_CONFS} device-gluster.conf" fi if test X"$have_ceph_rados" = "Xyes" ; then - INSTALL_SD_CONFS="${INSTALL_SD_BACKEND_CONFS} device-ceph-rados.conf" + INSTALL_SD_CONFS="${INSTALL_SD_CONFS} device-ceph-rados.conf" fi AC_SUBST(INSTALL_SD_CONFS) diff --git a/debian/bareos-storage-fifo.install.in b/debian/bareos-storage-fifo.install.in index 1a687202cdc..eb908ee7f9c 100644 --- a/debian/bareos-storage-fifo.install.in +++ b/debian/bareos-storage-fifo.install.in @@ -1 +1,2 @@ +/etc/bareos/bareos-sd.d/device-fifo.conf @backenddir@/libbareossd-fifo*.so diff --git a/debian/bareos-storage-fifo.postinst b/debian/bareos-storage-fifo.postinst new file mode 100644 index 00000000000..49d9612f7fa --- /dev/null +++ b/debian/bareos-storage-fifo.postinst @@ -0,0 +1,45 @@ +#!/bin/sh +# postinst script for bareos +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-remove' +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + +daemon_user=bareos +daemon_group=bareos + +permissions() +{ + chown root:${daemon_group} /etc/bareos/bareos-sd.d/device-fifo.conf +} + +case "$1" in + configure) + permissions + ;; + abort-upgrade|abort-remove|abort-deconfigure) + ;; + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/debian/bareos-storage-tape.install.in b/debian/bareos-storage-tape.install.in index 94f712cb60a..f6e98d74c93 100644 --- a/debian/bareos-storage-tape.install.in +++ b/debian/bareos-storage-tape.install.in @@ -1,4 +1,5 @@ /etc/bareos/mtx-changer.conf +/etc/bareos/bareos-sd.d/device-tape-with-autoloader.conf @backenddir@/libbareossd-gentape*.so @backenddir@/libbareossd-tape*.so @plugindir@/scsitapealert-sd.so diff --git a/debian/bareos-storage-tape.postinst b/debian/bareos-storage-tape.postinst new file mode 100644 index 00000000000..a196cd84275 --- /dev/null +++ b/debian/bareos-storage-tape.postinst @@ -0,0 +1,45 @@ +#!/bin/sh +# postinst script for bareos +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-remove' +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + +daemon_user=bareos +daemon_group=bareos + +permissions() +{ + chown root:${daemon_group} /etc/bareos/bareos-sd.d/device-tape-with-autoloader.conf +} + +case "$1" in + configure) + permissions + ;; + abort-upgrade|abort-remove|abort-deconfigure) + ;; + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/platforms/packaging/bareos.spec b/platforms/packaging/bareos.spec index 4f1e868ec84..13d686c3fc3 100644 --- a/platforms/packaging/bareos.spec +++ b/platforms/packaging/bareos.spec @@ -800,20 +800,22 @@ echo "This is a meta package to install a full bareos system" > %{buildroot}%{_d %config(noreplace) %{_sysconfdir}/bareos/mtx-changer.conf %{_mandir}/man8/btape.8.gz %{_sbindir}/btape +%attr(0640, %{storage_daemon_user}, %{daemon_group}) %config(noreplace) %{_sysconfdir}/bareos/bareos-sd.d/device-tape-with-autoloader.conf %{plugin_dir}/scsitapealert-sd.so +%files storage-fifo +%defattr(-, root, root) +%{backend_dir}/libbareossd-fifo*.so +%attr(0640, %{storage_daemon_user}, %{daemon_group}) %config(noreplace) %{_sysconfdir}/bareos/bareos-sd.d/device-fifo.conf + %if 0%{?glusterfs} %files storage-glusterfs %defattr(-, root, root) %{backend_dir}/libbareossd-gfapi*.so -%{_sysconfdir}/bareos/bareos-sd.d/device-gluster.conf +%attr(0640, %{storage_daemon_user}, %{daemon_group}) %config(noreplace) %{_sysconfdir}/bareos/bareos-sd.d/device-gluster.conf %endif -%files storage-fifo -%defattr(-, root, root) -%{backend_dir}/libbareossd-fifo*.so - -%endif # client_only +%endif # not client_only %files filedaemon # fd package (bareos-fd, plugins) diff --git a/src/defaultconfigs/bareos-sd.d/device-ceph-rados.conf b/src/defaultconfigs/bareos-sd.d/device-ceph-rados.conf index 49595ac5e70..4f058ef1366 100644 --- a/src/defaultconfigs/bareos-sd.d/device-ceph-rados.conf +++ b/src/defaultconfigs/bareos-sd.d/device-ceph-rados.conf @@ -14,12 +14,12 @@ Device { Name = RadosStorage + Archive Device = /etc/ceph/ceph.conf:hostname Device Type = rados Media Type = RadosFile - Archive Device = /etc/ceph/ceph.conf:hostname - LabelMedia = yes + Label Media = yes Random Access = yes - AutomaticMount = yes - RemovableMedia = no - AlwaysOpen = no + Automatic Mount = yes + Removable Media = no + Always Open = no } diff --git a/src/defaultconfigs/bareos-sd.d/device-fifo.conf b/src/defaultconfigs/bareos-sd.d/device-fifo.conf new file mode 100644 index 00000000000..7d4a12aa5e2 --- /dev/null +++ b/src/defaultconfigs/bareos-sd.d/device-fifo.conf @@ -0,0 +1,26 @@ +# +# example of a Storage daemon dummy device to test the backup. +# This example is write-only, so obviously, there is no way to restore data. +# In other cases, Fifo backends are often combined this by RunBeforeJobs, +# to start a corresponding reader/writer program. +# + +# +# Preparations: +# +# include this configuration file in bareos-sd.conf by +# @/etc/bareos/bareos-sd.d/device-fifo.conf +# + +Device { + Name = NULL + Archive Device = /dev/null + Device Type = fifo + Media Type = null + Label Media = yes + Random Access = no + Automatic Mount = no + Removable Media = no + Always Open = no + MaximumOpenWait = 60 +} diff --git a/src/defaultconfigs/bareos-sd.d/device-gluster.conf b/src/defaultconfigs/bareos-sd.d/device-gluster.conf index b031cc84ae1..afd33bede06 100644 --- a/src/defaultconfigs/bareos-sd.d/device-gluster.conf +++ b/src/defaultconfigs/bareos-sd.d/device-gluster.conf @@ -7,12 +7,12 @@ Device { Name = GlusterStorage + Archive Device = gluster://server.example.com/volumename/bareos Device Type = gfapi Media Type = GlusterFile - Archive Device = gluster://server.example.com/volumename/bareos - LabelMedia = yes + Label Media = yes Random Access = yes - AutomaticMount = yes - RemovableMedia = no - AlwaysOpen = no + Automatic Mount = yes + Removable Media = no + Always Open = no } diff --git a/src/defaultconfigs/bareos-sd.d/device-tape-with-autoloader.conf b/src/defaultconfigs/bareos-sd.d/device-tape-with-autoloader.conf new file mode 100644 index 00000000000..beccda98aa0 --- /dev/null +++ b/src/defaultconfigs/bareos-sd.d/device-tape-with-autoloader.conf @@ -0,0 +1,49 @@ +# +# Preparations: +# +# include this configuration file in bareos-sd.conf by +# @/etc/bareos/bareos-sd.d/device-tape-with-autoloader.conf +# + +# on Linux use "lsscsi --generic" +# to get a list of your SCSI devices. +# However, normaly you should access your devices by-id +# (eg. /dev/tape/by-id/scsi-350011d00018a5f03-nst), +# because the short device names like /dev/nst1 +# might change on reboot. + +Device { + + Name = "tapedrive-0" + DeviceType = tape + + # default:0, only required if the autoloader have multiple drives. + DriveIndex = 0 + + # if only one drive is available, this is normally /dev/nst0. + # However, it is advised to access it via id (/dev/tape/by-id/...). + ArchiveDevice = /dev/nst0 + #ArchiveDevice = /dev/tape/by-id/scsi-350011d00018a5f03-nst + + # arbitrary string that descripes the the storage media. + # Bareos uses this to determine, which device can be handle what media. + MediaType = lto + + AutoChanger = yes # default: no + AutomaticMount = yes # default: no + MaximumFileSize = 10GB # default: 1000000000 (1GB) +} + + + +Autochanger { + Name = "autochanger-0" + # adapt this, to match your storage loader + Changer Device = /dev/tape/by-id/scsi-1TANDBERGStorageLoader_AA45JC001732 + + # an Autochanger can contain multiple drive devices + Device = tapedrive-0 + #Device = tapedrive-1 + + Changer Command = "/usr/lib/bareos/scripts/mtx-changer %c %o %S %a %d" +} diff --git a/src/defaultconfigs/diskonly/bareos-sd.conf.in b/src/defaultconfigs/diskonly/bareos-sd.conf.in index 10beb495a5f..7f5500f8db5 100644 --- a/src/defaultconfigs/diskonly/bareos-sd.conf.in +++ b/src/defaultconfigs/diskonly/bareos-sd.conf.in @@ -45,7 +45,7 @@ Device { Media Type = File Archive Device = @archivedir@ LabelMedia = yes; # lets Bareos label unlabeled media - Random Access = Yes; + Random Access = yes; AutomaticMount = yes; # when device opened, read it RemovableMedia = no; AlwaysOpen = no;