mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
rebase: remove protobuf dependency locking
this commit remove the protobuf dependency locking in the module description. Also, ptypes.TimestampProto is deprecated and this commit make use of the timestamppb.New() for the construction. ParseTime() function has been removed and callers adjusted to the same. Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
committed by
mergify[bot]
parent
d772fc098c
commit
71c4ae542c
@ -32,7 +32,8 @@ import (
|
||||
rterrors "github.com/ceph/ceph-csi/internal/util/reftracker/errors"
|
||||
|
||||
"github.com/container-storage-interface/spec/lib/go/csi"
|
||||
"github.com/golang/protobuf/ptypes/timestamp"
|
||||
"google.golang.org/protobuf/types/known/timestamppb"
|
||||
|
||||
"github.com/kubernetes-csi/csi-lib-utils/protosanitizer"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
@ -914,12 +915,7 @@ func (cs *ControllerServer) doSnapshot(
|
||||
|
||||
return snap, fmt.Errorf("failed to get snapshot info for snapshot:%s", snapID)
|
||||
}
|
||||
var t *timestamp.Timestamp
|
||||
t, err = fsutil.ParseTime(ctx, snap.CreatedAt)
|
||||
if err != nil {
|
||||
return snap, err
|
||||
}
|
||||
snap.CreationTime = t
|
||||
snap.CreationTime = timestamppb.New(snap.CreatedAt)
|
||||
err = snapClient.ProtectSnapshot(ctx)
|
||||
if err != nil {
|
||||
log.ErrorLog(ctx, "failed to protect snapshot %s %v", snapID, err)
|
||||
|
@ -29,6 +29,7 @@ import (
|
||||
"github.com/ceph/ceph-csi/internal/util/log"
|
||||
|
||||
"github.com/golang/protobuf/ptypes/timestamp"
|
||||
"google.golang.org/protobuf/types/known/timestamppb"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -430,12 +431,8 @@ func CheckSnapExists(
|
||||
}
|
||||
}
|
||||
}()
|
||||
tm, err := fsutil.ParseTime(ctx, snapInfo.CreatedAt)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
sid.CreationTime = timestamppb.New(snapInfo.CreatedAt)
|
||||
|
||||
sid.CreationTime = tm
|
||||
// found a snapshot already available, process and return it!
|
||||
sid.SnapshotID, err = util.GenerateVolID(ctx, volOptions.Monitors, cr, volOptions.FscID,
|
||||
"", volOptions.ClusterID, snapUUID, fsutil.VolIDVersion)
|
||||
|
@ -16,16 +16,6 @@ limitations under the License.
|
||||
|
||||
package util
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/ceph/ceph-csi/internal/util/log"
|
||||
|
||||
"github.com/golang/protobuf/ptypes"
|
||||
"github.com/golang/protobuf/ptypes/timestamp"
|
||||
)
|
||||
|
||||
// VolumeID string representation.
|
||||
type VolumeID string
|
||||
|
||||
@ -36,14 +26,3 @@ const (
|
||||
// RadosNamespace to store CSI specific objects and keys.
|
||||
RadosNamespace = "csi"
|
||||
)
|
||||
|
||||
func ParseTime(ctx context.Context, createTime time.Time) (*timestamp.Timestamp, error) {
|
||||
tm, err := ptypes.TimestampProto(createTime)
|
||||
if err != nil {
|
||||
log.ErrorLog(ctx, "failed to convert time %s %v", createTime, err)
|
||||
|
||||
return tm, err
|
||||
}
|
||||
|
||||
return tm, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user