mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 02:33:34 +00:00
rebase: update vendored go-ceph to v0.6
Closes: #1547 Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
committed by
mergify[bot]
parent
268c0f1965
commit
29c78f97c0
24
vendor/github.com/ceph/go-ceph/rbd/snapshot.go
generated
vendored
24
vendor/github.com/ceph/go-ceph/rbd/snapshot.go
generated
vendored
@ -7,6 +7,8 @@ import "C"
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
|
||||
ts "github.com/ceph/go-ceph/internal/timespec"
|
||||
)
|
||||
|
||||
// Snapshot represents a snapshot on a particular rbd image.
|
||||
@ -160,3 +162,25 @@ func (snapshot *Snapshot) Set() error {
|
||||
|
||||
return getError(C.rbd_snap_set(snapshot.image.image, c_snapname))
|
||||
}
|
||||
|
||||
// GetSnapTimestamp returns the timestamp of a snapshot for an image.
|
||||
// For a non-existing snap ID, GetSnapTimestamp() may trigger an assertion
|
||||
// and crash in the ceph library.
|
||||
// Check https://tracker.ceph.com/issues/47287 for details.
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_snap_get_timestamp(rbd_image_t image, uint64_t snap_id, struct timespec *timestamp)
|
||||
func (image *Image) GetSnapTimestamp(snapID uint64) (Timespec, error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return Timespec{}, err
|
||||
}
|
||||
|
||||
var cts C.struct_timespec
|
||||
|
||||
ret := C.rbd_snap_get_timestamp(image.image, C.uint64_t(snapID), &cts)
|
||||
if ret < 0 {
|
||||
return Timespec{}, getError(ret)
|
||||
}
|
||||
|
||||
return Timespec(ts.CStructToTimespec(ts.CTimespecPtr(&cts))), nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user