Call swift-recon with more than one server type
Examples: * get auditor stats from account and container server swift-recon account container --auditor * perform all checks on all servers swift-recon account container object --all Change-Id: I05bb7c785e6a4d80969d90448f1b9e0fd08dae86 Co-Authored-By: Ondřej Nový <ondrej.novy@firma.seznam.cz>
This commit is contained in:
parent
12022385fb
commit
ef942dadeb
@ -941,7 +941,8 @@ class SwiftRecon(object):
|
||||
"""
|
||||
print("=" * 79)
|
||||
usage = '''
|
||||
usage: %prog <server_type> [-v] [--suppress] [-a] [-r] [-u] [-d]
|
||||
usage: %prog <server_type> [<server_type> [<server_type>]]
|
||||
[-v] [--suppress] [-a] [-r] [-u] [-d]
|
||||
[-l] [-T] [--md5] [--auditor] [--updater] [--expirer] [--sockstat]
|
||||
[--human-readable]
|
||||
|
||||
@ -1009,37 +1010,38 @@ class SwiftRecon(object):
|
||||
'storage policy (specified as name or index).')
|
||||
options, arguments = args.parse_args()
|
||||
|
||||
if len(sys.argv) <= 1 or len(arguments) > 1:
|
||||
if len(sys.argv) <= 1 or len(arguments) > len(self.check_types):
|
||||
args.print_help()
|
||||
sys.exit(0)
|
||||
|
||||
if arguments:
|
||||
if arguments[0] in self.check_types:
|
||||
self.server_type = arguments[0]
|
||||
arguments = set(arguments)
|
||||
if arguments.issubset(self.check_types):
|
||||
server_types = arguments
|
||||
else:
|
||||
print("Invalid Server Type")
|
||||
args.print_help()
|
||||
sys.exit(1)
|
||||
else:
|
||||
self.server_type = 'object'
|
||||
else: # default
|
||||
server_types = ['object']
|
||||
|
||||
swift_dir = options.swiftdir
|
||||
self.verbose = options.verbose
|
||||
self.suppress_errors = options.suppress
|
||||
self.timeout = options.timeout
|
||||
|
||||
for server_type in server_types:
|
||||
self.server_type = server_type
|
||||
ring_names = self._get_ring_names(options.policy)
|
||||
if not ring_names:
|
||||
print('Invalid Storage Policy')
|
||||
print('Invalid Storage Policy: %s' % options.policy)
|
||||
args.print_help()
|
||||
sys.exit(0)
|
||||
|
||||
hosts = self.get_hosts(options.region, options.zone,
|
||||
swift_dir, ring_names)
|
||||
|
||||
print("--> Starting reconnaissance on %s hosts" % len(hosts))
|
||||
print("--> Starting reconnaissance on %s hosts (%s)" %
|
||||
(len(hosts), self.server_type))
|
||||
print("=" * 79)
|
||||
|
||||
if options.all:
|
||||
if self.server_type == 'object':
|
||||
self.async_check(hosts)
|
||||
@ -1068,7 +1070,9 @@ class SwiftRecon(object):
|
||||
if self.server_type == 'object':
|
||||
self.async_check(hosts)
|
||||
else:
|
||||
print("Error: Can't check asyncs on non object servers.")
|
||||
print("Error: Can't check asyncs on non object "
|
||||
"servers.")
|
||||
print("=" * 79)
|
||||
if options.unmounted:
|
||||
self.umount_check(hosts)
|
||||
if options.replication:
|
||||
@ -1080,14 +1084,18 @@ class SwiftRecon(object):
|
||||
self.auditor_check(hosts)
|
||||
if options.updater:
|
||||
if self.server_type == 'account':
|
||||
print("Error: Can't check updaters on account servers.")
|
||||
print("Error: Can't check updaters on account "
|
||||
"servers.")
|
||||
print("=" * 79)
|
||||
else:
|
||||
self.updater_check(hosts)
|
||||
if options.expirer:
|
||||
if self.server_type == 'object':
|
||||
self.expirer_check(hosts)
|
||||
else:
|
||||
print("Error: Can't check expired on non object servers.")
|
||||
print("Error: Can't check expired on non object "
|
||||
"servers.")
|
||||
print("=" * 79)
|
||||
if options.validate_servers:
|
||||
self.server_type_check(hosts)
|
||||
if options.loadstats:
|
||||
|
Loading…
x
Reference in New Issue
Block a user