]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/pybind/mgr/dashboard/controllers/rbd.py
import 15.2.2 octopus source
[ceph.git] / ceph / src / pybind / mgr / dashboard / controllers / rbd.py
index 6bfff994d223ae3e4075ce3503eeb84786547193..ec959949381fbf64bd91f8f13c9f02a6c51276df 100644 (file)
@@ -3,6 +3,7 @@
 # pylint: disable=too-many-statements,too-many-branches
 from __future__ import absolute_import
 
+import logging
 import math
 from functools import partial
 from datetime import datetime
@@ -21,6 +22,8 @@ from ..tools import ViewCache, str_to_bool
 from ..services.exception import handle_rados_error, handle_rbd_error, \
     serialize_dashboard_exception
 
+logger = logging.getLogger(__name__)
+
 
 # pylint: disable=not-callable
 def RbdTask(name, metadata, wait_for):  # noqa: N802
@@ -363,12 +366,14 @@ class RbdTrash(RESTController):
     @DeletePermission
     def purge(self, pool_name=None):
         """Remove all expired images from trash."""
-        now = "{}Z".format(datetime.now().isoformat())
+        now = "{}Z".format(datetime.utcnow().isoformat())
         pools = self._trash_list(pool_name)
 
         for pool in pools:
             for image in pool['value']:
                 if image['deferment_end_time'] < now:
+                    logger.info('Removing trash image %s (pool=%s, namespace=%s, name=%s)',
+                                image['id'], pool['pool_name'], image['namespace'], image['name'])
                     rbd_call(pool['pool_name'], image['namespace'],
                              self.rbd_inst.trash_remove, image['id'], 0)