From 1ee21c1de593b865220012abeae47c482c29b0de Mon Sep 17 00:00:00 2001 From: zhucan Date: Wed, 22 Apr 2020 11:52:59 +0800 Subject: [PATCH] Add event for snapshotting in progress Signed-off-by: zhuc --- pkg/common-controller/snapshot_controller.go | 3 +++ pkg/common-controller/snapshot_create_test.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/common-controller/snapshot_controller.go b/pkg/common-controller/snapshot_controller.go index 8425b541..01ad966b 100644 --- a/pkg/common-controller/snapshot_controller.go +++ b/pkg/common-controller/snapshot_controller.go @@ -682,6 +682,9 @@ func (ctrl *csiSnapshotCommonController) createSnapshotContent(snapshot *crdv1.V return nil, newControllerUpdateError(utils.SnapshotKey(snapshot), err.Error()) } + msg := fmt.Sprintf("Waiting for a snapshot %s to be created by the CSI driver.", utils.SnapshotKey(snapshot)) + ctrl.eventRecorder.Event(snapshot, v1.EventTypeNormal, "CreatingSnapshot", msg) + // Update content in the cache store _, err = ctrl.storeContentUpdate(updateContent) if err != nil { diff --git a/pkg/common-controller/snapshot_create_test.go b/pkg/common-controller/snapshot_create_test.go index a9406165..bc7bce0d 100644 --- a/pkg/common-controller/snapshot_create_test.go +++ b/pkg/common-controller/snapshot_create_test.go @@ -206,7 +206,7 @@ func TestCreateSnapshotSync(t *testing.T) { {"update", "volumesnapshots", errors.New("mock update error")}, {"update", "volumesnapshots", errors.New("mock update error")}, }, - expectedEvents: []string{"Warning SnapshotStatusUpdateFailed"}, + expectedEvents: []string{"Normal CreatingSnapshot"}, expectSuccess: false, test: testSyncSnapshot, },