Description: swift-recon: only query object servers once
Author: Thomas Goirand <zigo@debian.org>
Forwarded: no
Last-Update: 2023-04-28

Index: swift/swift/cli/recon.py
===================================================================
--- swift.orig/swift/cli/recon.py
+++ swift/swift/cli/recon.py
@@ -358,6 +358,13 @@ class SwiftRecon(object):
             if status == 200:
                 unmounted[url] = []
                 errors[url] = []
+                # Hack: Ignore all hosts where the port is the object one
+                # but the 6200. This is to ensure hosts are added only
+                # once in case we use the "one server per port" option
+                # of swift-object.
+                port=int(url.split(':')[2].split('/')[0])
+                if port > 6200 and port < 6400:
+                    continue
                 for i in response:
                     if not isinstance(i['mounted'], bool):
                         errors[url].append(i['device'])
@@ -902,6 +909,13 @@ class SwiftRecon(object):
                 recon.scout, filtered_hosts):
             if status == 200:
                 hostusage = []
+                # Hack: Ignore all hosts where the port is the object one
+                # but the 6200. This is to ensure hosts are added only
+                # once in case we use the "one server per port" option
+                # of swift-object.
+                port=int(url.split(':')[2].split('/')[0])
+                if port > 6200 and port < 6400:
+                    continue
                 for entry in response:
                     if not isinstance(entry['mounted'], bool):
                         print("-> %s/%s: Error: %s" % (url, entry['device'],
