Commit ac75a49b authored by Alberto Miranda's avatar Alberto Miranda ♨️
Browse files

Improve daemon and library configuration

- Changed the format of the global service configuration file to a
YAML-like format
- Urd daemon is now able to read its configuration from the
newly-formatted configuration file.
- Companion libraries linorns and libnornsctl are now capable of
reading their configuration from the global service configuration file.
- Libraries now encapsulate their state in a context structure shared
by all threads rather than in globals.
- Tests are only built now if the --enable-tests option is passed
when invoking configure
- Tests updated to patch the libraries on the fly in order to use
case-by-case configuration files.
- Tests now only cleanup their internal data if the test succeeds.
parent 7f65e5e5
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -27,6 +27,10 @@

ACLOCAL_AMFLAGS = -I m4

SUBDIRS = etc lib include examples src tests
SUBDIRS = etc lib include examples src

if BUILD_TESTS
SUBDIRS += tests
endif

DIST_SUBDIRS = lib examples
+3 −1
Original line number Diff line number Diff line
@@ -8,14 +8,16 @@ Build dependencies:
- libboost-filesystem >= 1.53
- libboost-program-options >= 1.53
- libboost-thread >= 1.53
- libboost-regex >= 1.53 (only if self tests are also built)
- libprotobuf + protobuf compiler >= 2.5.0
- libprotobuf-c + protobuf-c compiler >= 1.0.2
- libyaml-cpp >= 0.5.1
- libyaml >= 0.1.4


- Installation in CentOS 7
git clone git@git.ph.ed.ac.uk:nextgenio/norns.git && cd norns
./bootstrap
./bootstrap.sh
mkdir <build-dir>
cd <build-dir>
./configure --prefix=<install-dir> --sysconfdir=<config-dir>
+50 −8
Original line number Diff line number Diff line
@@ -25,12 +25,12 @@
#  <http://www.gnu.org/licenses/>.                                       #
##########################################################################

AC_INIT([Norn-s loom], [1.0], [arnau.bagocastro at bsc.es])
AC_INIT([norns], [1.0], [alberto.miranda@bsc.es])
AC_PREREQ([2.69])
AC_CONFIG_SRCDIR([src/config.h.in])
AC_CONFIG_SRCDIR([config.h.in])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_HEADERS([src/config.h])
AC_CONFIG_HEADERS([config.h])

AM_INIT_AUTOMAKE([1.9 foreign subdir-objects])

@@ -47,9 +47,6 @@ AX_CHECK_COMPILE_FLAG([-std=c++11], [CXXFLAGS+=" -std=c++11"], [
    exit -1
])

# Checks for libraries.I


# check for pkg-config
PKG_PROG_PKG_CONFIG

@@ -64,7 +61,35 @@ then
 * If it is installed but not in the PATH then you may want to set the PKG_CONFIG variable])
fi

# check for some BOOST libraries
################################################################################
### check whether tests should be built
################################################################################
is_enabled_build_tests="no"

AC_ARG_ENABLE([tests],
    AS_HELP_STRING([--enable-tests], [Build norns self tests]), 
    [
        if test x$enableval = xyes -o x$enableval = x;
        then
            is_enabled_build_tests="yes"
        else if test x$enableval = xno -o x$enableval = x;
            then
                is_enabled_build_tests="no"
            else
                AC_MSG_ERROR([This option can only be given 'yes' or 'no' values])
            fi
        fi
    ],
    [ is_enabled_build_tests="no" ])

AM_CONDITIONAL([BUILD_TESTS], test x$is_enabled_build_tests = xyes)


################################################################################
### check for dependencies
################################################################################

# check for base BOOST libraries
AX_BOOST_BASE([1.53],, [
    AC_MSG_ERROR([
        This software requires BOOST >= 1.53, but it was not found in your system
@@ -76,6 +101,12 @@ AX_BOOST_ASIO
AX_BOOST_PROGRAM_OPTIONS
AX_BOOST_THREAD

# only check for boost_regex if we are building tests
AS_IF([test "x$is_enabled_build_tests" = "xyes"], 
      [ AX_BOOST_REGEX 
        AC_CONFIG_FILES(tests/Makefile)
      ], [])

# check for libyaml-cpp
PKG_CHECK_MODULES([YAMLCPP], [yaml-cpp >= 0.5.1])

@@ -93,12 +124,24 @@ AC_CHECK_PROG([PROTOC], [protoc], [protoc])
AS_IF([test "x${PROTOC}" == "x"],
          [AC_MSG_ERROR([ProtoBuf compiler "protoc" not found.])])


# check for libyaml (manually since it doesn't provide a pkgconfig file)
AC_SEARCH_LIBS([yaml_parser_initialize], [yaml], 
               [YAML_LIBS="-lyaml"
                AC_SUBST(YAML_LIBS)], 
               [AC_MSG_ERROR([This software required libyaml >= 0.1.4])])

# Checks for header files.

# Checks for typedefs, structures, and compiler characteristics.
AC_CHECK_HEADER_STDBOOL

# Checks for library functions.


################################################################################
### write makefiles
################################################################################
AC_CONFIG_FILES([
        Makefile
        etc/Makefile
@@ -106,6 +149,5 @@ AC_CONFIG_FILES([
        include/Makefile
        lib/Makefile
        src/Makefile
        tests/Makefile
])
AC_OUTPUT
+8 −3
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@
#  <http://www.gnu.org/licenses/>.                                       #
##########################################################################

ETC_FILES = norns.service
ETC_FILES=norns.service norns.conf

CLEANFILES=$(ETC_FILES)

@@ -33,10 +33,15 @@ edit = sed \
        -e 's|@bindir[@]|$(bindir)|g' \
		-e 's|@libdir[@]|$(libdir)|g' \
		-e 's|@sbindir[@]|$(sbindir)|g' \
		-e 's|@sysconfdir[@]|$(sysconfdir)|g'
		-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
		-e 's|@localstatedir[@]|$(localstatedir)|g'


noinst_DATA=$(ETC_FILES)
#noinst_DATA=$(ETC_FILES)
sysconf_DATA=$(ETC_FILES)

norns.service: Makefile $(srcdir)/norns.service.in
	$(edit) $(srcdir)/norns.service.in > norns.service

norns.conf: Makefile $(srcdir)/norns.conf.in
	$(edit) $(srcdir)/norns.conf.in > norns.conf

etc/norns.conf.in

0 → 100644
+47 −0
Original line number Diff line number Diff line
## vim: set filetype=yaml:

## global service settings
global_settings: [

  # dump log messages to syslog
  use_syslog: false,

  # path to globally-accessible socket
  global_socket: "@localstatedir@/global.socket.2" ,

  # path to admin-accessible socket
  control_socket: "@localstatedir@/control.socket.2",

  # path to pidfile
  pidfile: "@localstatedir@/urd.pid",
  
  # incoming port for remote connections
  remote_port: 42000,
  
  # number of worker threads to serve I/O requests
  workers: 4
]

## list of namespaces available by default when service starts
namespaces: [

  # lustre namespace
  [
    nsid: "lustre0",
    mountpoint: "/mnt/lustre0",
    type: "POSIX/SHARED",
    capacity: "5 GiB",
    visibility: "all"
  ],

  # local namespace
  [
    nsid: "scratch0",
    mountpoint: "/mnt/scratch0",
    type: "POSIX/LOCAL",
    capacity: "25 GiB",
    visibility: "none"
  ],


]
Loading