-
Notifications
You must be signed in to change notification settings - Fork 554
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
journal: store CreationTime for VolumeGroups #4753
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,9 @@ import ( | |
"errors" | ||
"fmt" | ||
|
||
"github.com/container-storage-interface/spec/lib/go/csi" | ||
"google.golang.org/protobuf/types/known/timestamppb" | ||
|
||
"github.com/ceph/ceph-csi/internal/util" | ||
"github.com/ceph/ceph-csi/internal/util/log" | ||
) | ||
|
@@ -98,6 +101,27 @@ func cleanUpSnapshot( | |
return nil | ||
} | ||
|
||
func (rv *rbdVolume) toSnapshot() *rbdSnapshot { | ||
return &rbdSnapshot{ | ||
rbdImage: rbdImage{ | ||
ClusterID: rv.ClusterID, | ||
VolID: rv.VolID, | ||
Monitors: rv.Monitors, | ||
Pool: rv.Pool, | ||
JournalPool: rv.JournalPool, | ||
RadosNamespace: rv.RadosNamespace, | ||
RbdImageName: rv.RbdImageName, | ||
ImageID: rv.ImageID, | ||
CreatedAt: rv.CreatedAt, | ||
// copyEncryptionConfig cannot be used here because the volume and the | ||
// snapshot will have the same volumeID which cases the panic in | ||
// copyEncryptionConfig function. | ||
blockEncryption: rv.blockEncryption, | ||
fileEncryption: rv.fileEncryption, | ||
}, | ||
} | ||
} | ||
|
||
func (rbdSnap *rbdSnapshot) toVolume() *rbdVolume { | ||
return &rbdVolume{ | ||
rbdImage: rbdImage{ | ||
|
@@ -109,6 +133,7 @@ func (rbdSnap *rbdSnapshot) toVolume() *rbdVolume { | |
RadosNamespace: rbdSnap.RadosNamespace, | ||
RbdImageName: rbdSnap.RbdSnapName, | ||
ImageID: rbdSnap.ImageID, | ||
CreatedAt: rbdSnap.CreatedAt, | ||
// copyEncryptionConfig cannot be used here because the volume and the | ||
// snapshot will have the same volumeID which cases the panic in | ||
// copyEncryptionConfig function. | ||
|
@@ -118,6 +143,16 @@ func (rbdSnap *rbdSnapshot) toVolume() *rbdVolume { | |
} | ||
} | ||
|
||
func (rbdSnap *rbdSnapshot) ToCSI(ctx context.Context) (*csi.Snapshot, error) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's make use of it here ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh, sure, this function actually was not required to be included, it is part of my VolumeGroupSnapshot work. I'll include it here so that it all gets a little cleaner. |
||
return &csi.Snapshot{ | ||
SizeBytes: rbdSnap.VolSize, | ||
SnapshotId: rbdSnap.VolID, | ||
SourceVolumeId: rbdSnap.SourceVolumeID, | ||
CreationTime: timestamppb.New(*rbdSnap.CreatedAt), | ||
ReadyToUse: true, | ||
}, nil | ||
} | ||
|
||
func undoSnapshotCloning( | ||
ctx context.Context, | ||
parentVol *rbdVolume, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we check on this one, Does Unix is equivalent to GetSeconds()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes