rbd: add Image.GetModifyTimestamp()

Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Niels de Vos 2020-06-17 16:34:51 +02:00 committed by John Mulligan
parent 048ed11e63
commit 491f7827a8
1 changed files with 18 additions and 0 deletions

View File

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