rbd/features: add Image.UpdateFeatures()

Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Niels de Vos 2020-02-19 16:40:14 +01:00 committed by John Mulligan
parent 20031cf70f
commit 6284986e01
1 changed files with 17 additions and 0 deletions

View File

@ -106,3 +106,20 @@ func (image *Image) GetFeatures() (features uint64, err error) {
return features, nil
}
// UpdateFeatures updates the features on the Image.
//
// Implements:
// int rbd_update_features(rbd_image_t image, uint64_t features,
// uint8_t enabled);
func (image *Image) UpdateFeatures(features uint64, enabled bool) error {
if image.image == nil {
return RbdErrorImageNotOpen
}
cEnabled := C.uint8_t(0)
if enabled {
cEnabled = 1
}
return getError(C.rbd_update_features(image.image, C.uint64_t(features), cEnabled))
}