From bd9adf99a2ca53dd18332957acb465f904ecd22c Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Fri, 6 Jan 2017 12:49:32 +0100 Subject: gfapi: add API to trigger events for debugging and troubleshooting Introduce glfs_sysrq() as a generic API for triggering debug and troubleshoot events. This interface will be used by the feature to get statedumps for applications using libgfapi. The current events that can be requested through this API are: - 'h'elp: log a mesage with all supported events - 's'tatedump: trigger a statedump for the passed glfs_t In future, this API can be used by a CLI to trigger statedumps from storage servers. At the moment it is limited to take statedumps, but it is extensible to set the log-level, clear caches, force reconnects and much more. > BUG: 1169302 > Change-Id: I18858359a3957870cea5139c79efe1365a15a992 > Original-author: Poornima G > Signed-off-by: Niels de Vos > Reviewed-on-master: http://review.gluster.org/16414 > Reviewed-by: Prashanth Pai > Reviewed-by: Kaleb KEITHLEY BUG: 1418981 Change-Id: I18858359a3957870cea5139c79efe1365a15a992 Signed-off-by: Shyam Reviewed-on: https://review.gluster.org/16600 Smoke: Gluster Build System Reviewed-by: Niels de Vos NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System --- api/src/glfs.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'api/src/glfs.h') diff --git a/api/src/glfs.h b/api/src/glfs.h index 730cff51f5a..397bb878434 100644 --- a/api/src/glfs.h +++ b/api/src/glfs.h @@ -772,6 +772,23 @@ glfs_fd_t *glfs_dup (glfs_fd_t *fd) __THROW void glfs_free (void *ptr) __THROW GFAPI_PUBLIC(glfs_free, 3.7.16); +/* + * glfs_sysrq: send a system request to the @fs instance + * + * Different commands for @sysrq are possible, the defines for these are listed + * below the function definition. + * + * This function always returns success if the @sysrq is recognized. The return + * value does not way anythin about the result of the @sysrq execution. Not all + * @sysrq command will be able to return a success/failure status. + */ +int glfs_sysrq (glfs_t *fs, char sysrq) __THROW + GFAPI_PUBLIC(glfs_sysrq, 3.10.0); + +#define GLFS_SYSRQ_HELP 'h' /* log a message with supported sysrq commands */ +#define GLFS_SYSRQ_STATEDUMP 's' /* create a statedump */ + + /* * Nobody needs this call at all yet except for the test script. */ -- cgit