Merge "recon: only query each host once for disk usage"
This commit is contained in:
commit
ad0868f700
@ -897,9 +897,15 @@ class SwiftRecon(object):
|
|||||||
low_percents = [(None, 100)] * lowest
|
low_percents = [(None, 100)] * lowest
|
||||||
recon = Scout("diskusage", self.verbose, self.suppress_errors,
|
recon = Scout("diskusage", self.verbose, self.suppress_errors,
|
||||||
self.timeout)
|
self.timeout)
|
||||||
|
# We want to only query each host once, but we don't care
|
||||||
|
# which of the available ports we use. So we filter hosts by
|
||||||
|
# constructing a host->port dictionary, since the dict
|
||||||
|
# constructor ensures each key is unique, thus each host
|
||||||
|
# appears only once in filtered_hosts.
|
||||||
|
filtered_hosts = set(dict(hosts).items())
|
||||||
print("[%s] Checking disk usage now" % self._ptime())
|
print("[%s] Checking disk usage now" % self._ptime())
|
||||||
for url, response, status, ts_start, ts_end in self.pool.imap(
|
for url, response, status, ts_start, ts_end in self.pool.imap(
|
||||||
recon.scout, hosts):
|
recon.scout, filtered_hosts):
|
||||||
if status == 200:
|
if status == 200:
|
||||||
hostusage = []
|
hostusage = []
|
||||||
for entry in response:
|
for entry in response:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user