mirror of
https://github.com/ceph/ceph
synced 2024-12-28 06:23:08 +00:00
Merge pull request #34705 from bk201/wip-45149
mgr/dashboard: fixing RBD purge error in backend Reviewed-by: Tiago Melo <tmelo@suse.com> Reviewed-by: Volker Theile <vtheile@suse.com> Reviewed-by: Alfonso Martínez <almartin@redhat.com> Reviewed-by: Laura Paduano <lpaduano@suse.com>
This commit is contained in:
commit
63d690fcc5
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user