changed auditor once mode
This commit is contained in:
@@ -65,18 +65,21 @@ class AccountAuditor(Daemon):
|
||||
"""Run the account audit once."""
|
||||
self.logger.info('Begin account audit "once" mode')
|
||||
begin = time.time()
|
||||
try:
|
||||
location = ''
|
||||
gen = audit_location_generator(self.devices,
|
||||
account_server.DATADIR,
|
||||
mount_check=self.mount_check,
|
||||
logger=self.logger)
|
||||
while not location.endswith('.db'):
|
||||
location, device, partition = gen.next()
|
||||
except StopIteration:
|
||||
self.logger.info('Nothing to audit')
|
||||
else:
|
||||
self.account_audit(location)
|
||||
all_locs = audit_location_generator(self.devices,
|
||||
account_server.DATADIR,
|
||||
mount_check=self.mount_check,
|
||||
logger=self.logger)
|
||||
for path, device, partition in all_locs:
|
||||
self.account_audit(path)
|
||||
if time.time() - reported >= 3600: # once an hour
|
||||
self.logger.info(
|
||||
'Since %s: Account audits: %s passed audit, '
|
||||
'%s failed audit' % (time.ctime(reported),
|
||||
self.account_passes,
|
||||
self.account_failures))
|
||||
reported = time.time()
|
||||
self.account_passes = 0
|
||||
self.account_failures = 0
|
||||
elapsed = time.time() - begin
|
||||
self.logger.info(
|
||||
'Account audit "once" mode completed: %.02fs' % elapsed)
|
||||
|
@@ -66,18 +66,21 @@ class ContainerAuditor(Daemon):
|
||||
"""Run the container audit once."""
|
||||
self.logger.info('Begin container audit "once" mode')
|
||||
begin = time.time()
|
||||
try:
|
||||
location = ''
|
||||
gen = audit_location_generator(self.devices,
|
||||
container_server.DATADIR,
|
||||
mount_check=self.mount_check,
|
||||
logger=self.logger)
|
||||
while not location.endswith('.db'):
|
||||
location, device, partition = gen.next()
|
||||
except StopIteration:
|
||||
self.logger.info('Nothing to audit')
|
||||
else:
|
||||
self.container_audit(location)
|
||||
all_locs = audit_location_generator(self.devices,
|
||||
container_server.DATADIR,
|
||||
mount_check=self.mount_check,
|
||||
logger=self.logger)
|
||||
for path, device, partition in all_locs:
|
||||
self.container_audit(path)
|
||||
if time.time() - reported >= 3600: # once an hour
|
||||
self.logger.info(
|
||||
'Since %s: Container audits: %s passed audit, '
|
||||
'%s failed audit' % (time.ctime(reported),
|
||||
self.container_passes,
|
||||
self.container_failures))
|
||||
reported = time.time()
|
||||
self.container_passes = 0
|
||||
self.container_failures = 0
|
||||
elapsed = time.time() - begin
|
||||
self.logger.info(
|
||||
'Container audit "once" mode completed: %.02fs' % elapsed)
|
||||
|
@@ -68,18 +68,21 @@ class ObjectAuditor(Daemon):
|
||||
"""Run the object audit once."""
|
||||
self.logger.info('Begin object audit "once" mode')
|
||||
begin = time.time()
|
||||
try:
|
||||
location = ''
|
||||
gen = audit_location_generator(self.devices,
|
||||
object_server.DATADIR,
|
||||
mount_check=self.mount_check,
|
||||
logger=self.logger)
|
||||
while not location.endswith('.data'):
|
||||
location, device, partition = gen.next()
|
||||
except StopIteration:
|
||||
self.logger.info('Nothing to audit')
|
||||
else:
|
||||
self.object_audit(location, device, partition)
|
||||
all_locs = audit_location_generator(self.devices,
|
||||
object_server.DATADIR,
|
||||
mount_check=self.mount_check,
|
||||
logger=self.logger)
|
||||
for path, device, partition in all_locs:
|
||||
self.object_audit(path, device, partition)
|
||||
if time.time() - reported >= 3600: # once an hour
|
||||
self.logger.info(
|
||||
'Since %s: Locally: %d passed audit, %d quarantined, '
|
||||
'%d errors' % (time.ctime(reported), self.passes,
|
||||
self.quarantines, self.errors))
|
||||
reported = time.time()
|
||||
self.passes = 0
|
||||
self.quarantines = 0
|
||||
self.errors = 0
|
||||
elapsed = time.time() - begin
|
||||
self.logger.info(
|
||||
'Object audit "once" mode completed: %.02fs' % elapsed)
|
||||
|
Reference in New Issue
Block a user