From 9f2bd89762a853b2af93d290db68017555ab6c1a Mon Sep 17 00:00:00 2001 From: Manikandan Selvaganesh Date: Mon, 22 Aug 2016 12:43:19 +0530 Subject: [PATCH 50/86] quota/cli: add user driven quota events This patch targets to capture all the user driven quota related events which are important to be notified. >Reviewed-on: http://review.gluster.org/15230 >Smoke: Gluster Build System >NetBSD-regression: NetBSD Build System >CentOS-regression: Gluster Build System >Reviewed-by: Atin Mukherjee Change-Id: I90c0af434363465e9dbdf6fca65ac220251d8d3c BUG: 1361078 Signed-off-by: Manikandan Selvaganesh Reviewed-on: https://code.engineering.redhat.com/gerrit/84797 Reviewed-by: Atin Mukherjee Tested-by: Atin Mukherjee --- cli/src/cli-cmd-volume.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++ events/eventskeygen.py | 13 ++++++++++++ 2 files changed, 60 insertions(+), 0 deletions(-) diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c index 0ea461e..27cb9dd 100644 --- a/cli/src/cli-cmd-volume.c +++ b/cli/src/cli-cmd-volume.c @@ -1707,6 +1707,53 @@ out: "logs for more details"); } + /* Events for Quota */ + if (ret == 0) { + switch (type) { + case GF_QUOTA_OPTION_TYPE_ENABLE: + gf_event (EVENT_QUOTA_ENABLE, "volume=%s", volname); + break; + case GF_QUOTA_OPTION_TYPE_DISABLE: + gf_event (EVENT_QUOTA_DISABLE, "volume=%s", volname); + break; + case GF_QUOTA_OPTION_TYPE_LIMIT_USAGE: + gf_event (EVENT_QUOTA_SET_USAGE_LIMIT, "volume=%s;" + "path=%s;limit=%s", volname, words[4], + words[5]); + break; + case GF_QUOTA_OPTION_TYPE_LIMIT_OBJECTS: + gf_event (EVENT_QUOTA_SET_OBJECTS_LIMIT, "volume=%s;" + "path=%s;limit=%s", volname, words[4], + words[5]); + break; + case GF_QUOTA_OPTION_TYPE_REMOVE: + gf_event (EVENT_QUOTA_REMOVE_USAGE_LIMIT, "volume=%s;" + "path=%s", volname, words[4]); + break; + case GF_QUOTA_OPTION_TYPE_REMOVE_OBJECTS: + gf_event (EVENT_QUOTA_REMOVE_OBJECTS_LIMIT, + "volume=%s;" "path=%s", volname, words[4]); + break; + case GF_QUOTA_OPTION_TYPE_ALERT_TIME: + gf_event (EVENT_QUOTA_ALERT_TIME, "volume=%s;time=%s", + volname, words[4]); + break; + case GF_QUOTA_OPTION_TYPE_SOFT_TIMEOUT: + gf_event (EVENT_QUOTA_SOFT_TIMEOUT, "volume=%s;" + "soft-timeout=%s", volname, words[4]); + break; + case GF_QUOTA_OPTION_TYPE_HARD_TIMEOUT: + gf_event (EVENT_QUOTA_HARD_TIMEOUT, "volume=%s;" + "hard-timeout=%s", volname, words[4]); + break; + case GF_QUOTA_OPTION_TYPE_DEFAULT_SOFT_LIMIT: + gf_event (EVENT_QUOTA_DEFAULT_SOFT_LIMIT, "volume=%s;" + "default-soft-limit=%s", volname, words[4]); + break; + } + } + + CLI_STACK_DESTROY (frame); return ret; } diff --git a/events/eventskeygen.py b/events/eventskeygen.py index 885c9de..144c554 100644 --- a/events/eventskeygen.py +++ b/events/eventskeygen.py @@ -69,6 +69,7 @@ keys = ( "EVENT_BRICKPATH_RESOLVE_FAILED", "EVENT_NOTIFY_UNKNOWN_OP", + "EVENT_QUORUM_LOST", "EVENT_QUORUM_REGAINED", "EVENT_REBALANCE_START_FAILED", @@ -78,6 +79,18 @@ keys = ( "EVENT_IMPORT_BRICK_FAILED", "EVENT_COMPARE_FRIEND_VOLUME_FAILED", "EVENT_NFS_GANESHA_EXPORT_FAILED", + + "EVENT_QUOTA_ENABLE", + "EVENT_QUOTA_DISABLE", + "EVENT_QUOTA_SET_USAGE_LIMIT", + "EVENT_QUOTA_SET_OBJECTS_LIMIT", + "EVENT_QUOTA_REMOVE_USAGE_LIMIT", + "EVENT_QUOTA_REMOVE_OBJECTS_LIMIT", + "EVENT_QUOTA_ALERT_TIME", + "EVENT_QUOTA_SOFT_TIMEOUT", + "EVENT_QUOTA_HARD_TIMEOUT", + "EVENT_QUOTA_DEFAULT_SOFT_LIMIT", + ) LAST_EVENT = "EVENT_LAST" -- 1.7.1