From 48ca11336e941652322475015f5159e26c528419 Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Fri, 25 Jan 2019 19:09:35 +0530 Subject: [PATCH] Fix snapshot time during snapshot create Fixes: #146 Signed-off-by: Madhu Rajanna --- pkg/rbd/controllerserver.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/rbd/controllerserver.go b/pkg/rbd/controllerserver.go index bccfe6e4a..9b0636485 100644 --- a/pkg/rbd/controllerserver.go +++ b/pkg/rbd/controllerserver.go @@ -21,11 +21,11 @@ import ( "os" "os/exec" "syscall" - "time" "github.com/ceph/ceph-csi/pkg/util" "github.com/container-storage-interface/spec/lib/go/csi" "github.com/golang/glog" + "github.com/golang/protobuf/ptypes" "github.com/golang/protobuf/ptypes/timestamp" "github.com/kubernetes-csi/drivers/pkg/csi-common" "github.com/pborman/uuid" @@ -325,7 +325,7 @@ func (cs *controllerServer) CreateSnapshot(ctx context.Context, req *csi.CreateS } } - rbdSnap.CreatedAt = time.Now().UnixNano() + rbdSnap.CreatedAt = ptypes.TimestampNow().GetSeconds() if err := cs.MetadataStore.Create(snapshotID, rbdSnap); err != nil { glog.Warningf("rbd: failed to store snapInfo with error: %v", err)