summaryrefslogtreecommitdiffstats
path: root/src/pybind
diff options
context:
space:
mode:
authorJason Dillaman <dillaman@redhat.com>2017-06-22 02:51:52 +0200
committerGitHub <noreply@github.com>2017-06-22 02:51:52 +0200
commitfee2ea1c1c7e759665c56c09e371734413d8e8a6 (patch)
tree6011b7a85908d67e2eeef6c850413a6c46f2726e /src/pybind
parentMerge pull request #15444 from wjwithagen/wip-wjw-freebsd-termwidth (diff)
parenttest/cli-integration/rbd: verify formatting for image create timestamp (diff)
downloadceph-fee2ea1c1c7e759665c56c09e371734413d8e8a6.tar.xz
ceph-fee2ea1c1c7e759665c56c09e371734413d8e8a6.zip
Merge pull request #15757 from runsisi/wip-image-ts
librbd: add create timestamp metadata for image Reviewed-by: Jason Dillaman <dillaman@redhat.com>
Diffstat (limited to 'src/pybind')
-rw-r--r--src/pybind/rbd/rbd.pyx13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/pybind/rbd/rbd.pyx b/src/pybind/rbd/rbd.pyx
index ec090dba861..8de6b3cab84 100644
--- a/src/pybind/rbd/rbd.pyx
+++ b/src/pybind/rbd/rbd.pyx
@@ -228,6 +228,7 @@ cdef extern from "rbd/librbd.h" nogil:
uint8_t enabled)
int rbd_get_stripe_unit(rbd_image_t image, uint64_t *stripe_unit)
int rbd_get_stripe_count(rbd_image_t image, uint64_t *stripe_count)
+ int rbd_get_create_timestamp(rbd_image_t image, timespec *timestamp)
int rbd_get_overlap(rbd_image_t image, uint64_t *overlap)
int rbd_get_id(rbd_image_t image, char *id, size_t id_len)
int rbd_get_block_name_prefix(rbd_image_t image, char *prefix,
@@ -2166,6 +2167,18 @@ written." % (self.name, ret, length))
raise make_ex(ret, 'error getting stripe count for image %s' % (self.name))
return stripe_count
+ def create_timestamp(self):
+ """
+ Returns the create timestamp for the image.
+ """
+ cdef:
+ timespec timestamp
+ with nogil:
+ ret = rbd_get_create_timestamp(self.image, &timestamp)
+ if ret != 0:
+ raise make_ex(ret, 'error getting create timestamp for image: %s' % (self.name))
+ return datetime.fromtimestamp(timestamp.tv_sec)
+
def flatten(self):
"""
Flatten clone image (copy all blocks from parent to child)