diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | cli/src/cli-cmd-peer.c | 1 | ||||
-rw-r--r-- | cli/src/cli-cmd-volume.c | 1 | ||||
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | events/Makefile.am | 4 | ||||
-rw-r--r-- | events/src/Makefile.am | 15 | ||||
-rw-r--r-- | events/src/eventsapiconf.py.in | 1 | ||||
-rw-r--r-- | events/src/gf_event.py | 5 | ||||
-rw-r--r-- | events/tools/Makefile.am | 5 | ||||
-rw-r--r-- | libglusterfs/src/Makefile.am | 14 | ||||
-rw-r--r-- | libglusterfs/src/events.c | 9 | ||||
-rw-r--r-- | libglusterfs/src/events.h (renamed from libglusterfs/src/events.h.in) | 16 | ||||
-rw-r--r-- | libglusterfs/src/glusterfs.h | 4 | ||||
-rw-r--r-- | xlators/features/bit-rot/src/bitd/bit-rot-scrub.c | 1 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd.h | 1 |
16 files changed, 49 insertions, 32 deletions
diff --git a/.gitignore b/.gitignore index 0563392f167..bd226c95d97 100644 --- a/.gitignore +++ b/.gitignore @@ -106,7 +106,6 @@ xlators/experimental/jbr-client/src/jbrc-cg.c xlators/experimental/jbr-server/src/jbr-cg.c # Eventing events/src/eventsapiconf.py -libglusterfs/src/events.h extras/systemd/glustereventsd.service events/src/eventtypes.py libglusterfs/src/eventtypes.h diff --git a/Makefile.am b/Makefile.am index c90c5f6c60e..51da7c16e7f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -12,7 +12,7 @@ EXTRA_DIST = autogen.sh \ SUBDIRS = $(ARGP_STANDALONE_DIR) libglusterfs rpc api xlators glusterfsd \ $(FUSERMOUNT_SUBDIR) doc extras cli heal @SYNCDAEMON_SUBDIR@ \ - @UMOUNTD_SUBDIR@ tools @EVENTS_SUBDIR@ + @UMOUNTD_SUBDIR@ tools events pkgconfigdir = @pkgconfigdir@ pkgconfig_DATA = glusterfs-api.pc libgfchangelog.pc diff --git a/cli/src/cli-cmd-peer.c b/cli/src/cli-cmd-peer.c index fc720756dc8..4802f71eca8 100644 --- a/cli/src/cli-cmd-peer.c +++ b/cli/src/cli-cmd-peer.c @@ -18,6 +18,7 @@ #include "cli-mem-types.h" #include "cli1-xdr.h" #include "protocol-common.h" +#include "events.h" extern struct rpc_clnt *global_rpc; diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c index c357ffe3130..fba928fcae9 100644 --- a/cli/src/cli-cmd-volume.c +++ b/cli/src/cli-cmd-volume.c @@ -26,6 +26,7 @@ #include "run.h" #include "syscall.h" #include "common-utils.h" +#include "events.h" extern struct rpc_clnt *global_rpc; extern struct rpc_clnt *global_quotad_rpc; diff --git a/configure.ac b/configure.ac index ebc9bd8fbe5..411f64aa485 100644 --- a/configure.ac +++ b/configure.ac @@ -38,7 +38,6 @@ AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([Makefile libglusterfs/Makefile libglusterfs/src/Makefile - libglusterfs/src/events.h libglusterfs/src/gfdb/Makefile geo-replication/src/peer_gsec_create geo-replication/src/peer_mountbroker diff --git a/events/Makefile.am b/events/Makefile.am index 04a74efc228..264bb742a80 100644 --- a/events/Makefile.am +++ b/events/Makefile.am @@ -1,6 +1,8 @@ SUBDIRS = src tools - +EXTRA_DIST = eventskeygen.py noinst_PYTHON = eventskeygen.py +if BUILD_EVENTS install-data-hook: $(INSTALL) -d -m 755 $(DESTDIR)@GLUSTERD_WORKDIR@/events +endif diff --git a/events/src/Makefile.am b/events/src/Makefile.am index 423bc8891fb..d292fbebc12 100644 --- a/events/src/Makefile.am +++ b/events/src/Makefile.am @@ -6,18 +6,21 @@ BUILT_SOURCES = eventtypes.py CLEANFILES = eventtypes.py eventsdir = $(libexecdir)/glusterfs/events +events_PYTHON = __init__.py gf_event.py eventsapiconf.py eventtypes.py \ + utils.py + +eventtypes.py: + $(PYTHON) $(top_srcdir)/events/eventskeygen.py PY_HEADER + +if BUILD_EVENTS eventspeerscriptdir = $(libexecdir)/glusterfs eventsconfdir = $(sysconfdir)/glusterfs eventsconf_DATA = eventsconfig.json -events_PYTHON = __init__.py eventsapiconf.py eventtypes.py handlers.py \ - utils.py gf_event.py +events_PYTHON += handlers.py events_SCRIPTS = glustereventsd.py eventspeerscript_SCRIPTS = peer_eventsapi.py -eventtypes.py: $(top_srcdir)/events/eventskeygen.py - $(PYTHON) $(top_srcdir)/events/eventskeygen.py PY_HEADER - install-exec-hook: $(mkdir_p) $(DESTDIR)$(sbindir) rm -f $(DESTDIR)$(sbindir)/glustereventsd @@ -30,3 +33,5 @@ install-exec-hook: uninstall-hook: rm -f $(DESTDIR)$(sbindir)/glustereventsd rm -f $(DESTDIR)$(sbindir)/gluster-eventsapi + +endif diff --git a/events/src/eventsapiconf.py.in b/events/src/eventsapiconf.py.in index 702e1d21820..03dd0e8d5d7 100644 --- a/events/src/eventsapiconf.py.in +++ b/events/src/eventsapiconf.py.in @@ -20,3 +20,4 @@ EVENTSD = "glustereventsd" CONFIG_KEYS = ["log_level"] BOOL_CONFIGS = [] RESTART_CONFIGS = [] +EVENTS_ENABLED = @EVENTS_ENABLED@ diff --git a/events/src/gf_event.py b/events/src/gf_event.py index 0924a65dddb..20dfc8a4f17 100644 --- a/events/src/gf_event.py +++ b/events/src/gf_event.py @@ -13,7 +13,7 @@ import socket import time -from eventsapiconf import SERVER_ADDRESS +from eventsapiconf import SERVER_ADDRESS, EVENTS_ENABLED from eventtypes import all_events from utils import logger, setup_logger @@ -23,6 +23,9 @@ setup_logger() def gf_event(event_type, **kwargs): + if EVENTS_ENABLED == 0: + return + if not isinstance(event_type, int) or event_type >= len(all_events): logger.error("Invalid Event Type: {0}".format(event_type)) return diff --git a/events/tools/Makefile.am b/events/tools/Makefile.am index 7d5e331e4e1..fb6770cf070 100644 --- a/events/tools/Makefile.am +++ b/events/tools/Makefile.am @@ -1,3 +1,6 @@ +EXTRA_DIST = eventsdash.py + +if BUILD_EVENTS scriptsdir = $(datadir)/glusterfs/scripts scripts_SCRIPTS = eventsdash.py -EXTRA_DIST = eventsdash.py +endif diff --git a/libglusterfs/src/Makefile.am b/libglusterfs/src/Makefile.am index 1fdd5a70fa4..d1ffbad5cc7 100644 --- a/libglusterfs/src/Makefile.am +++ b/libglusterfs/src/Makefile.am @@ -37,7 +37,7 @@ libglusterfs_la_SOURCES = dict.c xlator.c logging.c \ nodist_libglusterfs_la_SOURCES = y.tab.c graph.lex.c defaults.c nodist_libglusterfs_la_HEADERS = y.tab.h glusterfs-fops.h -BUILT_SOURCES = graph.lex.c defaults.c glusterfs-fops.h +BUILT_SOURCES = graph.lex.c defaults.c glusterfs-fops.h eventtypes.h libglusterfs_la_HEADERS = common-utils.h defaults.h default-args.h \ dict.h glusterfs.h hashfn.h timespec.h logging.h xlator.h \ @@ -51,7 +51,7 @@ libglusterfs_la_HEADERS = common-utils.h defaults.h default-args.h \ glfs-message-id.h template-component-messages.h strfd.h \ syncop-utils.h parse-utils.h libglusterfs-messages.h tw.h \ lvm-defaults.h quota-common-utils.h rot-buffs.h \ - compat-uuid.h upcall-utils.h throttle-tbf.h + compat-uuid.h upcall-utils.h throttle-tbf.h events.h libglusterfs_ladir = $(includedir)/glusterfs @@ -71,14 +71,12 @@ libglusterfs_la_SOURCES += $(CONTRIBDIR)/uuid/clear.c \ $(CONTRIBDIR)/uuid/unpack.c endif -if BUILD_EVENTS -BUILT_SOURCES += eventtypes.h -libglusterfs_la_SOURCES += events.c - -libglusterfs_la_HEADERS += events.h eventtypes.h -eventtypes.h: $(top_srcdir)/events/eventskeygen.py +eventtypes.h: $(PYTHON) $(top_srcdir)/events/eventskeygen.py C_HEADER + +if BUILD_EVENTS +libglusterfs_la_SOURCES += events.c endif libgfchangelog_HEADERS = changelog.h diff --git a/libglusterfs/src/events.c b/libglusterfs/src/events.c index 2df8c29026c..f93934de0fb 100644 --- a/libglusterfs/src/events.c +++ b/libglusterfs/src/events.c @@ -20,11 +20,15 @@ #include "mem-pool.h" #include "events.h" + +#define EVENT_PATH DATADIR "/run/gluster/events.sock" +#define EVENTS_MSG_MAX 2048 + + int -gf_event (int event, char *fmt, ...) +gf_event (eventtypes_t event, char *fmt, ...) { int ret = 0; -#if (USE_EVENTS) int sock = -1; char eventstr[EVENTS_MSG_MAX] = ""; struct sockaddr_un server; @@ -80,6 +84,5 @@ gf_event (int event, char *fmt, ...) out: sys_close(sock); GF_FREE(msg); -#endif return ret; } diff --git a/libglusterfs/src/events.h.in b/libglusterfs/src/events.h index 37692bef732..6b280a0066f 100644 --- a/libglusterfs/src/events.h.in +++ b/libglusterfs/src/events.h @@ -11,13 +11,17 @@ #ifndef __EVENTS_H__ #define __EVENTS_H__ -#include <stdio.h> - #include "eventtypes.h" -#define EVENT_PATH "@localstatedir@/run/gluster/events.sock" -#define EVENTS_MSG_MAX 2048 - -extern int gf_event(int key, char *fmt, ...); +#ifdef USE_EVENTS +int +gf_event (eventtypes_t event, char *fmt, ...); +#else +static inline int +gf_event (eventtypes_t event, char *fmt, ...) +{ + return 0; +} +#endif /* USE_EVENTS */ #endif /* __EVENTS_H__ */ diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h index d11cbdcb8ee..8d387bafb3b 100644 --- a/libglusterfs/src/glusterfs.h +++ b/libglusterfs/src/glusterfs.h @@ -37,10 +37,6 @@ #include "lkowner.h" #include "compat-uuid.h" -#if (USE_EVENTS) -#include "events.h" -#endif - #define GF_YES 1 #define GF_NO 0 diff --git a/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c b/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c index 65e9ed98d31..1db38e43ee8 100644 --- a/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c +++ b/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c @@ -20,6 +20,7 @@ #include <pthread.h> #include "bit-rot-bitd-messages.h" #include "bit-rot-scrub-status.h" +#include "events.h" struct br_scrubbers { pthread_t scrubthread; diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h index 909471401bb..77eded4f29c 100644 --- a/xlators/mgmt/glusterd/src/glusterd.h +++ b/xlators/mgmt/glusterd/src/glusterd.h @@ -36,6 +36,7 @@ #include "syncop.h" #include "store.h" #include "glusterd-rcu.h" +#include "events.h" #define GLUSTERD_TR_LOG_SIZE 50 #define GLUSTERD_SOCKET_LISTEN_BACKLOG 128 |