opt.add_option('--enable-etcd-reclock',
help=("Enable etcd recovery lock helper (default=no)"),
action="store_true", dest='ctdb_etcd_reclock', default=False)
+
+ opt.add_option('--with-libcephfs',
+ help=("Directory under which libcephfs is installed"),
+ action="store", dest='libcephfs_dir', default=None)
opt.add_option('--enable-ceph-reclock',
help=("Enable Ceph CTDB recovery lock helper (default=no)"),
action="store_true", dest='ctdb_ceph_reclock', default=False)
conf.env.etcd_reclock = have_etcd_reclock
if Options.options.ctdb_ceph_reclock:
+ # Use custom libcephfs library path if provided. XXX The top level build
+ # explicitly sets LIBPATH_CEPH-COMMON when libcephfs_dir isn't provided.
+ if Options.options.libcephfs_dir:
+ conf.env['CPPPATH_RADOS'] = Options.options.libcephfs_dir + '/include'
+ conf.env['LIBPATH_RADOS'] = Options.options.libcephfs_dir + '/lib'
+ conf.env['LIBPATH_CEPH-COMMON'] = conf.env['LIBPATH_RADOS'] + '/ceph'
+
if (conf.CHECK_HEADERS('rados/librados.h', False, False, 'rados') and
conf.CHECK_LIB('rados', shlib=True)):
+ conf.CHECK_LIB('ceph-common', shlib=True)
Logs.info('Building with Ceph librados recovery lock support')
conf.define('HAVE_LIBRADOS', 1)
else:
sys.exit(1)
conf.env.CTDB_BINDIR = os.path.join(conf.env.EXEC_PREFIX, 'bin')
+ conf.env.CTDB_DATADIR = os.path.join(conf.env.EXEC_PREFIX, 'share/ctdb')
conf.env.CTDB_ETCDIR = os.path.join(conf.env.SYSCONFDIR, 'ctdb')
conf.env.CTDB_VARDIR = os.path.join(conf.env.LOCALSTATEDIR, 'lib/ctdb')
conf.env.CTDB_RUNDIR = os.path.join(conf.env.LOCALSTATEDIR, 'run/ctdb')
conf.ADD_CFLAGS('''-DCTDB_HELPER_BINDIR=\"%s\"
-DLOGDIR=\"%s\"
+ -DCTDB_DATADIR=\"%s\"
-DCTDB_ETCDIR=\"%s\"
-DCTDB_VARDIR=\"%s\"
-DCTDB_RUNDIR=\"%s\"''' % (
conf.env.CTDB_HELPER_BINDIR,
conf.env.CTDB_LOGDIR,
+ conf.env.CTDB_DATADIR,
conf.env.CTDB_ETCDIR,
conf.env.CTDB_VARDIR,
conf.env.CTDB_RUNDIR))
- conf.env.CTDB_TEST_DATADIR = os.path.join(conf.env.EXEC_PREFIX,
- 'share/ctdb/tests')
+ conf.env.CTDB_TEST_DATADIR = os.path.join(conf.env.CTDB_DATADIR, 'tests')
conf.env.CTDB_TEST_LIBEXECDIR = os.path.join(conf.env.LIBEXECDIR, 'ctdb/tests')
# Allow unified compilation and separate compilation of utilities
pkt_read.c pkt_write.c comm.c
logging.c rb_tree.c tunable.c
pidfile.c run_proc.c
- hash_count.c run_event.c
+ hash_count.c
+ run_event.c event_script.c
sock_client.c version.c
- cmdline.c path.c conf.c
+ cmdline.c path.c conf.c line.c
'''),
deps='''samba-util sys_rw tevent-util
replace talloc tevent tdb popt''')
protocol_tunnel.c
protocol_client.c
protocol_debug.c
- protocol_event.c
protocol_sock.c'''),
includes='include',
deps='ctdb-protocol-basic replace talloc tdb')
bld.SAMBA_SUBSYSTEM('ctdb-protocol-util',
source='protocol/protocol_util.c',
- deps='replace talloc tdb')
+ deps='ctdb-util replace talloc tdb')
bld.SAMBA_SUBSYSTEM('ctdb-client',
source=bld.SUBDIR('client',
client_message_sync.c
client_control_sync.c
client_db.c client_util.c
- client_event.c client_tunnel.c
+ client_tunnel.c
'''),
includes='include',
deps='replace talloc tevent tdb tdb-wrap')
bld.SAMBA_SUBSYSTEM('ctdb-server-util',
source=bld.SUBDIR('common',
'''sock_daemon.c'''),
- deps='''samba-util ctdb-util tevent-util
+ deps='''samba-util ctdb-util ctdb-system tevent-util
LIBASYNC_REQ replace talloc tevent''')
bld.SAMBA_SUBSYSTEM('ctdb-ipalloc',
source='event/event_conf.c',
deps='ctdb-util')
+ bld.SAMBA_SUBSYSTEM('ctdb-failover-conf',
+ source='failover/failover_conf.c',
+ deps='ctdb-util')
+
bld.SAMBA_SUBSYSTEM('ctdb-legacy-conf',
source='server/legacy_conf.c',
deps='ctdb-util')
ctdb-event-conf
ctdb-cluster-conf
ctdb-database-conf
+ ctdb-failover-conf
ctdb-legacy-conf
ctdb-util samba-util talloc replace popt''',
install_path='${CTDB_HELPER_BINDIR}')
+ bld.SAMBA_SUBSYSTEM('ctdb-event-protocol',
+ source=bld.SUBDIR('event',
+ '''event_protocol.c
+ event_protocol_util.c
+ '''),
+ deps='ctdb-protocol-basic')
+
+ bld.SAMBA_LIBRARY('ctdb-event-client',
+ source='event/event_client.c',
+ deps='ctdb-event-protocol ctdb-util tevent talloc',
+ private_library=True)
+
+ bld.SAMBA_BINARY('ctdb-eventd',
+ source=bld.SUBDIR('event',
+ '''event_cmd.c
+ event_config.c
+ event_context.c
+ event_daemon.c
+ event_request.c
+ '''),
+ deps='''ctdb-event-protocol
+ ctdb-event-conf ctdb-logging-conf
+ ctdb-server-util samba-util ctdb-util
+ talloc tevent replace popt''',
+ install_path='${CTDB_HELPER_BINDIR}')
+
+ bld.SAMBA_BINARY('ctdb-event',
+ source='event/event_tool.c',
+ cflags='-DCTDB_EVENT_TOOL',
+ deps='''ctdb-event-client ctdb-event-protocol
+ ctdb-util samba-util talloc replace''',
+ install_path='${CTDB_HELPER_BINDIR}')
+
bld.SAMBA_BINARY('ctdbd',
source='server/ctdbd.c ' +
bld.SUBDIR('server',
ctdb-cluster-conf
ctdb-database-conf
ctdb-event-conf
+ ctdb-failover-conf
ctdb-legacy-conf
+ ctdb-event-protocol
talloc tevent tdb-wrap tdb talloc_report''' +
ib_deps,
install_path='${SBINDIR}',
samba-util replace''',
install_path='${CTDB_HELPER_BINDIR}')
- bld.SAMBA_BINARY('ctdb_event',
- source='tools/ctdb_event.c',
- deps='''ctdb-client ctdb-protocol ctdb-protocol-util
- ctdb-util ctdb-system samba-util replace''',
- install_path='${CTDB_HELPER_BINDIR}')
-
bld.SAMBA_BINARY('ltdbtool',
source='tools/ltdbtool.c',
includes='include',
install_path='${BINDIR}',
manpages='ltdbtool.1')
- bld.SAMBA_BINARY('ctdb_eventd',
- source='server/ctdb_eventd.c',
- deps='''ctdb-server-util ctdb-protocol ctdb-protocol-util
- ctdb-util samba-util replace popt''',
- install_path='${CTDB_HELPER_BINDIR}')
-
bld.SAMBA_BINARY('ctdb_lock_helper',
source='server/ctdb_lock_helper.c',
deps='''samba-util sys_rw ctdb-system tevent-util
if bld.env.HAVE_LIBRADOS:
bld.SAMBA_BINARY('ctdb_mutex_ceph_rados_helper',
source='utils/ceph/ctdb_mutex_ceph_rados_helper.c',
- deps='talloc tevent rados',
+ deps='talloc tevent rados ceph-common',
includes='include',
install_path='${CTDB_HELPER_BINDIR}')
sed_expr5 = 's|/usr/local/sbin|%s|g' % (bld.env.SBINDIR)
sed_expr6 = 's|/usr/local/libexec/ctdb|%s|g' % (bld.env.CTDB_HELPER_BINDIR)
sed_expr7 = 's|/usr/local/bin|%s|g' % (bld.env.BINDIR)
- sed_cmdline = '-e "%s" -e "%s" -e "%s" -e "%s" -e "%s" -e "%s" -e "%s"' % \
+ sed_expr8 = 's|/usr/local/share/ctdb|%s|g' % (bld.env.CTDB_DATADIR)
+ sed_cmdline = '-e "%s" ' * 8 % \
(sed_expr1, sed_expr2, sed_expr3, sed_expr4, sed_expr5,
- sed_expr6, sed_expr7)
+ sed_expr6, sed_expr7, sed_expr8)
manpages_extra = manpages_misc
if bld.env.etcd_reclock:
os.path.walk(path, SUBDIR_MODE_callback, pd)
return pd['file_list']
- etc_subdirs = [
+ event_script_subdirs = [
'events/legacy',
+ ]
+
+ etc_subdirs = [
'nfs-checks.d'
]
else:
configdir = 'ctdb/config'
+ for t in event_script_subdirs:
+ bld.INSTALL_DIR(os.path.join(bld.env.CTDB_ETCDIR, t))
+ files = SUBDIR_MODE('%s/%s' % (configdir, t), trim_path=configdir)
+ for fmode in files:
+ bld.INSTALL_FILES(bld.env.CTDB_DATADIR, 'config/%s' % fmode[0],
+ destname=fmode[0], chmod=fmode[1])
+
for t in etc_subdirs:
files = SUBDIR_MODE('%s/%s' % (configdir, t), trim_path=configdir)
for fmode in files:
bld.INSTALL_FILES(bld.env.CTDB_ETCDIR, 'config/%s' % fmode[0],
destname=fmode[0], chmod=fmode[1])
+ # If this is a direct install and there are no event scripts
+ # linked/enabled then enable some standard ones
+ if os.environ.get('DESTDIR') is None:
+ fmt = 'events/legacy/%s.script'
+ required_script = '00.ctdb'
+ required_path = os.path.join(bld.env.CTDB_ETCDIR,
+ fmt % (required_script))
+ if not os.path.islink(required_path) and \
+ not os.path.exists(required_path):
+ default_scripts = [ required_script,
+ '01.reclock',
+ '05.system',
+ '10.interface',
+ ]
+ for t in default_scripts:
+ tgt = os.path.join(bld.env.CTDB_DATADIR, fmt % (t))
+ name = os.path.join(bld.env.CTDB_ETCDIR, fmt % (t))
+ bld.symlink_as(name, tgt)
+
bld.SAMBA_GENERATOR('ctdb-functions',
source='config/functions',
target='functions',
for d in ['volatile', 'persistent', 'state']:
bld.install_dir(os.path.join(bld.env.CTDB_VARDIR, d))
+ bld.SAMBA_BINARY('errcode',
+ source='tests/src/errcode.c',
+ deps='replace',
+ install_path='${CTDB_TEST_LIBEXECDIR}')
+
+ bld.SAMBA_BINARY('sigcode',
+ source='tests/src/sigcode.c',
+ deps='replace',
+ install_path='${CTDB_TEST_LIBEXECDIR}')
+
# Unit tests
ctdb_unit_tests = [
'db_hash_test',
'comm_client_test',
'pidfile_test',
'run_proc_test',
- 'sock_daemon_test',
'sock_io_test',
'hash_count_test',
'run_event_test',
'cmdline_test',
'conf_test',
+ 'line_test',
+ 'event_script_test',
]
for target in ctdb_unit_tests:
deps='samba-util ctdb-system popt',
install_path='${CTDB_TEST_LIBEXECDIR}')
+ bld.SAMBA_BINARY('sock_daemon_test',
+ source='tests/src/sock_daemon_test.c',
+ deps='''ctdb-system talloc tevent tevent-util
+ LIBASYNC_REQ samba-util sys_rw''',
+ install_path='${CTDB_TEST_LIBEXECDIR}')
+
bld.SAMBA_SUBSYSTEM('ctdb-protocol-tests-basic',
source=bld.SUBDIR('tests/src',
'protocol_common_basic.c'),
source=bld.SUBDIR('tests/src',
'''protocol_common.c
protocol_common_ctdb.c
- protocol_common_event.c
'''),
includes='include',
deps='ctdb-protocol-tests-basic replace talloc tdb')
ctdb_protocol_tests = [
'protocol_types_test',
'protocol_ctdb_test',
- 'protocol_event_test',
'protocol_util_test',
'protocol_types_compat_test',
'protocol_ctdb_compat_test',
bld.SAMBA_BINARY(target,
source=src,
deps='''ctdb-protocol-tests-common
- samba-util talloc tdb''',
+ samba-util ctdb-util talloc tdb''',
install_path='${CTDB_TEST_LIBEXECDIR}')
+ bld.SAMBA_BINARY('event_protocol_test',
+ source='event/event_protocol_test.c',
+ deps='''ctdb-protocol-tests-basic
+ ctdb-protocol-basic talloc''',
+ install_path='${CTDB_TEST_LIBEXECDIR}')
+
bld.SAMBA_SUBSYSTEM('ctdb-tests-common',
source=bld.SUBDIR('tests/src',
'cluster_wait.c test_options.c'),
test_subdirs = [
'complex',
+ 'ctdb_eventd',
'cunit',
'eventd',
'eventscripts',