diff --git a/CMakeLists.txt b/CMakeLists.txt index 2f9c25cda5c32370869d2a4dac76ac22c33241e4..1dcdfbae824f63a2540b4e96557ad9de760c7073 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,7 @@ cmake_minimum_required (VERSION 2.6) project(cta) -set(CMAKE_C_FLAGS "-fPIC -pedantic -Wall -Wextra -Werror -Wno-unused-parameter") +set(CMAKE_C_FLAGS "-fPIC -Wall -Wextra -Werror -Wno-unused-parameter") # Please note that the -fms-extensions option should be dropped when this # project gets to be compiled on a fully C++ 11 compliant compiler. The option diff --git a/catalogue/catalogue_schema.pdf b/catalogue/catalogue_schema.pdf index 5a1b3001f16f66b9ca70fa14cdf1bd04a1dae492..925c57a2188b6202c5090dab81b3719b80e52d39 100644 Binary files a/catalogue/catalogue_schema.pdf and b/catalogue/catalogue_schema.pdf differ diff --git a/continuousintegration/docker/ctafrontend/cc7/buildtree-stage1-rpms/Dockerfile b/continuousintegration/docker/ctafrontend/cc7/buildtree-stage1-rpms/Dockerfile index 3af92aa1c062a4be31d049666bd4c94cc01dce6c..cf14e4bbb50230fd9c3d7194d74d85737d43d9b4 100644 --- a/continuousintegration/docker/ctafrontend/cc7/buildtree-stage1-rpms/Dockerfile +++ b/continuousintegration/docker/ctafrontend/cc7/buildtree-stage1-rpms/Dockerfile @@ -81,7 +81,6 @@ RUN yum-config-manager --enable epel --setopt="epel.priority=4" \ mtx \ lsscsi \ sg3_utils \ - castor-rmc-server \ protobuf3 \ cryptopp \ json-c \ diff --git a/continuousintegration/docker/ctafrontend/cc7/etc/yum/pluginconf.d/versionlock.list b/continuousintegration/docker/ctafrontend/cc7/etc/yum/pluginconf.d/versionlock.list index 3e72a0453d2e9c009ee511febb582bd9efc17596..9848b693b7669f82245b5b40ed9e8af388cd1243 100644 --- a/continuousintegration/docker/ctafrontend/cc7/etc/yum/pluginconf.d/versionlock.list +++ b/continuousintegration/docker/ctafrontend/cc7/etc/yum/pluginconf.d/versionlock.list @@ -9,21 +9,23 @@ 0:eos-srm-4.1.26-20170824172038gitc7cf4c6.el7.cern.x86_64 0:eos-test-4.1.26-20170824172038gitc7cf4c6.el7.cern.x86_64 0:eos-testkeytab-4.1.26-20170824172038gitc7cf4c6.el7.cern.x86_64 -1:xrootd-20171005.0e841d1-1.el7.cern.x86_64 -1:xrootd-client-20171005.0e841d1-1.el7.cern.x86_64 -1:xrootd-client-devel-20171005.0e841d1-1.el7.cern.x86_64 -1:xrootd-client-libs-20171005.0e841d1-1.el7.cern.x86_64 -1:xrootd-debuginfo-20171005.0e841d1-1.el7.cern.x86_64 -1:xrootd-devel-20171005.0e841d1-1.el7.cern.x86_64 -1:xrootd-doc-20171005.0e841d1-1.el7.cern.noarch -1:xrootd-fuse-20171005.0e841d1-1.el7.cern.x86_64 -1:xrootd-libs-20171005.0e841d1-1.el7.cern.x86_64 -1:xrootd-private-devel-20171005.0e841d1-1.el7.cern.x86_64 -1:xrootd-python-20171005.0e841d1-1.el7.cern.x86_64 -1:xrootd-selinux-20171005.0e841d1-1.el7.cern.noarch -1:xrootd-server-20171005.0e841d1-1.el7.cern.x86_64 -1:xrootd-server-devel-20171005.0e841d1-1.el7.cern.x86_64 -1:xrootd-server-libs-20171005.0e841d1-1.el7.cern.x86_64 +1:python2-xrootd-4.8.0-0.rc1.el7.x86_64 +1:python3-xrootd-4.8.0-0.rc1.el7.x86_64 +1:xrootd-4.8.0-0.rc1.el7.x86_64 +1:xrootd-client-4.8.0-0.rc1.el7.x86_64 +1:xrootd-client-devel-4.8.0-0.rc1.el7.x86_64 +1:xrootd-client-libs-4.8.0-0.rc1.el7.x86_64 +1:xrootd-debuginfo-4.8.0-0.rc1.el7.x86_64 +1:xrootd-devel-4.8.0-0.rc1.el7.x86_64 +1:xrootd-doc-4.8.0-0.rc1.el7.noarch +1:xrootd-fuse-4.8.0-0.rc1.el7.x86_64 +1:xrootd-libs-4.8.0-0.rc1.el7.x86_64 +1:xrootd-private-devel-4.8.0-0.rc1.el7.x86_64 +1:xrootd-selinux-4.8.0-0.rc1.el7.noarch +1:xrootd-server-4.8.0-0.rc1.el7.x86_64 +1:xrootd-server-devel-4.8.0-0.rc1.el7.x86_64 +1:xrootd-server-libs-4.8.0-0.rc1.el7.x86_64 +1:xrootd-tests-4.8.0-0.rc1.el7.x86_64 2:ceph-12.2.0-0.el7.x86_64 2:ceph-base-12.2.0-0.el7.x86_64 2:ceph-common-12.2.0-0.el7.x86_64 diff --git a/continuousintegration/docker/ctafrontend/cc7/opt/run/bin/rmcd.sh b/continuousintegration/docker/ctafrontend/cc7/opt/run/bin/rmcd.sh index ee694be5e60ab9b9c6e59e5b1177b6f98fd5fd57..69d4410ec4a8c54186acede78a23e0284c0ee86e 100755 --- a/continuousintegration/docker/ctafrontend/cc7/opt/run/bin/rmcd.sh +++ b/continuousintegration/docker/ctafrontend/cc7/opt/run/bin/rmcd.sh @@ -8,7 +8,7 @@ if [ ! -e /etc/buildtreeRunner ]; then yum-config-manager --enable castor # Install missing RPMs - yum -y install mt-st mtx lsscsi sg3_utils castor-rmc-server + yum -y install mt-st mtx lsscsi sg3_utils cta-rmcd fi # source library configuration file @@ -18,7 +18,7 @@ cat /tmp/library-rc.sh . /tmp/library-rc.sh # to get rmcd logs to stdout -tail -F /var/log/castor/rmcd_legacy.log & +tail -F /var/log/cta/cta-rmcd.log & ln -s /dev/${LIBRARYDEVICE} /dev/smc -/usr/bin/rmcd -f /dev/smc +/usr/bin/cta-rmcd -f /dev/smc diff --git a/continuousintegration/orchestration/tests/client_ar.sh b/continuousintegration/orchestration/tests/client_ar.sh index b10a7d97d4414a3faffc20e2d15dbfc945317574..2617e2f22e11081bde7187c5d5e47033dd4a1b98 100644 --- a/continuousintegration/orchestration/tests/client_ar.sh +++ b/continuousintegration/orchestration/tests/client_ar.sh @@ -72,7 +72,7 @@ EOS_BATCHFILE=$(mktemp --suffix=.eosh) dd if=/dev/urandom of=/tmp/testfile bs=1k count=${FILE_KB_SIZE} || exit 1 if [[ $VERBOSE == 1 ]]; then - tail -v -f /mnt/logs/tpsrv0*/rmcd/castor/rmcd_legacy.log & + tail -v -f /mnt/logs/tpsrv0*/rmcd/cta/cta-rmcd.log & TAILPID=$! fi diff --git a/cta.spec.in b/cta.spec.in index 06c723f3aeed6856a7cc2e28644ec9ab6888722a..460bdc7666fbc3038e4522a5600b8119e3753701 100644 --- a/cta.spec.in +++ b/cta.spec.in @@ -37,10 +37,10 @@ BuildRequires: xrootd-client-devel = 1:4.2.3 BuildRequires: xrootd-devel = 1:4.2.3 BuildRequires: cryptopp-devel >= 5.6.2 %else -BuildRequires: xrootd-client-devel = 1:20171005.0e841d1 -BuildRequires: xrootd-devel = 1:20171005.0e841d1 -BuildRequires: xrootd-server-devel = 1:20171005.0e841d1 -BuildRequires: xrootd-private-devel = 1:20171005.0e841d1 +BuildRequires: xrootd-client-devel >= 1:4.8.0 +BuildRequires: xrootd-devel >= 1:4.8.0 +BuildRequires: xrootd-server-devel >= 1:4.8.0 +BuildRequires: xrootd-private-devel >= 1:4.8.0 BuildRequires: librados-devel >= 11.0, libradosstriper-devel >= 11.0, BuildRequires: protobuf3-compiler >= 3.3.1 protobuf3-devel >= 3.3.1 BuildRequires: gmock-devel >= 1.5.0 gtest-devel >= 1.5.0 @@ -290,4 +290,31 @@ Utilities to faciliate working with the mediachangers %attr(0644,root,root) %doc /usr/share/man/man1/cta-mediachanger-dismount.1cta.gz %attr(0644,root,root) %doc /usr/share/man/man1/cta-mediachanger-mount.1cta.gz + +%package -n cta-rmcd +Summary: Tools to faciliate working with rmcd and smc in cta +Group: Application/CTA +Requires: logrotate +#Requires: cta-lib +Requires(pre): /usr/bin/getent, /usr/sbin/groupadd, /usr/sbin/useradd +%description -n cta-rmcd +CERN Tape Archive: +Tools to faciliate working with rmcd and smc in cta +%pre -n cta-rmcd +/usr/bin/getent group cta || /usr/sbin/groupadd cta +/usr/bin/getent passwd cta || /usr/sbin/useradd -s /bin/nologin -c "CTA system account" -g cta cta +%files -n cta-rmcd +%defattr(-,root,root) +%attr(0755,cta,cta) %dir /var/log/cta +%attr(0644,root,root) %config(noreplace) /etc/logrotate.d/cta-rmcd +%attr(0644,root,root) %doc /usr/share/man/man1/cta-rmcd.1cta.gz +%attr(0755,root,root) %{_bindir}/cta-rmcd +%attr(0755,root,root) %{_bindir}/cta-smc +%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/cta/cta-rmcd.conf +%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/cta/cta-smc.conf +%attr(0644,root,root) %doc /usr/share/man/man1/cta-smc.1cta.gz +%attr(0644,root,root) /etc/sysconfig/cta-rmcd +%attr(0644,root,root) /etc/systemd/system/cta-rmcd.service + %endif + diff --git a/doc/CTA_Admin.pdf b/doc/CTA_Admin.pdf index e31882f880db5b083390e90a08ea092412fb7f69..fe4f5cf2fd77b89687a813f3d8521051735901a2 100644 Binary files a/doc/CTA_Admin.pdf and b/doc/CTA_Admin.pdf differ diff --git a/doc/CTA_EOS.pdf b/doc/CTA_EOS.pdf index 7dfad461831a1f399799ca8393ce7d75a934f270..0d31648f321fcebfb6959d4e05b561d5bbf46ec2 100644 Binary files a/doc/CTA_EOS.pdf and b/doc/CTA_EOS.pdf differ diff --git a/doc/CTA_security.pdf b/doc/CTA_security.pdf new file mode 100644 index 0000000000000000000000000000000000000000..caabc9dde234de8e1f9d2e95a50c5575af012e9d Binary files /dev/null and b/doc/CTA_security.pdf differ diff --git a/doc/The_Tape_Storage_Element.pdf b/doc/The_Tape_Storage_Element.pdf index 7b6720de77fa43019f8a188605e70614ca1ef535..250a9318cc4edcdc488c8c81cb45ba46fca3f7d8 100644 Binary files a/doc/The_Tape_Storage_Element.pdf and b/doc/The_Tape_Storage_Element.pdf differ diff --git a/doc/cta.pdf b/doc/cta.pdf index dccdae55b694b7085b35c1d95a3c94037432bcdf..3ae2a47750025c48d93f13157d4061d2eee56056 100644 Binary files a/doc/cta.pdf and b/doc/cta.pdf differ diff --git a/doc/latex/CTA_Admin_Install.tex b/doc/latex/CTA_Admin_Install.tex index 8d85176cacc615548ea7a4a4e309f119d8331cd6..ab026662e131e9c19a6d6e6a1a96849aeb247ebc 100644 --- a/doc/latex/CTA_Admin_Install.tex +++ b/doc/latex/CTA_Admin_Install.tex @@ -445,29 +445,29 @@ host and user, by connecting directly to the catalogue database. If the CTA instance is not using real tape hardware, follow the directions in Appendix~\ref{install_mhvtl} to install the mhVTL Virtual Tape Library. -\subsection{Install the Remote Media Changer Daemon (\texttt{rmcd})} +\subsection{Install the Remote Media Changer Daemon (\texttt{cta-rmcd})} -The Remote Media Changer Daemon (\texttt{rmcd}) is a TCP/IP server which controls the robots in the tape libraries. -\texttt{rmcd} must run locally for security reasons: it only listens to the localhost network. It includes a device +The Remote Media Changer Daemon (\texttt{cta-rmcd}) is a TCP/IP server which controls the robots in the tape libraries. +\texttt{cta-rmcd} must run locally for security reasons: it only listens to the localhost network. It includes a device driver for the drive and one for the library. -Install \texttt{rmcd}: +Install \texttt{cta-rmcd}: \begin{lstlisting} # yum install -y castor-rmc-client castor-rmc-server initscripts \end{lstlisting} \begin{alertbox} -The dependency on \texttt{initscripts} will be removed when \texttt{rmcd} is ported from \texttt{init.d} to +The dependency on \texttt{initscripts} will be removed when \texttt{cta-rmcd} is ported from \texttt{init.d} to \texttt{systemd}. \end{alertbox} -The configuration file \texttt{/etc/sysconfig/rmcd} should contain the following settings: +The configuration file \texttt{/etc/sysconfig/cta-rmcd} should contain the following settings: \begin{lstlisting} DAEMON_COREFILE_LIMIT=unlimited RUN_RMCD=yes RMCD_OPTIONS=/dev/smc \end{lstlisting} -Start \texttt{rmcd}: +Start \texttt{cta-rmcd}: \begin{lstlisting} -# systemctl start rmcd +# systemctl start cta-rmcd \end{lstlisting} Now the command \texttt{smc} can be used to load/unload tapes (instead of \hyperref[install_mhvtl_virtual_tape_library_commands]{\texttt{mtx}}). diff --git a/doc/queueRequestSeqDiags.pdf b/doc/queueRequestSeqDiags.pdf index 6a61a6a1e51ef54d810afe9ab40b20b4cd70aa06..a77cb2e608d2b940b47155a870b583a044e7a5a0 100644 Binary files a/doc/queueRequestSeqDiags.pdf and b/doc/queueRequestSeqDiags.pdf differ diff --git a/mediachanger/CMakeLists.txt b/mediachanger/CMakeLists.txt index a4a4ffc803ca3e3b2970ef9132d2d07863e78938..6d156042e27736a26b45662635afc7268d9fa4f4 100644 --- a/mediachanger/CMakeLists.txt +++ b/mediachanger/CMakeLists.txt @@ -15,6 +15,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. cmake_minimum_required (VERSION 2.6) +add_subdirectory(castorrmc) find_package(openssl REQUIRED) find_package(Protobuf3 REQUIRED) find_package(zeromq REQUIRED) diff --git a/mediachanger/castorrmc/CMakeLists.txt b/mediachanger/castorrmc/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..44891b47497b48e1fa6774b77cf7346f074daef1 --- /dev/null +++ b/mediachanger/castorrmc/CMakeLists.txt @@ -0,0 +1,19 @@ +# The CERN Tape Archive (CTA) project +# Copyright (C) 2015 CERN +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +cmake_minimum_required (VERSION 2.6) + +add_subdirectory(common) +add_subdirectory(rmc) diff --git a/mediachanger/castorrmc/common/CMakeLists.txt b/mediachanger/castorrmc/common/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..eb7c5ae303dc50ab6dfaf7c95c376e3734e1c5ff --- /dev/null +++ b/mediachanger/castorrmc/common/CMakeLists.txt @@ -0,0 +1,35 @@ +# The CERN Tape Archive (CTA) project +# Copyright (C) 2015 CERN +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +cmake_minimum_required (VERSION 2.6) + +include_directories (${PROJECT_SOURCE_DIR}/mediachanger/castorrmc/h) + +set (CTARMCCOMMON_LIB_SRC_FILES + Cdomainname.c + Cglobals.c + Cinitdaemon.c + Cnetdb.c + Csnprintf.c + getconfent.c + marshall.c + readc.c + serror.c + socket.c + socket_timeout.c + strerror_r_wrapper.cpp + util.c) + +add_library(ctarmccommon ${CTARMCCOMMON_LIB_SRC_FILES}) diff --git a/mediachanger/castorrmc/rmc/CMakeLists.txt b/mediachanger/castorrmc/rmc/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee15ad6e9813f66b1faedfdcff0502ffbfcc32a3 --- /dev/null +++ b/mediachanger/castorrmc/rmc/CMakeLists.txt @@ -0,0 +1,63 @@ +# The CERN Tape Archive (CTA) project +# Copyright (C) 2015 CERN +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +cmake_minimum_required (VERSION 2.6) +include_directories (${PROJECT_SOURCE_DIR}/mediachanger/castorrmc/h) + +set (RMCD_SRC_FILES + rmc_serv.c + rmc_logit.c + rmc_logreq.c + rmc_marshall_element.c + rmc_procreq.c + rmc_sendrep.c + rmc_send_scsi_cmd.c + rmc_serv.c + rmc_smcsubr.c +) + +if(CMAKE_COMPILER_IS_GNUCC) + # Add -Wno-format-overflow compiler flag if using gcc version 7 or greater + if (GCC_VERSION VERSION_EQUAL 7 OR GCC_VERSION VERSION_GREATER 7) + set_property(SOURCE rmc_send_scsi_cmd.c APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-format-overflow") + endif (GCC_VERSION VERSION_EQUAL 7 OR GCC_VERSION VERSION_GREATER 7) +endif(CMAKE_COMPILER_IS_GNUCC) + +add_executable(cta-rmcd ${RMCD_SRC_FILES}) +target_link_libraries(cta-rmcd ctarmccommon) +install (FILES cta-rmcd.conf DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/cta) +install (FILES cta-smc.conf DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/cta) + +install (TARGETS cta-rmcd DESTINATION /usr/bin) +install (FILES cta-rmcd.1cta DESTINATION /usr/share/man/man1) +install (FILES cta-rmcd.logrotate DESTINATION /etc/logrotate.d RENAME cta-rmcd) +install (FILES cta-rmcd.sysconfig DESTINATION /etc/sysconfig RENAME cta-rmcd) +install (FILES cta-rmcd.service DESTINATION /etc/systemd/system) + +set (SMC_SRC_FILES + rmc_dismount.c + rmc_errmsg.c + rmc_export.c + rmc_find_cartridge.c + rmc_get_geometry.c + rmc_import.c + rmc_mount.c + rmc_read_elem_status.c + send2rmc.c + smc.c) +add_executable(cta-smc ${SMC_SRC_FILES}) +target_link_libraries(cta-smc ctarmccommon) +install (TARGETS cta-smc DESTINATION /usr/bin) +install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/cta-smc.1cta DESTINATION /usr/share/man/man1) diff --git a/mediachanger/castorrmc/rmc/rmcd.man b/mediachanger/castorrmc/rmc/cta-rmcd.1cta similarity index 69% rename from mediachanger/castorrmc/rmc/rmcd.man rename to mediachanger/castorrmc/rmc/cta-rmcd.1cta index 274db992ad4f81838d2a34fe3f373272e47c8f92..3738da9ef960fb35f35ce24dcb25baab1eb22140 100644 --- a/mediachanger/castorrmc/rmc/rmcd.man +++ b/mediachanger/castorrmc/rmc/cta-rmcd.1cta @@ -1,16 +1,36 @@ .\" Copyright (C) 2002 by CERN/IT/PDP/DM .\" All rights reserved .\" -.TH RMCD "8castor" "$Date: 2009/08/18 09:43:01 $" CASTOR "rmc Administrator Commands" +CTA supports two types of tape libraries, SCSI compatible ones and Oracle +Automatic Cartridge System (ACS) ones. The cta-taped daemon requires a tape +library daemon to be installed and run on the same tape server as itself. +There are two types of CTA tape library daemons, one for SCSI compatible tape +libraries and one for ACS tape libraries. + +A SCSI compatible tape library requires the following daemon: + +\fBrmcd\fP + +The installation RPM for the \fBrmcd\fP daemon and its manual page is: + +\fBcta-rmc-server-0.0-XX.slc6.x86_64\fP + +The \fBcta-rmcd\fP daemon can be started, stopped and its status queried using +the usual service commands: + .SH NAME -rmcd \- start the Remote Media Changer daemon +\fBservice cta-rmcd start the device file of the tape library\fP +.br +\fBservice cta-rmcd status\fP +.br +\fBservice cta-rmcd stop\fP .SH SYNOPSIS -.B rmcd +.B cta-rmcd .I smc_ldr .SH DESCRIPTION .LP The -.B rmcd +.B cta-rmcd command starts the Remote Media Changer daemon. This command is usually executed at system startup time .RB ( /etc/rc.local ). @@ -64,7 +84,7 @@ itself. The completion code of the command is also logged. .SH FILES .TP 1.5i -.B /var/log/castor/rmcd.log +.B /var/log/cta/cta-rmcd.log .SH EXAMPLES .TP Here is a small log: diff --git a/mediachanger/castorrmc/rmc/cta-rmcd.conf b/mediachanger/castorrmc/rmc/cta-rmcd.conf new file mode 100644 index 0000000000000000000000000000000000000000..e97d8b4096ae2f3df65004ff221f7b5043042c5c --- /dev/null +++ b/mediachanger/castorrmc/rmc/cta-rmcd.conf @@ -0,0 +1,38 @@ +# The CERN Tape Archive (CTA) project +# Copyright (C) 2015 CERN +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +################################################################################ +# +# CTA Sample Configuration File +# +################################################################################ + +# The log mask. Logs with a level lower than this value will be masked. +# Possible values are: +# EMERG +# ALERT +# CRIT +# ERR +# WARNING +# NOTICE +# INFO +# DEBUG +# USERERR +# +# Please note that the USERERR log level is equivalent to NOTICE because it is +# a convention of CTA to use log level NOTICE to label user errors. +# +# taped LogMask INFO diff --git a/mediachanger/castorrmc/rmc/cta-rmcd.logrotate b/mediachanger/castorrmc/rmc/cta-rmcd.logrotate new file mode 100644 index 0000000000000000000000000000000000000000..67bc1108313fded1b25abac21ae0a8a625447a06 --- /dev/null +++ b/mediachanger/castorrmc/rmc/cta-rmcd.logrotate @@ -0,0 +1,11 @@ + +/var/log/cta/cta-rmcd*.log { + compress + daily + missingok + rotate 500 + delaycompress + postrotate + /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true + endscript +} diff --git a/mediachanger/castorrmc/rmc/cta-rmcd.service b/mediachanger/castorrmc/rmc/cta-rmcd.service new file mode 100644 index 0000000000000000000000000000000000000000..7074df349a2265fc9bb9846fae8ff3e5fdc59958 --- /dev/null +++ b/mediachanger/castorrmc/rmc/cta-rmcd.service @@ -0,0 +1,14 @@ + +[Unit] +Description=CERN Tape Archive (CTA) rmcd daemon +After=syslog.target network-online.target + +[Service] +EnvironmentFile=-/etc/sysconfig/cta-rmcd +ExecStart=/usr/bin/cta-rmcd ${CTA_RMCD_OPTIONS} +LimitCORE=infinity +Type=forking +Restart=no + +[Install] +WantedBy=default.target diff --git a/mediachanger/castorrmc/rmc/cta-rmcd.sysconfig b/mediachanger/castorrmc/rmc/cta-rmcd.sysconfig new file mode 100644 index 0000000000000000000000000000000000000000..2bd7fcfddb05a84d18da43bb718b28c42f162713 --- /dev/null +++ b/mediachanger/castorrmc/rmc/cta-rmcd.sysconfig @@ -0,0 +1,5 @@ + +# Arguments for the rmcd server daemon +# -smc_ldr is the picker device as defined in /dev. +# -f keep process in the foreground, do not fork. +#CTA_RMCD_OPTIONS="smc_ldr" diff --git a/mediachanger/castorrmc/rmc/smc.man b/mediachanger/castorrmc/rmc/cta-smc.1cta similarity index 79% rename from mediachanger/castorrmc/rmc/smc.man rename to mediachanger/castorrmc/rmc/cta-smc.1cta index 5b7f2f7af8233d65d9400bbdd347b25effb59604..04002012116449e0d2032bd0d672b79a051b0650 100644 --- a/mediachanger/castorrmc/rmc/smc.man +++ b/mediachanger/castorrmc/rmc/cta-smc.1cta @@ -1,11 +1,25 @@ -.\" Copyright (C) 1998-2002 by CERN/IT/PDP/DM -.\" All rights reserved + +.\"The CERN Tape Archive (CTA) project +.\" Copyright (C) 2015 CERN +.\" +.\" This program is free software: you can redistribute it and/or modify +.\" it under the terms of the GNU General Public License as published by +.\" the Free Software Foundation, either version 3 of the License, or +.\" (at your option) any later version. +.\" +.\" 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 General Public License for more details. +.\" +.\" You should have received a copy of the GNU General Public License +.\" along with this program. If not, see <http://www.gnu.org/licenses/>. .\" -.TH SMC "1castor" "$Date: 2005/06/16 09:43:12 $" CASTOR "Ctape User Commands" +.TH SMC "1cta" "$Date: 2017/12/30 09:43:12 $" CTA "Ctape User Commands" .SH NAME -smc \- command line interface to drive robotic devices through SCSI +cta-smc \- command line interface to drive robotic devices through SCSI .SH SYNOPSIS -.B smc +.B cta-smc .BI -d .BI -D " drive_ordinal" [ @@ -14,14 +28,14 @@ smc \- command line interface to drive robotic devices through SCSI .BI -v ] .br -.B smc +.B cta-smc .BI -e .BI -V " vid" [ .BI -v ] .br -.B smc +.B cta-smc .BI -i [ .BI -V " vid" @@ -29,7 +43,7 @@ smc \- command line interface to drive robotic devices through SCSI .BI -v ] .br -.B smc +.B cta-smc .BI -m .BI -D " drive_ordinal" .BI -V " vid" @@ -37,7 +51,7 @@ smc \- command line interface to drive robotic devices through SCSI .BI -v ] .br -.B smc +.B cta-smc .B -q D [ .BI -D " drive_ordinal" @@ -46,19 +60,19 @@ smc \- command line interface to drive robotic devices through SCSI .BI -v ] .br -.B smc +.B cta-smc .B -q L [ .BI -v ] .br -.B smc +.B cta-smc .B -q P [ .BI -v ] .br -.B smc +.B cta-smc .B -q S [ .BI -N " nbelem" @@ -68,7 +82,7 @@ smc \- command line interface to drive robotic devices through SCSI .BI -v ] .br -.B smc +.B cta-smc .B -q V [ .BI -N " nbelem" @@ -78,7 +92,7 @@ smc \- command line interface to drive robotic devices through SCSI .BI -v ] .SH DESCRIPTION -.B smc +.B cta-smc is a program allowing to mount, dismount, export volumes in a robotic library through SCSI. It allows also to query various elements of the library. .SH OPTIONS @@ -155,19 +169,19 @@ verbose mode. On query requests it prints headers on top of the columns. To mount the volume JK2005 on drive 1: .br .RS -.B "smc -m -D 1 -V JK2005" +.B "cta-smc -m -D 1 -V JK2005" .RE .LP To dismount the volume present on drive 1 after checking the vid: .br .RS -.B "smc -d -D 1 -V JK2005" +.B "cta-smc -d -D 1 -V JK2005" .RE .LP To query the main charateristics of the library: .br .RS -.B "smc -q L" +.B "cta-smc -q L" .sp .nf Vendor/Product/Revision = <STK 9714 1500> @@ -181,7 +195,7 @@ Device Count = 2, Start = 1030 To query the status of all the drives: .br .RS -.B "smc -q D -v" +.B "cta-smc -q D -v" .sp .nf .cs R 20 @@ -195,7 +209,7 @@ Drive Ordinal Element Addr. Status Vid To get the list of a few slots in the library: .br .RS -.B "smc -q S -S 20 -N 10 -v" +.B "cta-smc -q S -S 20 -N 10 -v" .sp .nf .cs R 20 @@ -217,7 +231,7 @@ Element Addr. Vid To get the status of volumes for which the vid starts with JK200 .br .RS -.B "smc -q V -V 'JK200*' -v" +.B "cta-smc -q V -V 'JK200*' -v" .sp .nf .cs R 20 @@ -257,4 +271,4 @@ JK2005 1031 drive .br 16 Robot busy. .SH AUTHOR -\fBCASTOR\fP Team <castor.support@cern.ch> +\fBCTA\fP Team diff --git a/mediachanger/castorrmc/rmc/cta-smc.conf b/mediachanger/castorrmc/rmc/cta-smc.conf new file mode 100644 index 0000000000000000000000000000000000000000..0d12e2d33606d1a8323bb3656d60584bdce4f910 --- /dev/null +++ b/mediachanger/castorrmc/rmc/cta-smc.conf @@ -0,0 +1,40 @@ +# The CERN Tape Archive (CTA) project +# Copyright (C) 2015 CERN +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +################################################################################ +# +# CTA Sample Configuration File +# +################################################################################ + +# The log mask. Logs with a level lower than this value will be masked. +# Possible values are: +# EMERG +# ALERT +# CRIT +# ERR +# WARNING +# NOTICE +# INFO +# DEBUG +# USERERR +# +# Please note that the USERERR log level is equivalent to NOTICE because it is +# a convention of CTA to use log level NOTICE to label user errors. +# +# taped LogMask INFO + + diff --git a/mediachanger/castorrmc/rmc/rmc_logit.c b/mediachanger/castorrmc/rmc/rmc_logit.c index cfd0a0f5d031fc1b0305b6e125e679e2a49fb9b7..c17e02eb0fec0fb3b9197119b72fd1ebff52cb6e 100644 --- a/mediachanger/castorrmc/rmc/rmc_logit.c +++ b/mediachanger/castorrmc/rmc/rmc_logit.c @@ -32,7 +32,7 @@ int rmc_logit(const char *const func, const char *const msg, ...) tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, jid, func); vsprintf (prtbuf+strlen(prtbuf), msg, args); va_end (args); - fd_log = open("/var/log/castor/rmcd_legacy.log", O_WRONLY | O_CREAT | O_APPEND, 0664); + fd_log = open("/var/log/cta/cta-rmcd.log", O_WRONLY | O_CREAT | O_APPEND, 0664); if (fd_log < 0) return -1; write (fd_log, prtbuf, strlen(prtbuf)); close (fd_log); diff --git a/mediachanger/castorrmc/rmc/rmc_serv.c b/mediachanger/castorrmc/rmc/rmc_serv.c index 01c7e5bdb47085bfd89fc0e46454722897209603..e96612482232addeeb889a16901a7faa4bd5398b 100644 --- a/mediachanger/castorrmc/rmc/rmc_serv.c +++ b/mediachanger/castorrmc/rmc/rmc_serv.c @@ -34,6 +34,8 @@ #include <sys/stat.h> #include "rmc_send_scsi_cmd.h" +#define PATH_CONF "cta-rmcd.conf" + /* Forward declaration */ static int rmc_getreq(const int s, int *const req_type, char *const req_data, char **const clienthost); @@ -136,7 +138,7 @@ int rmc_main(const char *const robot) sin.sin_family = AF_INET ; { const char *p; - if ((p = getenv ("RMC_PORT")) || (p = getconfent ("RMC", "PORT", 0))) { + if ((p = getenv ("RMC_PORT")) || (p = getconfent_fromfile (PATH_CONF,"RMC", "PORT", 0))) { sin.sin_port = htons ((unsigned short)atoi (p)); } else { sin.sin_port = htons ((unsigned short)RMC_PORT); @@ -228,7 +230,7 @@ int main(const int argc, switch(argc) { case 1: - fprintf(stderr, "RMC01 - robot parameter is mandatory\n"); + fprintf(stderr, "RMC01 - wrong arguments given ,specify the device file of the tape library\n"); exit (USERR); case 2: if(0 == nb_cmdline_options) { diff --git a/mediachanger/castorrmc/rmc/rmc_smcsubr.c b/mediachanger/castorrmc/rmc/rmc_smcsubr.c index 91e4a444442a0a71034abe2ba12a7e9c0bbd8b94..6b991df31a3a7c4fe4329ad9bf70f50bb4acee00 100644 --- a/mediachanger/castorrmc/rmc/rmc_smcsubr.c +++ b/mediachanger/castorrmc/rmc/rmc_smcsubr.c @@ -25,6 +25,7 @@ #include "smc_constants.h" #define RBT_XTRA_PROC 10 +#define PATH_CONF "cta-smc.conf" static struct smc_status smc_status; static const char *smc_msgaddr; @@ -442,7 +443,7 @@ int smc_find_cartridge( func[sizeof(func) - 1] = '\0'; /* Skip the 0xB6 cdb command if the tape library is Spectra like */ - smcLibraryType = getconfent("SMC","LIBRARY_TYPE",0); + smcLibraryType = getconfent_fromfile(PATH_CONF,"SMC","LIBRARY_TYPE",0); if (NULL != smcLibraryType && 0 == strcasecmp(smcLibraryType,"SPECTRA")) { rc = smc_find_cartridgeWithoutSendVolumeTag (fd, rbtdev, find_template, type, start, nbelem, diff --git a/mediachanger/castorrmc/rmc/rmcd.init b/mediachanger/castorrmc/rmc/rmcd.init deleted file mode 100755 index 4964dce80411feb44a568284f796791a92ced52f..0000000000000000000000000000000000000000 --- a/mediachanger/castorrmc/rmc/rmcd.init +++ /dev/null @@ -1,110 +0,0 @@ -#! /bin/sh -# -#/****************************************************************************** -# rmcd.init -# -# This file is part of the Castor project. -# See http://castor.web.cern.ch/castor -# -# Copyright (C) 2003 CERN -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# 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 General Public License for more details. -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# -# chkconfig: 345 71 34 -# description: RMC server daemon -# -# @author castor dev team -#*****************************************************************************/ - -# Source function library. -. /etc/rc.d/init.d/functions - -# Variables -prog="rmcd" -export DAEMON_COREFILE_LIMIT="unlimited" -RETVAL=0 - -# Source sysconfig files -if [ -f /etc/sysconfig/castor ]; then - . /etc/sysconfig/castor -fi -if [ -f /etc/sysconfig/$prog ]; then - . /etc/sysconfig/$prog -fi - -start() { - # Run daemon - echo -n $"Starting $prog: " - - cd /var/log/castor - daemon --user=stage /usr/bin/$prog $RMCD_OPTIONS - - # Write the pid to a file. - RETVAL=$? - if [ $RETVAL -eq 0 ]; then - pid=`ps -eo pid,ppid,comm | egrep " 1 $prog\$" | awk '{print $1}'` - rm -f /var/run/$prog.pid - if [ -n "$pid" ]; then - echo $pid > /var/run/$prog.pid - RETVAL=0 - else - RETVAL=1 - fi - fi - - [ $RETVAL -eq 0 ] && success $"$base startup" || failure $"$base startup" - echo - [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog - return $RETVAL -} - -stop() { - echo -n $"Stopping $prog: " - killproc $prog - - RETVAL=$? - echo - [ -f /var/lock/subsys/$prog ] && rm -f /var/lock/subsys/$prog - return $RETVAL -} - -restart() { - stop - start -} - -# See how we were called -case "$1" in - - start) - start - ;; - stop) - stop - ;; - status) - status $prog - RETVAL=$? - ;; - restart) - restart - ;; - condrestart) - [ -f /var/lock/subsys/$prog ] && restart || : - ;; - *) - echo $"Usage: $0 {start|stop|status|restart|condrestart}" - exit 1 -esac - -exit $RETVAL diff --git a/mediachanger/castorrmc/rmc/rmcd.sysconfig b/mediachanger/castorrmc/rmc/rmcd.sysconfig deleted file mode 100644 index 0c725a9118e0d8a171707ac43a65961c48f89949..0000000000000000000000000000000000000000 --- a/mediachanger/castorrmc/rmc/rmcd.sysconfig +++ /dev/null @@ -1,2 +0,0 @@ -# Options to pass to the rmc daemon -#RMCD_OPTIONS= diff --git a/mediachanger/castorrmc/rmc/send2rmc.c b/mediachanger/castorrmc/rmc/send2rmc.c index 129492d257f30d54f7bd4f40e04d5a3b68f766e0..6a445c6860c1ed681157272bc9ddc0ac11676580 100644 --- a/mediachanger/castorrmc/rmc/send2rmc.c +++ b/mediachanger/castorrmc/rmc/send2rmc.c @@ -17,6 +17,7 @@ #include "rmc_constants.h" #include "serrno.h" + #define PATH_CONF "cta-rmcd.conf" /* send2tpd - send a request to the SCSI media changer server and wait for the reply */ int send2rmc( @@ -30,6 +31,7 @@ int send2rmc( int c; char func[16]; char *getconfent(); + char *getconfent_fromfile(); char *getenv(); struct hostent *hp; int magic; @@ -44,7 +46,7 @@ int send2rmc( strncpy (func, "send2rmc", 16); sin.sin_family = AF_INET; - if ((p = getenv ("RMC_PORT")) || (p = getconfent ("RMC", "PORT", 0))) { + if ((p = getenv ("RMC_PORT")) || (p = getconfent_fromfile (PATH_CONF,"RMC", "PORT", 0))) { sin.sin_port = htons ((unsigned short)atoi (p)); } else { sin.sin_port = htons ((unsigned short)RMC_PORT); diff --git a/mediachanger/castorrmc/rmc/smc.c b/mediachanger/castorrmc/rmc/smc.c index ce31956a17d1613becc2aeb72b588c8a70ee65b0..54b229003d5055b6837df2852917423bb1d2b745 100644 --- a/mediachanger/castorrmc/rmc/smc.c +++ b/mediachanger/castorrmc/rmc/smc.c @@ -19,6 +19,7 @@ /* exit codes */ #define USERR 1 +#define PATH_CONF "cta-smc.conf" extern char *optarg; @@ -78,7 +79,7 @@ static int smc_qdrive ( printf ("Drive Ordinal\tElement Addr.\tStatus\t\tVid\n"); useSpectraLib=0; - smcLibraryType = getconfent("SMC","LIBRARY_TYPE",0); + smcLibraryType = getconfent_fromfile(PATH_CONF,"SMC","LIBRARY_TYPE",0); if (NULL != smcLibraryType && 0 == strcasecmp(smcLibraryType,"SPECTRA")) { useSpectraLib = 1; diff --git a/objectstore/BackendRados.cpp b/objectstore/BackendRados.cpp index 42443a9033611b8408f9587ce9831a2bc514af60..3a50e9ec2988bd5c9a0c9bb672239926240a5f1d 100644 --- a/objectstore/BackendRados.cpp +++ b/objectstore/BackendRados.cpp @@ -791,6 +791,9 @@ void BackendRados::AsyncLockfreeFetcher::fetchCallback(librados::completion_t co if (rados_aio_get_return_value(completion)<0) { cta::exception::Errnum errnum(-rados_aio_get_return_value(completion), std::string("In BackendRados::AsyncLockfreeFetcher::fetchCallback(): could not read object: ") + au.m_name); + if (errnum.errorNumber() == ENOENT) { + throw Backend::NoSuchObject(errnum.getMessageValue()); + } throw Backend::CouldNotFetch(errnum.getMessageValue()); } // The data is in the buffer list. diff --git a/scheduler/CMakeLists.txt b/scheduler/CMakeLists.txt index c01d9b2407a5a989e8b3fb35a0548e327b193cb9..7e621523cb3ee1f44eb6beedcbee7984e08b3def 100644 --- a/scheduler/CMakeLists.txt +++ b/scheduler/CMakeLists.txt @@ -43,6 +43,15 @@ add_library (ctaschedulerunittests SHARED set_property(TARGET ctaschedulerunittests PROPERTY SOVERSION "${CTA_SOVERSION}") set_property(TARGET ctaschedulerunittests PROPERTY VERSION "${CTA_LIBVERSION}") +if(CMAKE_COMPILER_IS_GNUCC) + # Add -Wno-unused-function compiler flag if using gcc version 7 or greater + if (GCC_VERSION VERSION_EQUAL 7 OR GCC_VERSION VERSION_GREATER 7) + set_property(SOURCE OStoreDB/OStoreDBTest.cpp APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-unused-function") + set_property(SOURCE SchedulerDatabaseTest.cpp APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-unused-function") + set_property(SOURCE SchedulerTest.cpp APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-unused-function") + endif (GCC_VERSION VERSION_EQUAL 7 OR GCC_VERSION VERSION_GREATER 7) +endif(CMAKE_COMPILER_IS_GNUCC) + target_link_libraries (ctaschedulerunittests ctascheduler) diff --git a/tapeserver/castor/tape/tapeserver/daemon/CMakeLists.txt b/tapeserver/castor/tape/tapeserver/daemon/CMakeLists.txt index 833043a9529965119462fac10c4858b1c2632442..991f3371b6eeab1c0a0f6f18380a98b52f0358f4 100644 --- a/tapeserver/castor/tape/tapeserver/daemon/CMakeLists.txt +++ b/tapeserver/castor/tape/tapeserver/daemon/CMakeLists.txt @@ -70,6 +70,11 @@ if(CMAKE_COMPILER_IS_GNUCC) set_property(SOURCE ${CTATAPESERVERDAEMON_LIBRARY_SRC} PROPERTY COMPILE_FLAGS " -Wno-unused-local-typedefs") endforeach(CTATAPESERVERDAEMON_LIBRARY_SRC) + + # Add -Wno-unused-function compiler flag if using gcc version 7 or greater + if (GCC_VERSION VERSION_EQUAL 7 OR GCC_VERSION VERSION_GREATER 7) + set_property(SOURCE DataTransferSessionTest.cpp APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-unused-function") + endif (GCC_VERSION VERSION_EQUAL 7 OR GCC_VERSION VERSION_GREATER 7) endif(GCC_VERSION_GE_4_8_0) endif(CMAKE_COMPILER_IS_GNUCC) @@ -93,6 +98,13 @@ add_library(ctatapeserverdaemonunittests SHARED set_property(TARGET ctatapeserverdaemonunittests PROPERTY SOVERSION "${CTA_SOVERSION}") set_property(TARGET ctatapeserverdaemonunittests PROPERTY VERSION "${CTA_LIBVERSION}") +if(CMAKE_COMPILER_IS_GNUCC) + # Add -Wno-unused-function compiler flag if using gcc version 7 or greater + if (GCC_VERSION VERSION_EQUAL 7 OR GCC_VERSION VERSION_GREATER 7) + set_property(SOURCE RecallReportPackerTest.cpp APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-unused-function") + endif (GCC_VERSION VERSION_EQUAL 7 OR GCC_VERSION VERSION_GREATER 7) +endif(CMAKE_COMPILER_IS_GNUCC) + target_link_libraries(ctatapeserverdaemonunittests ctamessagesutils) #ctaschedulerutils diff --git a/tapeserver/castor/tape/tapeserver/file/DiskFile.cpp b/tapeserver/castor/tape/tapeserver/file/DiskFile.cpp index 502a35aa13d065dba4de2a6a3c561b8c5072eb06..76e820b71fe7b4ded82f6bf00fb3fa36dd94da28 100644 --- a/tapeserver/castor/tape/tapeserver/file/DiskFile.cpp +++ b/tapeserver/castor/tape/tapeserver/file/DiskFile.cpp @@ -405,7 +405,11 @@ size_t XrootBaseReadFile::size() const { XrootBaseReadFile::~XrootBaseReadFile() throw() { try{ - m_xrootFile.Close(m_timeout); + // Use the result of Close() to avoid gcc >= 7 generating an unused-result + // warning (casting the result to void is not good enough for gcc >= 7) + if(!m_xrootFile.Close(m_timeout).IsOK()) { + // Ignore the error + } } catch (...) {} } @@ -502,7 +506,11 @@ void XrootBaseWriteFile::close() { XrootBaseWriteFile::~XrootBaseWriteFile() throw() { if(!m_closeTried){ - m_xrootFile.Close(m_timeout); + // Use the result of Close() to avoid gcc >= 7 generating an unused-result + // warning (casting the result to void is not good enough for gcc >= 7) + if(!m_xrootFile.Close(m_timeout).IsOK()) { + // Ignore the error + } } } @@ -543,7 +551,11 @@ size_t EosReadFile::size() const { EosReadFile::~EosReadFile() throw() { try{ - m_xrootFile.Close(m_timeout); + // Use the result of Close() to avoid gcc >= 7 generating an unused-result + // warning (casting the result to void is not good enough for gcc >= 7) + if(!m_xrootFile.Close(m_timeout).IsOK()) { + // Ignore the error + } } catch (...) {} } @@ -586,7 +598,11 @@ void EosWriteFile::close() { EosWriteFile::~EosWriteFile() throw() { if(!m_closeTried){ - m_xrootFile.Close(m_timeout); + // Use the result of Close() to avoid gcc >= 7 generating an unused-result + // warning (casting the result to void is not good enough for gcc >= 7) + if(!m_xrootFile.Close(m_timeout).IsOK()) { + // Ignore the error + } } } diff --git a/xroot_plugins/CMakeLists.txt b/xroot_plugins/CMakeLists.txt index 46d62cfa7bba2712d876a98208ad5330f33b72f6..58b19dea204a0779f694f76349294623350d6c44 100644 --- a/xroot_plugins/CMakeLists.txt +++ b/xroot_plugins/CMakeLists.txt @@ -27,7 +27,18 @@ include_directories(${PROTOBUF3_INCLUDE_DIRS}) # XRootD OFS plugin for CTA Frontend -add_library (XrdCtaOfs MODULE ListArchiveFilesCmd.cpp XrdCtaFilesystem.cpp XrdCtaFile.cpp XrdCtaDir.cpp) +add_library (XrdCtaOfs MODULE + ListArchiveFilesCmd.cpp + XrdCtaFilesystem.cpp + XrdCtaFile.cpp + XrdCtaDir.cpp) +if(CMAKE_COMPILER_IS_GNUCC) + # Add -Wno-implicit-fallthrough compiler flag if using gcc version 7 or greater + if (GCC_VERSION VERSION_EQUAL 7 OR GCC_VERSION VERSION_GREATER 7) + set_property(SOURCE XrdCtaFile.cpp APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-implicit-fallthrough") + endif (GCC_VERSION VERSION_EQUAL 7 OR GCC_VERSION VERSION_GREATER 7) +endif(CMAKE_COMPILER_IS_GNUCC) + set_property(TARGET XrdCtaOfs PROPERTY SOVERSION "${CTA_SOVERSION}") set_property(TARGET XrdCtaOfs PROPERTY VERSION "${CTA_LIBVERSION}") target_link_libraries (XrdCtaOfs ctacatalogue ctascheduler ctacommon ctaobjectstore cryptopp) diff --git a/xroot_plugins/messages/CMakeLists.txt b/xroot_plugins/messages/CMakeLists.txt index 994df8f0a29eb2de1ac9d22b46d4b2ecaa63e192..ec7f55fee1f8265b9867494442bfb1b5c9f9abbe 100644 --- a/xroot_plugins/messages/CMakeLists.txt +++ b/xroot_plugins/messages/CMakeLists.txt @@ -20,7 +20,15 @@ find_package(Protobuf3 REQUIRED) file(GLOB ProtoFiles "${CMAKE_CURRENT_SOURCE_DIR}/*.proto") PROTOBUF3_GENERATE_CPP(ProtoSources ProtoHeaders ${ProtoFiles}) foreach(PROTO_SRC ${ProtoSources}) - set_property(SOURCE ${PROTO_SRC} PROPERTY COMPILE_FLAGS " -Wno-missing-field-initializers -fPIC") + set_property(SOURCE ${PROTO_SRC} PROPERTY COMPILE_FLAGS " -Wno-missing-field-initializers -fPIC -Wno-narrowing -Wno-implicit-fallthrough") + + # Add -Wno-narrowing -Wno-implicit-fallthrough compiler flags if using gcc + # version 7 or greater + if (CMAKE_COMPILER_IS_GNUCC) + if (GCC_VERSION VERSION_EQUAL 7 OR GCC_VERSION VERSION_GREATER 7) + set_property(SOURCE ${PROTO_SRC} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-narrowing -Wno-implicit-fallthrough") + endif (GCC_VERSION VERSION_EQUAL 7 OR GCC_VERSION VERSION_GREATER 7) + endif (CMAKE_COMPILER_IS_GNUCC) endforeach(PROTO_SRC) set (CTA_FRONT_END_MESSAGES_SRC_FILES ${ProtoSources})