From 69942154e197d753580b74cc7f8e6bce470ee673 Mon Sep 17 00:00:00 2001 From: Avra Sengupta Date: Thu, 20 Aug 2015 14:40:29 +0530 Subject: snapshot: Log deletion of snapshot, during auto-delete When auto-delete is enabled, and soft-limit is reached, on creation of a snapshot, the oldest snapshot for that volume is deleted. Displaying a warning log before deleting the oldest snapshot. Change-Id: I75f0366935966a223b63a4ec5ac13f9fe36c0e82 BUG: 1255310 Signed-off-by: Avra Sengupta Reviewed-on: http://review.gluster.org/11963 Tested-by: NetBSD Build System Reviewed-by: mohammed rafi kc Reviewed-by: Rajesh Joseph --- xlators/mgmt/glusterd/src/glusterd-messages.h | 2 +- xlators/mgmt/glusterd/src/glusterd-snapshot.c | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/xlators/mgmt/glusterd/src/glusterd-messages.h b/xlators/mgmt/glusterd/src/glusterd-messages.h index 7b0a8692e1c..1282787410c 100644 --- a/xlators/mgmt/glusterd/src/glusterd-messages.h +++ b/xlators/mgmt/glusterd/src/glusterd-messages.h @@ -771,7 +771,7 @@ * @recommendedaction * */ -#define GD_MSG_SNAPSHOT_OP_SUCCESS (GLUSTERD_COMP_BASE + 91) +#define GD_MSG_OP_SUCCESS (GLUSTERD_COMP_BASE + 91) /*! * @messageid diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c index 734c1cd22cb..b18c4699b68 100644 --- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c +++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c @@ -5970,7 +5970,7 @@ glusterd_snapshot_remove_commit (dict_t *dict, char **op_errstr, goto out; } else gf_msg (this->name, GF_LOG_INFO, 0, - GD_MSG_SNAPSHOT_OP_SUCCESS, "Successfully marked " + GD_MSG_OP_SUCCESS, "Successfully marked " "snap %s for decommission.", snap->snapname); if (is_origin_glusterd (dict) == _gf_true) { @@ -7723,6 +7723,12 @@ glusterd_handle_snap_limit (dict_t *dict, dict_t *rsp_dict) snap = tmp_volinfo->snapshot; GF_ASSERT (snap); + gf_msg (this->name, GF_LOG_WARNING, 0, + GD_MSG_SOFT_LIMIT_REACHED, "Soft-limit " + "(value = %"PRIu64") of volume %s is reached. " + "Deleting snapshot %s.", limit, volinfo->volname, + snap->snapname); + LOCK (&snap->lock); { snap->snap_status = GD_SNAP_STATUS_DECOMMISSION; -- cgit