diff options
Diffstat (limited to 'swift/obj/reconstructor.py')
-rw-r--r-- | swift/obj/reconstructor.py | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/swift/obj/reconstructor.py b/swift/obj/reconstructor.py index 135f9d5f9..ede7ecad7 100644 --- a/swift/obj/reconstructor.py +++ b/swift/obj/reconstructor.py @@ -22,7 +22,6 @@ import time from collections import defaultdict import six import six.moves.cPickle as pickle -import shutil from eventlet import (GreenPile, GreenPool, Timeout, sleep, tpool, spawn) from eventlet.support.greenlets import GreenletExit @@ -30,10 +29,10 @@ from eventlet.support.greenlets import GreenletExit from swift import gettext_ as _ from swift.common.utils import ( whataremyips, unlink_older_than, compute_eta, get_logger, - dump_recon_cache, mkdirs, config_true_value, - GreenAsyncPile, Timestamp, remove_file, - load_recon_cache, parse_override_options, distribute_evenly, - PrefixLoggerAdapter, remove_directory) + dump_recon_cache, config_true_value, + GreenAsyncPile, Timestamp, load_recon_cache, + parse_override_options, distribute_evenly, PrefixLoggerAdapter, + remove_directory) from swift.common.header_key_dict import HeaderKeyDict from swift.common.bufferedhttp import http_connect from swift.common.daemon import Daemon @@ -1113,15 +1112,16 @@ class ObjectReconstructor(Daemon): tmp_path = join(dev_path, get_tmp_dir(int(policy))) unlink_older_than(tmp_path, time.time() - df_mgr.reclaim_age) - if not os.path.exists(obj_path): + + if not df_mgr.exists(obj_path): try: - mkdirs(obj_path) + df_mgr.mkdirs(obj_path) except Exception: self.logger.exception( 'Unable to create %s' % obj_path) continue try: - partitions = os.listdir(obj_path) + partitions = df_mgr.listdir(obj_path) except OSError: self.logger.exception( 'Unable to list partitions in %r' % obj_path) @@ -1137,7 +1137,7 @@ class ObjectReconstructor(Daemon): if not partition.isdigit(): self.logger.warning( 'Unexpected entity in data dir: %r' % part_path) - self.delete_partition(part_path) + self.delete_partition(df_mgr, part_path) self.reconstruction_part_count += 1 continue partition = int(partition) @@ -1194,13 +1194,13 @@ class ObjectReconstructor(Daemon): self.last_reconstruction_count = -1 self.handoffs_remaining = 0 - def delete_partition(self, path): - def kill_it(path): - shutil.rmtree(path, ignore_errors=True) - remove_file(path) + def delete_partition(self, df_mgr, path): + def kill_it(df_mgr, path): + df_mgr.rmtree(path, ignore_errors=True) + df_mgr.remove_file(path) self.logger.info(_("Removing partition: %s"), path) - tpool.execute(kill_it, path) + tpool.execute(kill_it, df_mgr, path) def reconstruct(self, **kwargs): """Run a reconstruction pass""" @@ -1230,6 +1230,7 @@ class ObjectReconstructor(Daemon): # Therefore we know this part a) doesn't belong on # this node and b) doesn't have any suffixes in it. self.run_pool.spawn(self.delete_partition, + self._df_router[part_info['policy']], part_info['part_path']) for job in jobs: self.run_pool.spawn(self.process_job, job) |