Merge "Call swift-recon with more than one server type"
This commit is contained in:
commit
b25d82a5c5
@ -941,7 +941,8 @@ class SwiftRecon(object):
|
|||||||
"""
|
"""
|
||||||
print("=" * 79)
|
print("=" * 79)
|
||||||
usage = '''
|
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]
|
[-l] [-T] [--md5] [--auditor] [--updater] [--expirer] [--sockstat]
|
||||||
[--human-readable]
|
[--human-readable]
|
||||||
|
|
||||||
@ -1009,103 +1010,110 @@ class SwiftRecon(object):
|
|||||||
'storage policy (specified as name or index).')
|
'storage policy (specified as name or index).')
|
||||||
options, arguments = args.parse_args()
|
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()
|
args.print_help()
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
if arguments:
|
if arguments:
|
||||||
if arguments[0] in self.check_types:
|
arguments = set(arguments)
|
||||||
self.server_type = arguments[0]
|
if arguments.issubset(self.check_types):
|
||||||
|
server_types = arguments
|
||||||
else:
|
else:
|
||||||
print("Invalid Server Type")
|
print("Invalid Server Type")
|
||||||
args.print_help()
|
args.print_help()
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else: # default
|
||||||
self.server_type = 'object'
|
server_types = ['object']
|
||||||
|
|
||||||
swift_dir = options.swiftdir
|
swift_dir = options.swiftdir
|
||||||
self.verbose = options.verbose
|
self.verbose = options.verbose
|
||||||
self.suppress_errors = options.suppress
|
self.suppress_errors = options.suppress
|
||||||
self.timeout = options.timeout
|
self.timeout = options.timeout
|
||||||
|
|
||||||
ring_names = self._get_ring_names(options.policy)
|
for server_type in server_types:
|
||||||
if not ring_names:
|
self.server_type = server_type
|
||||||
print('Invalid Storage Policy')
|
ring_names = self._get_ring_names(options.policy)
|
||||||
args.print_help()
|
if not ring_names:
|
||||||
sys.exit(0)
|
print('Invalid Storage Policy: %s' % options.policy)
|
||||||
|
args.print_help()
|
||||||
hosts = self.get_hosts(options.region, options.zone,
|
sys.exit(0)
|
||||||
swift_dir, ring_names)
|
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)" %
|
||||||
print("=" * 79)
|
(len(hosts), self.server_type))
|
||||||
|
print("=" * 79)
|
||||||
if options.all:
|
if options.all:
|
||||||
if self.server_type == 'object':
|
|
||||||
self.async_check(hosts)
|
|
||||||
self.object_auditor_check(hosts)
|
|
||||||
self.updater_check(hosts)
|
|
||||||
self.expirer_check(hosts)
|
|
||||||
elif self.server_type == 'container':
|
|
||||||
self.auditor_check(hosts)
|
|
||||||
self.updater_check(hosts)
|
|
||||||
elif self.server_type == 'account':
|
|
||||||
self.auditor_check(hosts)
|
|
||||||
self.replication_check(hosts)
|
|
||||||
self.umount_check(hosts)
|
|
||||||
self.load_check(hosts)
|
|
||||||
self.disk_usage(hosts, options.top, options.lowest,
|
|
||||||
options.human_readable)
|
|
||||||
self.get_ringmd5(hosts, swift_dir)
|
|
||||||
self.get_swiftconfmd5(hosts)
|
|
||||||
self.quarantine_check(hosts)
|
|
||||||
self.socket_usage(hosts)
|
|
||||||
self.server_type_check(hosts)
|
|
||||||
self.driveaudit_check(hosts)
|
|
||||||
self.time_check(hosts)
|
|
||||||
else:
|
|
||||||
if options.async:
|
|
||||||
if self.server_type == 'object':
|
if self.server_type == 'object':
|
||||||
self.async_check(hosts)
|
self.async_check(hosts)
|
||||||
else:
|
|
||||||
print("Error: Can't check asyncs on non object servers.")
|
|
||||||
if options.unmounted:
|
|
||||||
self.umount_check(hosts)
|
|
||||||
if options.replication:
|
|
||||||
self.replication_check(hosts)
|
|
||||||
if options.auditor:
|
|
||||||
if self.server_type == 'object':
|
|
||||||
self.object_auditor_check(hosts)
|
self.object_auditor_check(hosts)
|
||||||
else:
|
|
||||||
self.auditor_check(hosts)
|
|
||||||
if options.updater:
|
|
||||||
if self.server_type == 'account':
|
|
||||||
print("Error: Can't check updaters on account servers.")
|
|
||||||
else:
|
|
||||||
self.updater_check(hosts)
|
self.updater_check(hosts)
|
||||||
if options.expirer:
|
|
||||||
if self.server_type == 'object':
|
|
||||||
self.expirer_check(hosts)
|
self.expirer_check(hosts)
|
||||||
else:
|
elif self.server_type == 'container':
|
||||||
print("Error: Can't check expired on non object servers.")
|
self.auditor_check(hosts)
|
||||||
if options.validate_servers:
|
self.updater_check(hosts)
|
||||||
self.server_type_check(hosts)
|
elif self.server_type == 'account':
|
||||||
if options.loadstats:
|
self.auditor_check(hosts)
|
||||||
|
self.replication_check(hosts)
|
||||||
|
self.umount_check(hosts)
|
||||||
self.load_check(hosts)
|
self.load_check(hosts)
|
||||||
if options.diskusage:
|
|
||||||
self.disk_usage(hosts, options.top, options.lowest,
|
self.disk_usage(hosts, options.top, options.lowest,
|
||||||
options.human_readable)
|
options.human_readable)
|
||||||
if options.md5:
|
|
||||||
self.get_ringmd5(hosts, swift_dir)
|
self.get_ringmd5(hosts, swift_dir)
|
||||||
self.get_swiftconfmd5(hosts)
|
self.get_swiftconfmd5(hosts)
|
||||||
if options.quarantined:
|
|
||||||
self.quarantine_check(hosts)
|
self.quarantine_check(hosts)
|
||||||
if options.sockstat:
|
|
||||||
self.socket_usage(hosts)
|
self.socket_usage(hosts)
|
||||||
if options.driveaudit:
|
self.server_type_check(hosts)
|
||||||
self.driveaudit_check(hosts)
|
self.driveaudit_check(hosts)
|
||||||
if options.time:
|
|
||||||
self.time_check(hosts)
|
self.time_check(hosts)
|
||||||
|
else:
|
||||||
|
if options.async:
|
||||||
|
if self.server_type == 'object':
|
||||||
|
self.async_check(hosts)
|
||||||
|
else:
|
||||||
|
print("Error: Can't check asyncs on non object "
|
||||||
|
"servers.")
|
||||||
|
print("=" * 79)
|
||||||
|
if options.unmounted:
|
||||||
|
self.umount_check(hosts)
|
||||||
|
if options.replication:
|
||||||
|
self.replication_check(hosts)
|
||||||
|
if options.auditor:
|
||||||
|
if self.server_type == 'object':
|
||||||
|
self.object_auditor_check(hosts)
|
||||||
|
else:
|
||||||
|
self.auditor_check(hosts)
|
||||||
|
if options.updater:
|
||||||
|
if self.server_type == 'account':
|
||||||
|
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("=" * 79)
|
||||||
|
if options.validate_servers:
|
||||||
|
self.server_type_check(hosts)
|
||||||
|
if options.loadstats:
|
||||||
|
self.load_check(hosts)
|
||||||
|
if options.diskusage:
|
||||||
|
self.disk_usage(hosts, options.top, options.lowest,
|
||||||
|
options.human_readable)
|
||||||
|
if options.md5:
|
||||||
|
self.get_ringmd5(hosts, swift_dir)
|
||||||
|
self.get_swiftconfmd5(hosts)
|
||||||
|
if options.quarantined:
|
||||||
|
self.quarantine_check(hosts)
|
||||||
|
if options.sockstat:
|
||||||
|
self.socket_usage(hosts)
|
||||||
|
if options.driveaudit:
|
||||||
|
self.driveaudit_check(hosts)
|
||||||
|
if options.time:
|
||||||
|
self.time_check(hosts)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user