]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/rbd: parse access and modify timestamps in UTC 57990/head
authorIlya Dryomov <idryomov@gmail.com>
Wed, 5 Jun 2024 06:36:12 +0000 (08:36 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Thu, 20 Jun 2024 10:53:18 +0000 (12:53 +0200)
It appears that commits 08cee16d0a4b ("pybind/rbd: always parse
timestamps in UTC") and 809c5430c292 ("librbd: add image access/last
modified timestamps") raced with each other and we ended up with two
more timezone-dependent timestamps.

Fixes: https://tracker.ceph.com/issues/66359
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
(cherry picked from commit fafa911b51199f61d0c97bc6dfc71d4f65134db4)

PendingReleaseNotes
src/pybind/rbd/rbd.pyx

index 1f0260b395fc481d2eea814f2583ebae86f75f9b..0898697b2ed456361d2f866410516f5585797c03 100644 (file)
@@ -209,6 +209,8 @@ CephFS: Disallow delegating preallocated inode ranges to clients. Config
 * Monitoring: RGW S3 Analytics: A new Grafana dashboard is now available, enabling you to
   visualize per bucket and user analytics data, including total GETs, PUTs, Deletes,
   Copies, and list metrics.
+* RBD: `Image::access_timestamp` and `Image::modify_timestamp` Python APIs now
+  return timestamps in UTC.
 * RBD: Support for cloning from non-user type snapshots is added.  This is
   intended primarily as a building block for cloning new groups from group
   snapshots created with `rbd group snap create` command, but has also been
index c261daf9ecc6e687250da04cdf0aed20349455cd..2221cafca9ae6d2935e0dff69bdb81ae1810003a 100644 (file)
@@ -4126,7 +4126,7 @@ written." % (self.name, ret, length))
             ret = rbd_get_access_timestamp(self.image, &timestamp)
         if ret != 0:
             raise make_ex(ret, 'error getting access timestamp for image: %s' % (self.name))
-        return datetime.fromtimestamp(timestamp.tv_sec)
+        return datetime.utcfromtimestamp(timestamp.tv_sec)
 
     @requires_not_closed
     def modify_timestamp(self):
@@ -4139,7 +4139,7 @@ written." % (self.name, ret, length))
             ret = rbd_get_modify_timestamp(self.image, &timestamp)
         if ret != 0:
             raise make_ex(ret, 'error getting modify timestamp for image: %s' % (self.name))
-        return datetime.fromtimestamp(timestamp.tv_sec)
+        return datetime.utcfromtimestamp(timestamp.tv_sec)
 
     @requires_not_closed
     def flatten(self, on_progress=None):