summaryrefslogtreecommitdiff
path: root/bin/swift-dispersion-report
diff options
context:
space:
mode:
authorGreg Lange <greglange@gmail.com>2012-06-06 19:57:04 +0000
committerGreg Lange <greglange@gmail.com>2012-06-07 21:15:18 +0000
commit27455cb15bc29b19953d6d47aad669a7b246f97b (patch)
treee7621cae6f646af929d609b5273b063c7802e990 /bin/swift-dispersion-report
parentf7757e4ebf07471367d7b04deff0fe5dbb9df781 (diff)
downloadswift-27455cb15bc29b19953d6d47aad669a7b246f97b.tar.gz
added printing of 404s to dispersion report; fixed small, unrelated bug
also fixed bug where in error_log where identifier wasn't being set to anything meaningful, set it to the right thing bug 612722 Change-Id: I53f237ea0db2a5b2b8979a7b41189faf1275e861
Diffstat (limited to 'bin/swift-dispersion-report')
-rwxr-xr-xbin/swift-dispersion-report32
1 files changed, 21 insertions, 11 deletions
diff --git a/bin/swift-dispersion-report b/bin/swift-dispersion-report
index 0b5864e0a..e318fabc9 100755
--- a/bin/swift-dispersion-report
+++ b/bin/swift-dispersion-report
@@ -34,23 +34,29 @@ from swift.common.utils import compute_eta, get_time_units, TRUE_VALUES
unmounted = []
+notfound = []
json_output = False
+debug = False
def get_error_log(prefix):
def error_log(msg_or_exc):
- global unmounted
- if hasattr(msg_or_exc, 'http_status') and \
- msg_or_exc.http_status == 507:
- identifier = '%s:%s/%s'
- if identifier not in unmounted:
- unmounted.append(identifier)
- print >>stderr, 'ERROR: %s:%s/%s is unmounted -- This will ' \
- 'cause replicas designated for that device to be ' \
- 'considered missing until resolved or the ring is ' \
- 'updated.' % (msg_or_exc.http_host, msg_or_exc.http_port,
- msg_or_exc.http_device)
+ global debug, unmounted, notfound
+ if hasattr(msg_or_exc, 'http_status'):
+ identifier = '%s:%s/%s' % (msg_or_exc.http_host,
+ msg_or_exc.http_port, msg_or_exc.http_device)
+ if msg_or_exc.http_status == 507:
+ if identifier not in unmounted:
+ unmounted.append(identifier)
+ print >>stderr, 'ERROR: %s is unmounted -- This will ' \
+ 'cause replicas designated for that device to be ' \
+ 'considered missing until resolved or the ring is ' \
+ 'updated.' % (identifier)
+ stderr.flush()
+ if debug and identifier not in notfound:
+ notfound.append(identifier)
+ print >>stderr, 'ERROR: %s returned a 404' % (identifier)
stderr.flush()
if not hasattr(msg_or_exc, 'http_status') or \
msg_or_exc.http_status not in (404, 507):
@@ -260,6 +266,8 @@ Usage: %prog [options] [conf_file]
[conf_file] defaults to /etc/swift/stats.conf'''.strip())
parser.add_option('-j', '--dump-json', action='store_true', default=False,
help='dump dispersion report in json format')
+ parser.add_option('-d', '--debug', action='store_true', default=False,
+ help='print 404s to standard error')
options, args = parser.parse_args()
@@ -277,6 +285,8 @@ Usage: %prog [options] [conf_file]
concurrency = int(conf.get('concurrency', 25))
if options.dump_json or conf.get('dump_json', 'no').lower() in TRUE_VALUES:
json_output = True
+ if options.debug:
+ debug = True
coropool = GreenPool(size=concurrency)