Add dispersion report flags to limit reports

- Add two optional flags that let you limit swift-dispersion-report to only
reporting on containers OR objects.
- Also make dispersion.conf and swift-dispersion-report manpages
  current.

DocImpact

Change-Id: Iad56133cad261241db27d0e2103098e3c2f3c245
This commit is contained in:
Florian Hines 2012-12-03 16:12:10 -06:00
parent 4f617f49b6
commit e474dfb720
5 changed files with 57 additions and 11 deletions

View File

@ -305,7 +305,10 @@ Usage: %prog [options] [conf_file]
help='print 404s to standard error')
parser.add_option('-p', '--partitions', action='store_true', default=False,
help='print missing partitions to standard error')
parser.add_option('--container-only', action='store_true', default=False,
help='Only run container report')
parser.add_option('--object-only', action='store_true', default=False,
help='Only run object report')
options, args = parser.parse_args()
conffile = '/etc/swift/dispersion.conf'
@ -322,6 +325,12 @@ Usage: %prog [options] [conf_file]
concurrency = int(conf.get('concurrency', 25))
if options.dump_json or config_true_value(conf.get('dump_json', 'no')):
json_output = True
container_report = config_true_value(conf.get('container_report', 'yes')) \
and not options.object_only
object_report = config_true_value(conf.get('object_report', 'yes')) \
and not options.container_only
if not (object_report or container_report):
exit("Neither container or object report is set to run")
if options.debug:
debug = True
@ -339,11 +348,14 @@ Usage: %prog [options] [conf_file]
container_ring = Ring(swift_dir, ring_name='container')
object_ring = Ring(swift_dir, ring_name='object')
container_result = container_dispersion_report(
coropool, connpool, account, container_ring, retries,
options.partitions)
object_result = object_dispersion_report(
coropool, connpool, account, object_ring, retries, options.partitions)
output = {}
if container_report:
output['container'] = container_dispersion_report(
coropool, connpool, account, container_ring, retries,
options.partitions)
if object_report:
output['object'] = object_dispersion_report(
coropool, connpool, account, object_ring, retries,
options.partitions)
if json_output:
print json.dumps({"container": container_result,
"object": object_result})
print json.dumps(output)

View File

@ -45,11 +45,17 @@ Authentication system account/user password
.IP "\fBswift_dir\fR"
Location of openstack-swift configuration and ring files
.IP "\fBdispersion_coverage\fR"
Percentage of partition coverage to use. The default is 1
Percentage of partition coverage to use. The default is 1.
.IP "\fBretries\fR"
Maximum number of attempts
.IP "\fBconcurrency\fR"
Maximum number of concurrencies to
Concurrency to use. The default is 25.
.IP "\fBdump_json\fR"
Whether to output in json format. The default is no.
.IP "\fBcontainer_report\fR"
Whether to run the container report. The default is yes.
.IP "\fBobject_report\fR"
Whether to run the object report. The default is yes.
.RE
.PD
@ -65,6 +71,8 @@ Maximum number of concurrencies to
.IP "# retries = 5"
.IP "# concurrency = 25"
.IP "# dump_json = no"
.IP "# container_report = yes"
.IP "# object_report = yes"
.RE
.PD

View File

@ -24,7 +24,7 @@
.SH SYNOPSIS
.LP
.B swift-dispersion-report [-d|--debug] [-j|--dump-json] [-p|--partitions] [conf_file]
.B swift-dispersion-report [-d|--debug] [-j|--dump-json] [-p|--partitions] [--container-only|--object-only] [conf_file]
.SH DESCRIPTION
.PP
@ -72,6 +72,18 @@ output dispersion report in json format
.IP "\fB-p, --partitions\fR"
output the partition numbers that have any missing replicas
.SH OPTIONS
.RS 0
.PD 1
.IP "\fB--container-only\fR"
Only run the container report
.SH OPTIONS
.RS 0
.PD 1
.IP "\fB--object-only\fR"
Only run the object report
.SH CONFIGURATION
.PD 0
Example \fI/etc/swift/dispersion.conf\fR:

View File

@ -254,6 +254,18 @@ place and then rerun the dispersion report::
100.00% of object copies found (7857 of 7857)
Sample represents 1.00% of the object partition space
You can also run the report for only containers or objects::
$ swift-dispersion-report --container-only
Queried 2621 containers for dispersion reporting, 17s, 0 retries
100.00% of container copies found (7863 of 7863)
Sample represents 1.00% of the container partition space
$ swift-dispersion-report --object-only
Queried 2619 objects for dispersion reporting, 7s, 0 retries
100.00% of object copies found (7857 of 7857)
Sample represents 1.00% of the object partition space
Alternatively, the dispersion report can also be output in json format. This
allows it to be more easily consumed by third party utilities::

View File

@ -11,4 +11,6 @@ auth_key = testing
# dispersion_coverage = 1
# retries = 5
# concurrency = 25
# container_report = yes
# object_report = yes
# dump_json = no