Merge pull request #147 from Madhu-1/fix-snap

Fix snapshot time during snapshot create
This commit is contained in:
Róbert Vašek 2019-01-25 15:06:06 +01:00 committed by GitHub
commit 8cf869471f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,11 +21,11 @@ import (
"os" "os"
"os/exec" "os/exec"
"syscall" "syscall"
"time"
"github.com/ceph/ceph-csi/pkg/util" "github.com/ceph/ceph-csi/pkg/util"
"github.com/container-storage-interface/spec/lib/go/csi" "github.com/container-storage-interface/spec/lib/go/csi"
"github.com/golang/glog" "github.com/golang/glog"
"github.com/golang/protobuf/ptypes"
"github.com/golang/protobuf/ptypes/timestamp" "github.com/golang/protobuf/ptypes/timestamp"
"github.com/kubernetes-csi/drivers/pkg/csi-common" "github.com/kubernetes-csi/drivers/pkg/csi-common"
"github.com/pborman/uuid" "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 { if err := cs.MetadataStore.Create(snapshotID, rbdSnap); err != nil {
glog.Warningf("rbd: failed to store snapInfo with error: %v", err) glog.Warningf("rbd: failed to store snapInfo with error: %v", err)