diff --git a/bin/swift-bench b/bin/swift-bench index b24345c873..04a0428eef 100755 --- a/bin/swift-bench +++ b/bin/swift-bench @@ -50,6 +50,7 @@ CONF_DEFAULTS = { 'devices': 'sdb1', # space-sep list 'log_level': 'INFO', 'timeout': '10', + 'delay': '0', 'bench_clients': [], } @@ -117,6 +118,8 @@ if __name__ == '__main__': help='If set, will not delete the objects created') parser.add_option('-V', '--auth_version', dest='auth_version', help='Authentication version') + parser.add_option('-d', '--delay', dest='delay', + help='Delay before delete requests in seconds') if len(sys.argv) == 1: parser.print_help() diff --git a/swift/common/bench.py b/swift/common/bench.py index bc45d809c8..0a46be2d76 100644 --- a/swift/common/bench.py +++ b/swift/common/bench.py @@ -352,6 +352,7 @@ class BenchController(object): self.delete = config_true_value(conf.delete) self.gets = int(conf.num_gets) self.aborted = False + self.delay = int(self.conf.delay) def sigint1(self, signum, frame): if self.delete: @@ -378,6 +379,11 @@ class BenchController(object): self.running = gets gets.run() if self.delete: + if self.delay != 0: + self.logger.info('Delay before ' + 'DELETE request %s sec' + % self.delay) + time.sleep(self.delay) dels = BenchDELETE(self.logger, self.conf, self.names) self.running = dels dels.run()