recon: only query each host once for disk usage
`swift-recon -d` asks each server:port pair about its disks, which means if you have servers_per_port enabled it will multiply-count the disks on any servers that have more than one port enabled. We only want to query each host once, and don't care which of the available ports we use, so filter the hosts set to ensure each host only appears in it once. Closes-Bug: 1947852 Change-Id: Idd517e97beab7813fc782b60cc01bcc20cd54c24
This commit is contained in:
parent
d827b852b8
commit
1942262dbf
@ -897,9 +897,15 @@ class SwiftRecon(object):
|
||||
low_percents = [(None, 100)] * lowest
|
||||
recon = Scout("diskusage", self.verbose, self.suppress_errors,
|
||||
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())
|
||||
for url, response, status, ts_start, ts_end in self.pool.imap(
|
||||
recon.scout, hosts):
|
||||
recon.scout, filtered_hosts):
|
||||
if status == 200:
|
||||
hostusage = []
|
||||
for entry in response:
|
||||
|
Loading…
Reference in New Issue
Block a user