From 82affca7273dd97f2a2fe6da07a9725d2a6f4e92 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Wed, 11 Mar 2015 23:59:00 -0400 Subject: [PATCH] pybind: add update_features to rbd.py Signed-off-by: Jason Dillaman --- src/pybind/rbd.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/pybind/rbd.py b/src/pybind/rbd.py index f0f58939d1189..239104fe6fd70 100644 --- a/src/pybind/rbd.py +++ b/src/pybind/rbd.py @@ -535,6 +535,24 @@ class Image(object): raise make_ex(ret, 'error getting features for image' % (self.name)) return features.value + def update_features(self, features, enabled): + """ + Updates the features bitmask of the image by enabling/disabling + a single feature. The feature must support the ability to be + dynamically enabled/disabled. + + :param features: feature bitmask to enable/disable + :type features: int + :param enabled: whether to enable/disable the feature + :type enabled: bool + :raises: :class:`InvalidArgument` + """ + ret = self.librbd.rbd_update_features(self.image, c_uint64(features), + c_uint8(enabled)); + if ret != 0: + raise make_ex(ret, 'error updating features for image %s' % + (self.name)) + def overlap(self): """ Gets the number of overlapping bytes between the image and its parent -- 2.39.5