rbd: add Image.GetAccessTimestamp()

Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Niels de Vos 2020-06-17 16:26:58 +02:00 committed by John Mulligan
parent 8ef910e0c5
commit 0d9f802732
1 changed files with 18 additions and 0 deletions

View File

@ -65,3 +65,21 @@ func (image *Image) GetCreateTimestamp() (Timespec, error) {
return Timespec(ts.CStructToTimespec(ts.CTimespecPtr(&cts))), nil
}
// GetAccessTimestamp returns the time the rbd image was last accessed.
//
// Implements:
// int rbd_get_access_timestamp(rbd_image_t image, struct timespec *timestamp);
func (image *Image) GetAccessTimestamp() (Timespec, error) {
if err := image.validate(imageIsOpen); err != nil {
return Timespec{}, err
}
var cts C.struct_timespec
if ret := C.rbd_get_access_timestamp(image.image, &cts); ret < 0 {
return Timespec{}, getError(ret)
}
return Timespec(ts.CStructToTimespec(ts.CTimespecPtr(&cts))), nil
}