From 0d2bf657ae5271a01e9ec84d379d17910b263b7e Mon Sep 17 00:00:00 2001 From: Diane Fleming Date: Mon, 3 Feb 2014 13:39:15 -0600 Subject: [PATCH] Update help strings for cinder client Make text consistent and clear. Add periods to end of sentences. Adjust test suite for change Closes-Bug: #1275881 Change-Id: I1dfde51636e8dc4b42e4c4810c27c1c4ac513d82 --- cinderclient/shell.py | 109 ++--- cinderclient/tests/test_shell.py | 6 +- cinderclient/v1/availability_zones.py | 2 +- cinderclient/v1/contrib/list_extensions.py | 2 +- cinderclient/v1/shell.py | 461 ++++++++++---------- cinderclient/v1/volume_backups.py | 2 +- cinderclient/v1/volume_encryption_types.py | 2 +- cinderclient/v1/volume_transfers.py | 2 +- cinderclient/v1/volume_types.py | 2 +- cinderclient/v1/volumes.py | 2 +- cinderclient/v2/availability_zones.py | 2 +- cinderclient/v2/contrib/list_extensions.py | 4 +- cinderclient/v2/shell.py | 472 +++++++++++---------- cinderclient/v2/volume_backups.py | 4 +- cinderclient/v2/volume_encryption_types.py | 2 +- cinderclient/v2/volume_snapshots.py | 4 +- cinderclient/v2/volume_transfers.py | 2 +- cinderclient/v2/volume_types.py | 6 +- cinderclient/v2/volumes.py | 4 +- 19 files changed, 570 insertions(+), 520 deletions(-) diff --git a/cinderclient/shell.py b/cinderclient/shell.py index 17e7d778c..2dc8c5286 100644 --- a/cinderclient/shell.py +++ b/cinderclient/shell.py @@ -1,5 +1,5 @@ -# Copyright 2011 OpenStack LLC. +# Copyright 2011-2014 OpenStack Foundation # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -74,8 +74,7 @@ class OpenStackCinderShell(object): parser = CinderClientArgumentParser( prog='cinder', description=__doc__.strip(), - epilog='See "cinder help COMMAND" ' - 'for help on a specific command.', + epilog='Run "cinder help SUBCOMMAND" for help on a subcommand.', add_help=False, formatter_class=OpenStackHelpFormatter, ) @@ -93,13 +92,14 @@ class OpenStackCinderShell(object): action='store_true', default=utils.env('CINDERCLIENT_DEBUG', default=False), - help="Print debugging output") + help="Shows debugging output.") parser.add_argument('--os-username', metavar='', default=utils.env('OS_USERNAME', 'CINDER_USERNAME'), - help='Defaults to env[OS_USERNAME].') + help='OpenStack user name. ' + 'Default=env[OS_USERNAME].') parser.add_argument('--os_username', help=argparse.SUPPRESS) @@ -107,7 +107,8 @@ class OpenStackCinderShell(object): metavar='', default=utils.env('OS_PASSWORD', 'CINDER_PASSWORD'), - help='Defaults to env[OS_PASSWORD].') + help='Password for OpenStack user. ' + 'Default=env[OS_PASSWORD].') parser.add_argument('--os_password', help=argparse.SUPPRESS) @@ -115,7 +116,8 @@ class OpenStackCinderShell(object): metavar='', default=utils.env('OS_TENANT_NAME', 'CINDER_PROJECT_ID'), - help='Defaults to env[OS_TENANT_NAME].') + help='Tenant name. ' + 'Default=env[OS_TENANT_NAME].') parser.add_argument('--os_tenant_name', help=argparse.SUPPRESS) @@ -123,7 +125,8 @@ class OpenStackCinderShell(object): metavar='', default=utils.env('OS_TENANT_ID', 'CINDER_TENANT_ID'), - help='Defaults to env[OS_TENANT_ID].') + help='ID for the tenant. ' + 'Default=env[OS_TENANT_ID].') parser.add_argument('--os_tenant_id', help=argparse.SUPPRESS) @@ -131,7 +134,8 @@ class OpenStackCinderShell(object): metavar='', default=utils.env('OS_AUTH_URL', 'CINDER_URL'), - help='Defaults to env[OS_AUTH_URL].') + help='URL for the authentication service. ' + 'Default=env[OS_AUTH_URL].') parser.add_argument('--os_auth_url', help=argparse.SUPPRESS) @@ -139,7 +143,8 @@ class OpenStackCinderShell(object): metavar='', default=utils.env('OS_REGION_NAME', 'CINDER_REGION_NAME'), - help='Defaults to env[OS_REGION_NAME].') + help='Region name. ' + 'Default=env[OS_REGION_NAME].') parser.add_argument('--os_region_name', help=argparse.SUPPRESS) @@ -152,21 +157,24 @@ class OpenStackCinderShell(object): parser.add_argument('--service-type', metavar='', - help='Defaults to volume for most actions') + help='Service type. ' + 'For most actions, default is volume.') parser.add_argument('--service_type', help=argparse.SUPPRESS) parser.add_argument('--service-name', metavar='', default=utils.env('CINDER_SERVICE_NAME'), - help='Defaults to env[CINDER_SERVICE_NAME]') + help='Service name. ' + 'Default=env[CINDER_SERVICE_NAME].') parser.add_argument('--service_name', help=argparse.SUPPRESS) parser.add_argument('--volume-service-name', metavar='', default=utils.env('CINDER_VOLUME_SERVICE_NAME'), - help='Defaults to env[CINDER_VOLUME_SERVICE_NAME]') + help='Volume service name. ' + 'Default=env[CINDER_VOLUME_SERVICE_NAME].') parser.add_argument('--volume_service_name', help=argparse.SUPPRESS) @@ -174,7 +182,9 @@ class OpenStackCinderShell(object): metavar='', default=utils.env('CINDER_ENDPOINT_TYPE', default=DEFAULT_CINDER_ENDPOINT_TYPE), - help='Defaults to env[CINDER_ENDPOINT_TYPE] or ' + help='Endpoint type, which is publicURL or ' + 'internalURL. ' + 'Default=nova env[CINDER_ENDPOINT_TYPE] or ' + DEFAULT_CINDER_ENDPOINT_TYPE + '.') parser.add_argument('--endpoint_type', help=argparse.SUPPRESS) @@ -183,17 +193,18 @@ class OpenStackCinderShell(object): metavar='', default=utils.env('OS_VOLUME_API_VERSION', default=None), - help='Accepts 1 or 2,defaults ' - 'to env[OS_VOLUME_API_VERSION].') + help='Block Storage API version. ' + 'Valid values are 1 or 2. ' + 'Default=env[OS_VOLUME_API_VERSION].') parser.add_argument('--os_volume_api_version', help=argparse.SUPPRESS) parser.add_argument('--os-cacert', metavar='', default=utils.env('OS_CACERT', default=None), - help='Specify a CA bundle file to use in ' - 'verifying a TLS (https) server certificate. ' - 'Defaults to env[OS_CACERT]') + help='A CA bundle file that is used to ' + 'verify a TLS (https) server certificate. ' + 'Default=env[OS_CACERT].') parser.add_argument('--insecure', default=utils.env('CINDERCLIENT_INSECURE', @@ -419,24 +430,24 @@ class OpenStackCinderShell(object): if not os_username: if not username: raise exc.CommandError( - "You must provide a username " - "via either --os-username or env[OS_USERNAME]") + "You must provide a user name " + "through --os-username or env[OS_USERNAME].") else: os_username = username if not os_password: if not apikey: raise exc.CommandError("You must provide a password " - "via either --os-password or via " - "env[OS_PASSWORD]") + "through --os-password or " + "env[OS_PASSWORD].") else: os_password = apikey if not (os_tenant_name or os_tenant_id): if not projectid: - raise exc.CommandError("You must provide a tenant_id " - "via either --os-tenant-id or " - "env[OS_TENANT_ID]") + raise exc.CommandError("You must provide a tenant ID " + "through --os-tenant-id or " + "env[OS_TENANT_ID].") else: os_tenant_name = projectid @@ -447,8 +458,8 @@ class OpenStackCinderShell(object): if not os_auth_url: if not url: raise exc.CommandError( - "You must provide an auth url " - "via either --os-auth-url or env[OS_AUTH_URL]") + "You must provide an authentication URL " + "through --os-auth-url or env[OS_AUTH_URL].") else: os_auth_url = url @@ -457,13 +468,13 @@ class OpenStackCinderShell(object): if not (os_tenant_name or os_tenant_id): raise exc.CommandError( - "You must provide a tenant_id " - "via either --os-tenant-id or env[OS_TENANT_ID]") + "You must provide a tenant ID " + "through --os-tenant-id or env[OS_TENANT_ID].") if not os_auth_url: raise exc.CommandError( - "You must provide an auth url " - "via either --os-auth-url or env[OS_AUTH_URL]") + "You must provide an authentication URL " + "through --os-auth-url or env[OS_AUTH_URL].") self.cs = client.Client(options.os_volume_api_version, os_username, os_password, os_tenant_name, os_auth_url, @@ -483,9 +494,9 @@ class OpenStackCinderShell(object): if not utils.isunauthenticated(args.func): self.cs.authenticate() except exc.Unauthorized: - raise exc.CommandError("Invalid OpenStack Cinder credentials.") + raise exc.CommandError("OpenStack credentials are not valid.") except exc.AuthorizationFailure: - raise exc.CommandError("Unable to authorize user") + raise exc.CommandError("Unable to authorize user.") endpoint_api_version = None # Try to get the API version from the endpoint URL. If that fails fall @@ -496,37 +507,37 @@ class OpenStackCinderShell(object): endpoint_api_version = \ self.cs.get_volume_api_version_from_endpoint() if endpoint_api_version != options.os_volume_api_version: - msg = (("Volume API version is set to %s " + msg = (("OpenStack Block Storage API version is set to %s " "but you are accessing a %s endpoint. " - "Change its value via either --os-volume-api-version " - "or env[OS_VOLUME_API_VERSION]") + "Change its value through --os-volume-api-version " + "or env[OS_VOLUME_API_VERSION].") % (options.os_volume_api_version, endpoint_api_version)) raise exc.InvalidAPIVersion(msg) except exc.UnsupportedVersion: endpoint_api_version = options.os_volume_api_version if api_version_input: - logger.warning("Unable to determine the API version via " - "endpoint URL. Falling back to user " - "specified version: %s" % + logger.warning("Cannot determine the API version from " + "the endpoint URL. Falling back to the " + "user-specified version: %s" % endpoint_api_version) else: - logger.warning("Unable to determine the API version from " - "endpoint URL or user input. Falling back to " - "default API version: %s" % + logger.warning("Cannot determine the API version from the " + "endpoint URL or user input. Falling back " + "to the default API version: %s" % endpoint_api_version) args.func(self.cs, args) def _run_extension_hooks(self, hook_type, *args, **kwargs): - """Run hooks for all registered extensions.""" + """Runs hooks for all registered extensions.""" for extension in self.extensions: extension.run_hooks(hook_type, *args, **kwargs) def do_bash_completion(self, args): - """Print arguments for bash_completion. + """Prints arguments for bash_completion. - Prints all of the commands and options to stdout so that the - cinder.bash_completion script doesn't have to hard code them. + Prints all commands and options to stdout so that the + cinder.bash_completion script does not have to hard code them. """ commands = set() options = set() @@ -540,10 +551,10 @@ class OpenStackCinderShell(object): print(' '.join(commands | options)) @utils.arg('command', metavar='', nargs='?', - help='Display help for ') + help='Shows help for .') def do_help(self, args): """ - Display help about this program or one of its subcommands. + Shows help about this program or one of its subcommands. """ if args.command: if args.command in self.subcommands: diff --git a/cinderclient/tests/test_shell.py b/cinderclient/tests/test_shell.py index 969284747..db1a58509 100644 --- a/cinderclient/tests/test_shell.py +++ b/cinderclient/tests/test_shell.py @@ -61,8 +61,8 @@ class ShellTest(utils.TestCase): def test_help(self): required = [ '.*?^usage: ', - '.*?(?m)^\s+create\s+Add a new volume.', - '.*?(?m)^See "cinder help COMMAND" for help on a specific command', + '.*?(?m)^\s+create\s+Creates a volume.', + '.*?(?m)^Run "cinder help SUBCOMMAND" for help on a subcommand.', ] help_text = self.shell('help') for r in required: @@ -72,7 +72,7 @@ class ShellTest(utils.TestCase): def test_help_on_subcommand(self): required = [ '.*?^usage: cinder list', - '.*?(?m)^List all the volumes.', + '.*?(?m)^Lists all volumes.', ] help_text = self.shell('help list') for r in required: diff --git a/cinderclient/v1/availability_zones.py b/cinderclient/v1/availability_zones.py index 85ea9d7bf..b85d6dd3c 100644 --- a/cinderclient/v1/availability_zones.py +++ b/cinderclient/v1/availability_zones.py @@ -31,7 +31,7 @@ class AvailabilityZoneManager(base.ManagerWithFind): resource_class = AvailabilityZone def list(self, detailed=False): - """Get a list of all availability zones + """Lists all availability zones. :rtype: list of :class:`AvailabilityZone` """ diff --git a/cinderclient/v1/contrib/list_extensions.py b/cinderclient/v1/contrib/list_extensions.py index 5aab82f54..308d39683 100644 --- a/cinderclient/v1/contrib/list_extensions.py +++ b/cinderclient/v1/contrib/list_extensions.py @@ -40,7 +40,7 @@ class ListExtManager(base.Manager): @utils.service_type('volume') def do_list_extensions(client, _args): """ - List all the os-api extensions that are available. + Lists all available os-api extensions. """ extensions = client.list_extensions.show_all() fields = ["Name", "Summary", "Alias", "Updated"] diff --git a/cinderclient/v1/shell.py b/cinderclient/v1/shell.py index 792ef3a2d..1ebe6c610 100644 --- a/cinderclient/v1/shell.py +++ b/cinderclient/v1/shell.py @@ -1,19 +1,20 @@ # Copyright 2010 Jacob Kaplan-Moss - -# Copyright (c) 2011 OpenStack Foundation +# +# Copyright (c) 2011-2014 OpenStack Foundation # All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. from __future__ import print_function @@ -31,9 +32,7 @@ from cinderclient.v1 import availability_zones def _poll_for_status(poll_fn, obj_id, action, final_ok_states, poll_period=5, show_progress=True): - """Block while an action is being performed, periodically printing - progress. - """ + """Blocks while an action occurs. Periodically shows progress.""" def print_progress(progress): if show_progress: msg = ('\rInstance %(action)s... %(progress)s%% complete' @@ -62,22 +61,22 @@ def _poll_for_status(poll_fn, obj_id, action, final_ok_states, def _find_volume_snapshot(cs, snapshot): - """Get a volume snapshot by name or ID.""" + """Gets a volume snapshot by name or ID.""" return utils.find_resource(cs.volume_snapshots, snapshot) def _find_backup(cs, backup): - """Get a backup by name or ID.""" + """Gets a backup by name or ID.""" return utils.find_resource(cs.backups, backup) def _find_transfer(cs, transfer): - """Get a transfer by name or ID.""" + """Gets a transfer by name or ID.""" return utils.find_resource(cs.transfers, transfer) def _find_qos_specs(cs, qos_specs): - """Get a qos specs by ID.""" + """Gets a qos specs by ID.""" return utils.find_resource(cs.qos_specs, qos_specs) @@ -138,7 +137,7 @@ def _extract_metadata(args): type=int, const=1, default=0, - help='Display information from all tenants (Admin only).') + help='Shows details for all tenants. Admin only.') @utils.arg( '--all_tenants', nargs='?', @@ -149,22 +148,23 @@ def _extract_metadata(args): '--display-name', metavar='', default=None, - help='Filter results by display-name') + help='Filters list by a volume display name. OPTIONAL: Default=None.') @utils.arg( '--status', metavar='', default=None, - help='Filter results by status') + help='Filters list by a status. OPTIONAL: Default=None.') @utils.arg( '--metadata', type=str, nargs='*', metavar='', - help='Filter results by metadata', + help='Filters list by metadata key and value pair. ' + 'OPTIONAL: Default=None.', default=None) @utils.service_type('volume') def do_list(cs, args): - """List all the volumes.""" + """Lists all volumes.""" all_tenants = int(os.environ.get("ALL_TENANTS", args.all_tenants)) search_opts = { 'all_tenants': all_tenants, @@ -183,10 +183,10 @@ def do_list(cs, args): 'Size', 'Volume Type', 'Bootable', 'Attached to']) -@utils.arg('volume', metavar='', help='Name or ID of the volume.') +@utils.arg('volume', metavar='', help='Volume name or ID.') @utils.service_type('volume') def do_show(cs, args): - """Show details about a volume.""" + """Shows volume details.""" volume = utils.find_volume(cs, args.volume) _print_volume(volume) @@ -194,12 +194,13 @@ def do_show(cs, args): @utils.arg('size', metavar='', type=int, - help='Size of volume in GB') + help='Volume size, in GBs.') @utils.arg( '--snapshot-id', metavar='', default=None, - help='Create volume from snapshot id (Optional, Default=None)') + help='Creates volume from snapshot ID. ' + 'OPTIONAL: Default=None.') @utils.arg( '--snapshot_id', help=argparse.SUPPRESS) @@ -207,7 +208,8 @@ def do_show(cs, args): '--source-volid', metavar='', default=None, - help='Create volume from volume id (Optional, Default=None)') + help='Creates volume from volume ID. ' + 'OPTIONAL: Default=None.') @utils.arg( '--source_volid', help=argparse.SUPPRESS) @@ -215,7 +217,8 @@ def do_show(cs, args): '--image-id', metavar='', default=None, - help='Create volume from image id (Optional, Default=None)') + help='Creates volume from image ID. ' + 'OPTIONAL: Default=None.') @utils.arg( '--image_id', help=argparse.SUPPRESS) @@ -223,7 +226,8 @@ def do_show(cs, args): '--display-name', metavar='', default=None, - help='Volume name (Optional, Default=None)') + help='Volume name. ' + 'OPTIONAL: Default=None.') @utils.arg( '--display_name', help=argparse.SUPPRESS) @@ -231,7 +235,8 @@ def do_show(cs, args): '--display-description', metavar='', default=None, - help='Volume description (Optional, Default=None)') + help='Volume description. ' + 'OPTIONAL: Default=None.') @utils.arg( '--display_description', help=argparse.SUPPRESS) @@ -239,7 +244,8 @@ def do_show(cs, args): '--volume-type', metavar='', default=None, - help='Volume type (Optional, Default=None)') + help='Volume type. ' + 'OPTIONAL: Default=None.') @utils.arg( '--volume_type', help=argparse.SUPPRESS) @@ -247,7 +253,8 @@ def do_show(cs, args): '--availability-zone', metavar='', default=None, - help='Availability zone for volume (Optional, Default=None)') + help='Availability zone for volume. ' + 'OPTIONAL: Default=None.') @utils.arg( '--availability_zone', help=argparse.SUPPRESS) @@ -255,11 +262,12 @@ def do_show(cs, args): type=str, nargs='*', metavar='', - help='Metadata key=value pairs (Optional, Default=None)', + help='Metadata key and value pairs. ' + 'OPTIONAL: Default=None.', default=None) @utils.service_type('volume') def do_create(cs, args): - """Add a new volume.""" + """Creates a volume.""" volume_metadata = None if args.metadata is not None: @@ -278,10 +286,11 @@ def do_create(cs, args): @utils.arg('volume', metavar='', nargs='+', - help='Name or ID of the volume(s) to delete.') + help='Name or ID of volume to delete. ' + 'Separate multiple volumes with a space.') @utils.service_type('volume') def do_delete(cs, args): - """Remove volume(s).""" + """Removes one or more volumes.""" failure_count = 0 for volume in args.volume: try: @@ -295,10 +304,11 @@ def do_delete(cs, args): @utils.arg('volume', metavar='', nargs='+', - help='Name or ID of the volume(s) to delete.') + help='Name or ID of volume to delete. ' + 'Separate multiple volumes with a space.') @utils.service_type('volume') def do_force_delete(cs, args): - """Attempt forced removal of volume(s), regardless of the state(s).""" + """Attempts force-delete of volume, regardless of state.""" failure_count = 0 for volume in args.volume: try: @@ -312,14 +322,16 @@ def do_force_delete(cs, args): @utils.arg('volume', metavar='', nargs='+', - help='Name or ID of the volume to modify.') + help='Name or ID of volume to modify. ' + 'Separate multiple volumes with a space.') @utils.arg('--state', metavar='', default='available', - help=('Indicate which state to assign the volume. Options include ' - 'available, error, creating, deleting, error_deleting. If no ' - 'state is provided, available will be used.')) + help=('The state to assign to the volume. Valid values are ' + '"available," "error," "creating," "deleting," or ' + '"error_deleting." ' + 'OPTIONAL: Default is "available."')) @utils.service_type('volume') def do_reset_state(cs, args): - """Explicitly update the state of a volume.""" + """Explicitly updates the volume state.""" failure_count = 0 single = (len(args.volume) == 1) @@ -340,15 +352,15 @@ def do_reset_state(cs, args): @utils.arg('volume', metavar='', - help='Name or ID of the volume to rename.') + help='Name or ID of volume to rename.') @utils.arg('display_name', nargs='?', metavar='', - help='New display-name for the volume.') + help='New display name for volume.') @utils.arg('--display-description', metavar='', - help='Optional volume description. (Default=None)', + help='Volume description. OPTIONAL: Default=None.', default=None) @utils.service_type('volume') def do_rename(cs, args): - """Rename a volume.""" + """Renames a volume.""" kwargs = {} if args.display_name is not None: kwargs['display_name'] = args.display_name @@ -364,19 +376,21 @@ def do_rename(cs, args): @utils.arg('volume', metavar='', - help='Name or ID of the volume to update metadata on.') + help='Name or ID of volume for which to update metadata.') @utils.arg('action', metavar='', choices=['set', 'unset'], - help="Actions: 'set' or 'unset'") + help="The action. Valid values are 'set' or 'unset.'") @utils.arg('metadata', metavar='', nargs='+', default=[], - help='Metadata to set/unset (only key is necessary on unset)') + help='The metadata key and pair to set or unset. ' + 'For unset, specify only the key. ' + 'OPTIONAL: Default=[].') @utils.service_type('volume') def do_metadata(cs, args): - """Set or Delete metadata on a volume.""" + """Sets or deletes volume metadata.""" volume = utils.find_volume(cs, args.volume) metadata = _extract_metadata(args) @@ -396,7 +410,7 @@ def do_metadata(cs, args): type=int, const=1, default=0, - help='Display information from all tenants (Admin only).') + help='Shows details for all tenants. Admin only.') @utils.arg( '--all_tenants', nargs='?', @@ -407,20 +421,20 @@ def do_metadata(cs, args): '--display-name', metavar='', default=None, - help='Filter results by display-name') + help='Filters list by a display name. OPTIONAL: Default=None.') @utils.arg( '--status', metavar='', default=None, - help='Filter results by status') + help='Filters list by a status. OPTIONAL: Default=None.') @utils.arg( '--volume-id', metavar='', default=None, - help='Filter results by volume-id') + help='Filters list by a volume ID. OPTIONAL: Default=None.') @utils.service_type('volume') def do_snapshot_list(cs, args): - """List all the snapshots.""" + """Lists all snapshots.""" all_tenants = int(os.environ.get("ALL_TENANTS", args.all_tenants)) search_opts = { 'all_tenants': all_tenants, @@ -436,28 +450,31 @@ def do_snapshot_list(cs, args): @utils.arg('snapshot', metavar='', - help='Name or ID of the snapshot.') + help='Name or ID of snapshot.') @utils.service_type('volume') def do_snapshot_show(cs, args): - """Show details about a snapshot.""" + """Shows snapshot details.""" snapshot = _find_volume_snapshot(cs, args.snapshot) _print_volume_snapshot(snapshot) @utils.arg('volume', metavar='', - help='Name or ID of the volume to snapshot') + help='Name or ID of volume to snapshot.') @utils.arg('--force', metavar='', - help='Optional flag to indicate whether ' - 'to snapshot a volume even if it\'s ' - 'attached to an instance. (Default=False)', + help='Allows or disallows snapshot of ' + 'a volume when the volume is attached to an instance. ' + 'If set to True, ignores the current status of the ' + 'volume when attempting to snapshot it rather ' + 'than forcing it to be available. ' + 'OPTIONAL: Default=False.', default=False) @utils.arg( '--display-name', metavar='', default=None, - help='Optional snapshot name. (Default=None)') + help='The snapshot name. OPTIONAL: Default=None.') @utils.arg( '--display_name', help=argparse.SUPPRESS) @@ -465,13 +482,13 @@ def do_snapshot_show(cs, args): '--display-description', metavar='', default=None, - help='Optional snapshot description. (Default=None)') + help='The snapshot description. OPTIONAL: Default=None.') @utils.arg( '--display_description', help=argparse.SUPPRESS) @utils.service_type('volume') def do_snapshot_create(cs, args): - """Add a new snapshot.""" + """Creates a snapshot.""" volume = utils.find_volume(cs, args.volume) snapshot = cs.volume_snapshots.create(volume.id, args.force, @@ -499,15 +516,15 @@ def do_snapshot_delete(cs, args): @utils.arg('snapshot', metavar='', - help='Name or ID of the snapshot.') + help='Name or ID of snapshot.') @utils.arg('display_name', nargs='?', metavar='', - help='New display-name for the snapshot.') + help='New display name for snapshot.') @utils.arg('--display-description', metavar='', - help='Optional snapshot description. (Default=None)', + help='Snapshot description. OPTIONAL: Default=None.', default=None) @utils.service_type('volume') def do_snapshot_rename(cs, args): - """Rename a snapshot.""" + """Renames a snapshot.""" kwargs = {} if args.display_name is not None: kwargs['display_name'] = args.display_name @@ -522,16 +539,16 @@ def do_snapshot_rename(cs, args): @utils.arg('snapshot', metavar='', nargs='+', - help='Name or ID of the snapshot to modify.') + help='Name or ID of snapshot to modify.') @utils.arg('--state', metavar='', default='available', - help=('Indicate which state to assign the snapshot. ' - 'Options include available, error, creating, deleting, ' - 'error_deleting. If no state is provided, ' - 'available will be used.')) + help=('The state to assign to the snapshot. Valid values are ' + '"available," "error," "creating," "deleting," or ' + '"error_deleting." ' + 'OPTIONAL: Default is "available."')) @utils.service_type('volume') def do_snapshot_reset_state(cs, args): - """Explicitly update the state of a snapshot.""" + """Explicitly updates the snapshot state.""" failure_count = 0 single = (len(args.snapshot) == 1) @@ -563,53 +580,54 @@ def _print_type_and_extra_specs_list(vtypes): @utils.service_type('volume') def do_type_list(cs, args): - """Print a list of available 'volume types'.""" + """Lists available 'volume types'.""" vtypes = cs.volume_types.list() _print_volume_type_list(vtypes) @utils.service_type('volume') def do_extra_specs_list(cs, args): - """Print a list of current 'volume types and extra specs' (Admin Only).""" + """Lists current volume types and extra specs. Admin only.""" vtypes = cs.volume_types.list() _print_type_and_extra_specs_list(vtypes) @utils.arg('name', metavar='', - help="Name of the new volume type") + help="Name for the volume type.") @utils.service_type('volume') def do_type_create(cs, args): - """Create a new volume type.""" + """Creates a volume type.""" vtype = cs.volume_types.create(args.name) _print_volume_type_list([vtype]) @utils.arg('id', metavar='', - help="Name or ID of the volume type to delete") + help="ID of volume type to delete.") @utils.service_type('volume') def do_type_delete(cs, args): - """Delete a specific volume type.""" + """Deletes a specified volume type.""" volume_type = _find_volume_type(cs, args.id) cs.volume_types.delete(volume_type) @utils.arg('vtype', metavar='', - help="Name or ID of the volume type") + help="Name or ID of volume type.") @utils.arg('action', metavar='', choices=['set', 'unset'], - help="Actions: 'set' or 'unset'") + help="The action. Valid values are 'set' or 'unset.'") @utils.arg('metadata', metavar='', nargs='*', default=None, - help='Extra_specs to set/unset (only key is necessary on unset)') + help='The extra specs key and value pair to set or unset. ' + 'For unset, specify only the key. OPTIONAL: Default=None.') @utils.service_type('volume') def do_type_key(cs, args): - """Set or unset extra_spec for a volume type.""" + """Sets or unsets extra_spec for a volume type.""" vtype = _find_volume_type(cs, args.vtype) if args.metadata is not None: @@ -622,14 +640,14 @@ def do_type_key(cs, args): def do_endpoints(cs, args): - """Discover endpoints that get returned from the authenticate services.""" + """Discovers endpoints registered by authentication service.""" catalog = cs.client.service_catalog.catalog for e in catalog['serviceCatalog']: utils.print_dict(e['endpoints'][0], e['name']) def do_credentials(cs, args): - """Show user credentials returned from auth.""" + """Shows user credentials returned from auth.""" catalog = cs.client.service_catalog.catalog utils.print_dict(catalog['user'], "User Credentials") utils.print_dict(catalog['token'], "Token") @@ -682,53 +700,53 @@ def _quota_update(manager, identifier, args): @utils.arg('tenant', metavar='', - help='UUID of tenant to list the quotas for.') + help='ID of the tenant for which to list quotas.') @utils.service_type('volume') def do_quota_show(cs, args): - """List the quotas for a tenant.""" + """Lists quotas for a tenant.""" _quota_show(cs.quotas.get(args.tenant)) @utils.arg('tenant', metavar='', - help='UUID of tenant to list the quota usage for.') + help='ID of the tenant for which to list quota usage.') @utils.service_type('volume') def do_quota_usage(cs, args): - """List the quota usage for a tenant.""" + """Lists quota usage for a tenant.""" _quota_usage_show(cs.quotas.get(args.tenant, usage=True)) @utils.arg('tenant', metavar='', - help='UUID of tenant to list the default quotas for.') + help='ID of the tenant for which to list default quotas.') @utils.service_type('volume') def do_quota_defaults(cs, args): - """List the default quotas for a tenant.""" + """Lists default quotas for a tenant.""" _quota_show(cs.quotas.defaults(args.tenant)) @utils.arg('tenant', metavar='', - help='UUID of tenant to set the quotas for.') + help='ID of the tenant for which to set quotas.') @utils.arg('--volumes', metavar='', type=int, default=None, - help='New value for the "volumes" quota.') + help='The new "volumes" quota value. OPTIONAL: Default=None.') @utils.arg('--snapshots', metavar='', type=int, default=None, - help='New value for the "snapshots" quota.') + help='The new "snapshots" quota value. OPTIONAL: Default=None.') @utils.arg('--gigabytes', metavar='', type=int, default=None, - help='New value for the "gigabytes" quota.') + help='The new "gigabytes" quota value. OPTIONAL: Default=None.') @utils.arg('--volume-type', metavar='', default=None, - help='Volume type (Optional, Default=None)') + help='Volume type. OPTIONAL: Default=None.') @utils.service_type('volume') def do_quota_update(cs, args): - """Update the quotas for a tenant.""" + """Updates quotas for a tenant.""" _quota_update(cs.quotas, args.tenant, args) @@ -743,42 +761,42 @@ def do_quota_delete(cs, args): @utils.arg('class_name', metavar='', - help='Name of quota class to list the quotas for.') + help='Name of quota class for which to list quotas.') @utils.service_type('volume') def do_quota_class_show(cs, args): - """List the quotas for a quota class.""" + """Lists quotas for a quota class.""" _quota_show(cs.quota_classes.get(args.class_name)) @utils.arg('class_name', metavar='', - help='Name of quota class to set the quotas for.') + help='Name of quota class for which to set quotas.') @utils.arg('--volumes', metavar='', type=int, default=None, - help='New value for the "volumes" quota.') + help='The new "volumes" quota value. OPTIONAL: Default=None.') @utils.arg('--snapshots', metavar='', type=int, default=None, - help='New value for the "snapshots" quota.') + help='The new "snapshots" quota value. OPTIONAL: Default=None.') @utils.arg('--gigabytes', metavar='', type=int, default=None, - help='New value for the "gigabytes" quota.') + help='The new "gigabytes" quota value. OPTIONAL: Default=None.') @utils.arg('--volume-type', metavar='', default=None, - help='Volume type (Optional, Default=None)') + help='Volume type. OPTIONAL: Default=None.') @utils.service_type('volume') def do_quota_class_update(cs, args): - """Update the quotas for a quota class.""" + """Updates quotas for a quota class.""" _quota_update(cs.quota_classes, args.class_name, args) @utils.service_type('volume') def do_absolute_limits(cs, args): - """Print a list of absolute limits for a user""" + """Lists absolute limits for a user.""" limits = cs.limits.get().absolute columns = ['Name', 'Value'] utils.print_list(limits, columns) @@ -786,7 +804,7 @@ def do_absolute_limits(cs, args): @utils.service_type('volume') def do_rate_limits(cs, args): - """Print a list of rate limits for a user""" + """Lists rate limits for a user.""" limits = cs.limits.get().rate columns = ['Verb', 'URI', 'Value', 'Remain', 'Unit', 'Next_Available'] utils.print_list(limits, columns) @@ -800,35 +818,35 @@ def _print_type_extra_specs(vol_type): def _find_volume_type(cs, vtype): - """Get a volume type by name or ID.""" + """Gets a volume type by name or ID.""" return utils.find_resource(cs.volume_types, vtype) @utils.arg('volume', metavar='', - help='Name or ID of the volume to upload to an image') + help='Name or ID of volume to upload to an image.') @utils.arg('--force', metavar='', - help='Optional flag to indicate whether ' - 'to upload a volume even if it\'s ' - 'attached to an instance. (Default=False)', + help='Enables or disables upload of ' + 'a volume that is attached to an instance. ' + 'OPTIONAL: Default=False.', default=False) @utils.arg('--container-format', metavar='', - help='Optional type for container format ' - '(Default=bare)', + help='Container format type. ' + 'OPTIONAL: Default is bare.', default='bare') @utils.arg('--disk-format', metavar='', - help='Optional type for disk format ' - '(Default=raw)', + help='Disk format type. ' + 'OPTIONAL: Default is raw.', default='raw') @utils.arg('image_name', metavar='', - help='Name for created image') + help='The new image name.') @utils.service_type('volume') def do_upload_to_image(cs, args): - """Upload volume to image service as image.""" + """Uploads volume to Image Service as an image.""" volume = utils.find_volume(cs, args.volume) _print_volume_image(volume.upload_to_image(args.force, args.image_name, @@ -837,19 +855,19 @@ def do_upload_to_image(cs, args): @utils.arg('volume', metavar='', - help='Name or ID of the volume to backup.') + help='Name or ID of volume to back up.') @utils.arg('--container', metavar='', - help='Optional Backup container name. (Default=None)', + help='Backup container name. OPTIONAL: Default=None.', default=None) @utils.arg('--display-name', metavar='', - help='Optional backup name. (Default=None)', + help='Backup name. OPTIONAL: Default=None.', default=None) @utils.arg('--display-description', metavar='', - help='Optional backup description. (Default=None)', + help='Backup description. OPTIONAL: Default=None.', default=None) @utils.service_type('volume') def do_backup_create(cs, args): - """Creates a backup.""" + """Creates a volume backup.""" volume = utils.find_volume(cs, args.volume) backup = cs.backups.create(volume.id, args.container, @@ -865,10 +883,10 @@ def do_backup_create(cs, args): utils.print_dict(info) -@utils.arg('backup', metavar='', help='Name or ID of the backup.') +@utils.arg('backup', metavar='', help='Name or ID of backup.') @utils.service_type('volume') def do_backup_show(cs, args): - """Show details about a backup.""" + """Show backup details.""" backup = _find_backup(cs, args.backup) info = dict() info.update(backup._info) @@ -881,7 +899,7 @@ def do_backup_show(cs, args): @utils.service_type('volume') def do_backup_list(cs, args): - """List all the backups.""" + """Lists all backups.""" backups = cs.backups.list() columns = ['ID', 'Volume ID', 'Status', 'Name', 'Size', 'Object Count', 'Container'] @@ -889,22 +907,23 @@ def do_backup_list(cs, args): @utils.arg('backup', metavar='', - help='Name or ID of the backup to delete.') + help='Name or ID of backup to delete.') @utils.service_type('volume') def do_backup_delete(cs, args): - """Remove a backup.""" + """Removes a backup.""" backup = _find_backup(cs, args.backup) backup.delete() @utils.arg('backup', metavar='', - help='ID of the backup to restore.') + help='ID of backup to restore.') @utils.arg('--volume-id', metavar='', - help='Optional ID(or name) of the volume to restore to.', + help='ID or name of backup volume to ' + 'which to restore. OPTIONAL: Default=None.', default=None) @utils.service_type('volume') def do_backup_restore(cs, args): - """Restore a backup.""" + """Restores a backup.""" if args.volume_id: volume_id = utils.find_volume(cs, args.volume_id).id else: @@ -913,9 +932,9 @@ def do_backup_restore(cs, args): @utils.arg('volume', metavar='', - help='Name or ID of the volume to transfer.') + help='Name or ID of volume to transfer.') @utils.arg('--display-name', metavar='', - help='Optional transfer name. (Default=None)', + help='Transfer name. OPTIONAL: Default=None.', default=None) @utils.service_type('volume') def do_transfer_create(cs, args): @@ -933,18 +952,18 @@ def do_transfer_create(cs, args): @utils.arg('transfer', metavar='', - help='Name or ID of the transfer to delete.') + help='Name or ID of transfer to delete.') @utils.service_type('volume') def do_transfer_delete(cs, args): - """Undo a transfer.""" + """Undoes a transfer.""" transfer = _find_transfer(cs, args.transfer) transfer.delete() @utils.arg('transfer', metavar='', - help='ID of the transfer to accept.') + help='ID of transfer to accept.') @utils.arg('auth_key', metavar='', - help='Auth key of the transfer to accept.') + help='Authentication key of transfer to accept.') @utils.service_type('volume') def do_transfer_accept(cs, args): """Accepts a volume transfer.""" @@ -960,17 +979,17 @@ def do_transfer_accept(cs, args): @utils.service_type('volume') def do_transfer_list(cs, args): - """List all the transfers.""" + """Lists all transfers.""" transfers = cs.transfers.list() columns = ['ID', 'Volume ID', 'Name'] utils.print_list(transfers, columns) @utils.arg('transfer', metavar='', - help='Name or ID of the transfer to accept.') + help='Name or ID of transfer to accept.') @utils.service_type('volume') def do_transfer_show(cs, args): - """Show details about a transfer.""" + """Show transfer details.""" transfer = _find_transfer(cs, args.transfer) info = dict() info.update(transfer._info) @@ -982,25 +1001,25 @@ def do_transfer_show(cs, args): @utils.arg('volume', metavar='', - help='Name or ID of the volume to extend.') + help='Name or ID of volume to extend.') @utils.arg('new_size', metavar='', type=int, - help='New size of volume in GB') + help='Size of volume, in GBs.') @utils.service_type('volume') def do_extend(cs, args): - """Attempt to extend the size of an existing volume.""" + """Attempts to extend size of an existing volume.""" volume = utils.find_volume(cs, args.volume) cs.volumes.extend(volume, args.new_size) @utils.arg('--host', metavar='', default=None, - help='Name of host.') + help='Host name. OPTIONAL: Default=None.') @utils.arg('--binary', metavar='', default=None, - help='Service binary.') + help='Service binary. OPTIONAL: Default=None.') @utils.service_type('volume') def do_service_list(cs, args): - """List all the services. Filter by host & service binary.""" + """Lists all services. Filter by host and service binary.""" result = cs.services.list(host=args.host, binary=args.binary) columns = ["Binary", "Host", "Zone", "Status", "State", "Updated_at"] # NOTE(jay-lau-513): we check if the response has disabled_reason @@ -1010,23 +1029,23 @@ def do_service_list(cs, args): utils.print_list(result, columns) -@utils.arg('host', metavar='', help='Name of host.') +@utils.arg('host', metavar='', help='Host name.') @utils.arg('binary', metavar='', help='Service binary.') @utils.service_type('volume') def do_service_enable(cs, args): - """Enable the service.""" + """Enables the service.""" result = cs.services.enable(args.host, args.binary) columns = ["Host", "Binary", "Status"] utils.print_list([result], columns) -@utils.arg('host', metavar='', help='Name of host.') +@utils.arg('host', metavar='', help='Host name.') @utils.arg('binary', metavar='', help='Service binary.') @utils.arg('--reason', metavar='', help='Reason for disabling service.') @utils.service_type('volume') def do_service_disable(cs, args): - """Disable the service.""" + """Disables the service.""" columns = ["Host", "Binary", "Status"] if args.reason: columns.append('Disabled Reason') @@ -1038,7 +1057,7 @@ def do_service_disable(cs, args): def _treeizeAvailabilityZone(zone): - """Build a tree view for availability zones.""" + """Builds a tree view for availability zones.""" AvailabilityZone = availability_zones.AvailabilityZone az = AvailabilityZone(zone.manager, @@ -1081,7 +1100,7 @@ def _treeizeAvailabilityZone(zone): @utils.service_type('volume') def do_availability_zone_list(cs, _args): - """List all the availability zones.""" + """Lists all availability zones.""" try: availability_zones = cs.availability_zones.list() except exceptions.Forbidden as e: # policy doesn't allow probably @@ -1099,7 +1118,7 @@ def do_availability_zone_list(cs, _args): def _print_volume_encryption_type_list(encryption_types): """ - Display a tabularized list of volume encryption types. + Lists volume encryption types. :param encryption_types: a list of :class: VolumeEncryptionType instances """ @@ -1110,7 +1129,7 @@ def _print_volume_encryption_type_list(encryption_types): @utils.service_type('volume') def do_encryption_type_list(cs, args): - """List encryption type information for all volume types (Admin Only).""" + """Shows encryption type details for volume types. Admin only.""" result = cs.volume_encryption_types.list() utils.print_list(result, ['Volume Type ID', 'Provider', 'Cipher', 'Key Size', 'Control Location']) @@ -1119,10 +1138,10 @@ def do_encryption_type_list(cs, args): @utils.arg('volume_type', metavar='', type=str, - help="Name or ID of the volume type") + help="Name or ID of volume type.") @utils.service_type('volume') def do_encryption_type_show(cs, args): - """Show the encryption type information for a volume type (Admin Only).""" + """Shows encryption type details for volume type. Admin only.""" volume_type = _find_volume_type(cs, args.volume_type) result = cs.volume_encryption_types.get(volume_type) @@ -1137,37 +1156,39 @@ def do_encryption_type_show(cs, args): @utils.arg('volume_type', metavar='', type=str, - help="Name or ID of the volume type") + help="Name or ID of volume type.") @utils.arg('provider', metavar='', type=str, - help="Class providing encryption support (e.g. LuksEncryptor)") + help='The class that provides encryption support. ' + 'For example, a volume driver class path.') @utils.arg('--cipher', metavar='', type=str, required=False, default=None, - help="Encryption algorithm/mode to use (e.g., aes-xts-plain64) " - "(Optional, Default=None)") + help='The encryption algorithm and mode. ' + 'For example, aes-xts-plain64. OPTIONAL: Default=None.') @utils.arg('--key_size', metavar='', type=int, required=False, default=None, - help="Size of the encryption key, in bits (e.g., 128, 256) " - "(Optional, Default=None)") + help='Size of encryption key, in bits. ' + 'For example, 128 or 256. OPTIONAL: Default=None.') @utils.arg('--control_location', metavar='', choices=['front-end', 'back-end'], type=str, required=False, default='front-end', - help="Notional service where encryption is performed (e.g., " - "front-end=Nova) Values: 'front-end', 'back-end' " - "(Default='front-end')") + help='Notional service where encryption is performed. ' + 'Valid values are "front-end" or "back-end." ' + 'For example, front-end=Nova. ' + 'OPTIONAL: Default is "front-end."') @utils.service_type('volume') def do_encryption_type_create(cs, args): - """Create a new encryption type for a volume type (Admin Only).""" + """Creates encryption type for a volume type. Admin only.""" volume_type = _find_volume_type(cs, args.volume_type) body = {} @@ -1183,25 +1204,25 @@ def do_encryption_type_create(cs, args): @utils.arg('volume_type', metavar='', type=str, - help="Name or ID of the volume type") + help="Name or ID of volume type.") @utils.service_type('volume') def do_encryption_type_delete(cs, args): - """Delete the encryption type for a volume type (Admin Only).""" + """Deletes encryption type for a volume type. Admin only.""" volume_type = _find_volume_type(cs, args.volume_type) cs.volume_encryption_types.delete(volume_type) -@utils.arg('volume', metavar='', help='ID of the volume to migrate') -@utils.arg('host', metavar='', help='Destination host') +@utils.arg('volume', metavar='', help='ID of volume to migrate.') +@utils.arg('host', metavar='', help='Destination host.') @utils.arg('--force-host-copy', metavar='', choices=['True', 'False'], required=False, - help='Optional flag to force the use of the generic ' - 'host-based migration mechanism, bypassing driver ' - 'optimizations (Default=False).', + help='Enables or disables generic host-based ' + 'force-migration, which bypasses driver ' + 'optimizations. OPTIONAL: Default=False.', default=False) @utils.service_type('volume') def do_migrate(cs, args): - """Migrate the volume to the new host.""" + """Migrates volume to a new host.""" volume = utils.find_volume(cs, args.volume) volume.migrate_volume(args.host, args.force_host_copy) @@ -1225,15 +1246,15 @@ def _print_associations_list(associations): @utils.arg('name', metavar='', - help="Name of the new QoS specs") + help="Name of new QoS specifications.") @utils.arg('metadata', metavar='', nargs='+', default=[], - help='Specifications for QoS') + help='Specifications for QoS.') @utils.service_type('volume') def do_qos_create(cs, args): - """Create a new qos specs.""" + """Creates a qos specs.""" keypair = None if args.metadata is not None: keypair = _extract_metadata(args) @@ -1243,75 +1264,76 @@ def do_qos_create(cs, args): @utils.service_type('volume') def do_qos_list(cs, args): - """Get full list of qos specs.""" + """Lists qos specs.""" qos_specs = cs.qos_specs.list() _print_qos_specs_list(qos_specs) @utils.arg('qos_specs', metavar='', - help='ID of the qos_specs to show.') + help='ID of QoS specifications.') @utils.service_type('volume') def do_qos_show(cs, args): - """Get a specific qos specs.""" + """Shows a specified qos specs.""" qos_specs = _find_qos_specs(cs, args.qos_specs) _print_qos_specs(qos_specs) @utils.arg('qos_specs', metavar='', - help='ID of the qos_specs to delete.') + help='ID of QoS specifications.') @utils.arg('--force', metavar='', default=False, - help='Optional flag that indicates whether to delete ' - 'specified qos specs even if it is in-use.') + help='Enables or disables deletion of in-use ' + 'QoS specifications. OPTIONAL: Default=False.') @utils.service_type('volume') def do_qos_delete(cs, args): - """Delete a specific qos specs.""" + """Deletes a specified qos specs.""" force = strutils.bool_from_string(args.force) qos_specs = _find_qos_specs(cs, args.qos_specs) cs.qos_specs.delete(qos_specs, force) @utils.arg('qos_specs', metavar='', - help='ID of qos_specs.') + help='ID of QoS specifications.') @utils.arg('vol_type_id', metavar='', - help='ID of volume type to be associated with.') + help='ID of volume type.') @utils.service_type('volume') def do_qos_associate(cs, args): - """Associate qos specs with specific volume type.""" + """Associates qos specs with specified volume type.""" cs.qos_specs.associate(args.qos_specs, args.vol_type_id) @utils.arg('qos_specs', metavar='', - help='ID of qos_specs.') + help='ID of QoS specifications.') @utils.arg('vol_type_id', metavar='', - help='ID of volume type to be associated with.') + help='ID of volume type.') @utils.service_type('volume') def do_qos_disassociate(cs, args): - """Disassociate qos specs from specific volume type.""" + """Disassociates qos specs from specified volume type.""" cs.qos_specs.disassociate(args.qos_specs, args.vol_type_id) @utils.arg('qos_specs', metavar='', - help='ID of qos_specs to be operate on.') + help='ID of QoS specifications.') @utils.service_type('volume') def do_qos_disassociate_all(cs, args): - """Disassociate qos specs from all of its associations.""" + """Disassociates qos specs from all associations.""" cs.qos_specs.disassociate_all(args.qos_specs) @utils.arg('qos_specs', metavar='', - help='ID of qos specs') + help='ID of QoS specifications.') @utils.arg('action', metavar='', choices=['set', 'unset'], - help="Actions: 'set' or 'unset'") + help="The action. Valid values are 'set' or 'unset.'") @utils.arg('metadata', metavar='key=value', nargs='+', default=[], - help='QoS specs to set/unset (only key is necessary on unset)') + help='Metadata key and value pair to set or unset. ' + 'For unset, specify only the key.') def do_qos_key(cs, args): - """Set or unset specifications for a qos spec.""" + """Sets or unsets specifications for a qos spec.""" keypair = _extract_metadata(args) if args.action == 'set': @@ -1321,29 +1343,30 @@ def do_qos_key(cs, args): @utils.arg('qos_specs', metavar='', - help='ID of the qos_specs.') + help='ID of QoS specifications.') @utils.service_type('volume') def do_qos_get_association(cs, args): - """Get all associations of specific qos specs.""" + """Gets all associations for specified qos specs.""" associations = cs.qos_specs.get_associations(args.qos_specs) _print_associations_list(associations) @utils.arg('snapshot', metavar='', - help='ID of the snapshot to update metadata on.') + help='ID of snapshot for which to update metadata.') @utils.arg('action', metavar='', choices=['set', 'unset'], - help="Actions: 'set' or 'unset'") + help="The action. Valid values are 'set' or 'unset.'") @utils.arg('metadata', metavar='', nargs='+', default=[], - help='Metadata to set/unset (only key is necessary on unset)') + help='The metadata key and value pair to set or unset. ' + 'For unset, specify only the key.') @utils.service_type('volume') def do_snapshot_metadata(cs, args): - """Set or Delete metadata of a snapshot.""" + """Sets or deletes snapshot metadata.""" snapshot = _find_volume_snapshot(cs, args.snapshot) metadata = _extract_metadata(args) @@ -1355,34 +1378,35 @@ def do_snapshot_metadata(cs, args): @utils.arg('snapshot', metavar='', - help='ID of snapshot') + help='ID of snapshot.') @utils.service_type('volume') def do_snapshot_metadata_show(cs, args): - """Show metadata of given snapshot.""" + """Shows snapshot metadata.""" snapshot = _find_volume_snapshot(cs, args.snapshot) utils.print_dict(snapshot._info['metadata'], 'Metadata-property') @utils.arg('volume', metavar='', - help='ID of volume') + help='ID of volume.') @utils.service_type('volume') def do_metadata_show(cs, args): - """Show metadata of given volume.""" + """Shows volume metadata.""" volume = utils.find_volume(cs, args.volume) utils.print_dict(volume._info['metadata'], 'Metadata-property') @utils.arg('volume', metavar='', - help='ID of the volume to update metadata on.') + help='ID of volume for which to update metadata.') @utils.arg('metadata', metavar='', nargs='+', default=[], - help='Metadata entry/entries to update.') + help='Metadata key and value pair or pairs to update. ' + 'OPTIONAL: Default=[].') @utils.service_type('volume') def do_metadata_update_all(cs, args): - """Update all metadata of a volume.""" + """Updates volume metadata.""" volume = utils.find_volume(cs, args.volume) metadata = _extract_metadata(args) metadata = volume.update_all_metadata(metadata) @@ -1391,30 +1415,31 @@ def do_metadata_update_all(cs, args): @utils.arg('snapshot', metavar='', - help='ID of the snapshot to update metadata on.') + help='ID of snapshot for which to update metadata.') @utils.arg('metadata', metavar='', nargs='+', default=[], - help='Metadata entry/entries to update.') + help='Metadata key and value pair or pairs to update. ' + 'OPTIONAL: Default=[].') @utils.service_type('volume') def do_snapshot_metadata_update_all(cs, args): - """Update all metadata of a snapshot.""" + """Updates snapshot metadata.""" snapshot = _find_volume_snapshot(cs, args.snapshot) metadata = _extract_metadata(args) metadata = snapshot.update_all_metadata(metadata) utils.print_dict(metadata) -@utils.arg('volume', metavar='', help='ID of the volume to update.') +@utils.arg('volume', metavar='', help='ID of volume to update.') @utils.arg('read_only', metavar='', choices=['True', 'true', 'False', 'false'], - help='Flag to indicate whether to update volume to ' + help='Enables or disables update of volume to ' 'read-only access mode.') @utils.service_type('volume') def do_readonly_mode_update(cs, args): - """Update volume read-only access mode read_only.""" + """Updates volume read-only access-mode flag.""" volume = utils.find_volume(cs, args.volume) cs.volumes.update_readonly_flag(volume, strutils.bool_from_string(args.read_only)) diff --git a/cinderclient/v1/volume_backups.py b/cinderclient/v1/volume_backups.py index 89056af64..8e1f2e756 100644 --- a/cinderclient/v1/volume_backups.py +++ b/cinderclient/v1/volume_backups.py @@ -36,7 +36,7 @@ class VolumeBackupManager(base.ManagerWithFind): def create(self, volume_id, container=None, name=None, description=None): - """Create a volume backup. + """Creates a volume backup. :param volume_id: The ID of the volume to backup. :param container: The name of the backup service container. diff --git a/cinderclient/v1/volume_encryption_types.py b/cinderclient/v1/volume_encryption_types.py index 8385add7e..1099bc37b 100644 --- a/cinderclient/v1/volume_encryption_types.py +++ b/cinderclient/v1/volume_encryption_types.py @@ -65,7 +65,7 @@ class VolumeEncryptionTypeManager(base.ManagerWithFind): def create(self, volume_type, specs): """ - Create a new encryption type for the specified volume type. + Creates encryption type for a volume type. Default: admin only. :param volume_type: the volume type on which to add an encryption type :param specs: the encryption type specifications to add diff --git a/cinderclient/v1/volume_transfers.py b/cinderclient/v1/volume_transfers.py index a549cb631..00daf3ec5 100644 --- a/cinderclient/v1/volume_transfers.py +++ b/cinderclient/v1/volume_transfers.py @@ -35,7 +35,7 @@ class VolumeTransferManager(base.ManagerWithFind): resource_class = VolumeTransfer def create(self, volume_id, name=None): - """Create a volume transfer. + """Creates a volume transfer. :param volume_id: The ID of the volume to transfer. :param name: The name of the transfer. diff --git a/cinderclient/v1/volume_types.py b/cinderclient/v1/volume_types.py index abfa43ede..7e1a779f6 100644 --- a/cinderclient/v1/volume_types.py +++ b/cinderclient/v1/volume_types.py @@ -107,7 +107,7 @@ class VolumeTypeManager(base.ManagerWithFind): def create(self, name): """ - Create a volume type. + Creates a volume type. :param name: Descriptive name of the volume type :rtype: :class:`VolumeType` diff --git a/cinderclient/v1/volumes.py b/cinderclient/v1/volumes.py index 96ad94de5..4c8ee3b0a 100644 --- a/cinderclient/v1/volumes.py +++ b/cinderclient/v1/volumes.py @@ -149,7 +149,7 @@ class VolumeManager(base.ManagerWithFind): project_id=None, availability_zone=None, metadata=None, imageRef=None): """ - Create a volume. + Creates a volume. :param size: Size of volume in GB :param snapshot_id: ID of the snapshot diff --git a/cinderclient/v2/availability_zones.py b/cinderclient/v2/availability_zones.py index c8aef24cf..aec2279ab 100644 --- a/cinderclient/v2/availability_zones.py +++ b/cinderclient/v2/availability_zones.py @@ -31,7 +31,7 @@ class AvailabilityZoneManager(base.ManagerWithFind): resource_class = AvailabilityZone def list(self, detailed=False): - """Get a list of all availability zones + """Lists all availability zones. :rtype: list of :class:`AvailabilityZone` """ diff --git a/cinderclient/v2/contrib/list_extensions.py b/cinderclient/v2/contrib/list_extensions.py index 2a3f2bef0..e457e8bb9 100644 --- a/cinderclient/v2/contrib/list_extensions.py +++ b/cinderclient/v2/contrib/list_extensions.py @@ -39,7 +39,9 @@ class ListExtManager(base.Manager): @utils.service_type('volumev2') def do_list_extensions(client, _args): - """List all the os-api extensions that are available.""" + """ + Lists all available os-api extensions. + """ extensions = client.list_extensions.show_all() fields = ["Name", "Summary", "Alias", "Updated"] utils.print_list(extensions, fields) diff --git a/cinderclient/v2/shell.py b/cinderclient/v2/shell.py index 4773f3b31..77a432685 100644 --- a/cinderclient/v2/shell.py +++ b/cinderclient/v2/shell.py @@ -1,17 +1,18 @@ -# Copyright (c) 2013 OpenStack Foundation +# Copyright (c) 2013-2014 OpenStack Foundation # All Rights Reserved. # -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. from __future__ import print_function @@ -31,7 +32,7 @@ from cinderclient.v2 import availability_zones def _poll_for_status(poll_fn, obj_id, action, final_ok_states, poll_period=5, show_progress=True): - """Block while action is performed, periodically printing progress.""" + """Blocks while an action occurs. Periodically shows progress.""" def print_progress(progress): if show_progress: msg = ('\rInstance %(action)s... %(progress)s%% complete' @@ -60,22 +61,22 @@ def _poll_for_status(poll_fn, obj_id, action, final_ok_states, def _find_volume_snapshot(cs, snapshot): - """Get a volume snapshot by name or ID.""" + """Gets a volume snapshot by name or ID.""" return utils.find_resource(cs.volume_snapshots, snapshot) def _find_backup(cs, backup): - """Get a backup by name or ID.""" + """Gets a backup by name or ID.""" return utils.find_resource(cs.backups, backup) def _find_transfer(cs, transfer): - """Get a transfer by name or ID.""" + """Gets a transfer by name or ID.""" return utils.find_resource(cs.transfers, transfer) def _find_qos_specs(cs, qos_specs): - """Get a qos specs by ID.""" + """Gets a qos specs by ID.""" return utils.find_resource(cs.qos_specs, qos_specs) @@ -131,7 +132,7 @@ def _extract_metadata(args): type=int, const=1, default=0, - help='Display information from all tenants (Admin only).') + help='Shows details for all tenants. Admin only.') @utils.arg('--all_tenants', nargs='?', type=int, @@ -140,22 +141,23 @@ def _extract_metadata(args): @utils.arg('--name', metavar='', default=None, - help='Filter results by name') + help='Filters results by a name. OPTIONAL: Default=None.') @utils.arg('--display-name', help=argparse.SUPPRESS) @utils.arg('--status', metavar='', default=None, - help='Filter results by status') + help='Filters results by a status. OPTIONAL: Default=None.') @utils.arg('--metadata', type=str, nargs='*', metavar='', - help='Filter results by metadata', + help='Filters results by a metadata key and value pair. ' + 'OPTIONAL: Default=None.', default=None) @utils.service_type('volumev2') def do_list(cs, args): - """List all the volumes.""" + """Lists all volumes.""" # NOTE(thingee): Backwards-compatibility with v1 args if args.display_name is not None: args.name = args.display_name @@ -181,10 +183,10 @@ def do_list(cs, args): @utils.arg('volume', metavar='', - help='Name or ID of the volume.') + help='Name or ID of volume.') @utils.service_type('volumev2') def do_show(cs, args): - """Show details about a volume.""" + """Shows volume details.""" info = dict() volume = utils.find_volume(cs, args.volume) info.update(volume._info) @@ -196,29 +198,29 @@ def do_show(cs, args): @utils.arg('size', metavar='', type=int, - help='Size of volume in GB') + help='Size of volume, in GBs.') @utils.arg('--snapshot-id', metavar='', default=None, - help='Create volume from snapshot id (Optional, Default=None)') + help='Creates volume from snapshot ID. OPTIONAL: Default=None.') @utils.arg('--snapshot_id', help=argparse.SUPPRESS) @utils.arg('--source-volid', metavar='', default=None, - help='Create volume from volume id (Optional, Default=None)') + help='Creates volume from volume ID. OPTIONAL: Default=None.') @utils.arg('--source_volid', help=argparse.SUPPRESS) @utils.arg('--image-id', metavar='', default=None, - help='Create volume from image id (Optional, Default=None)') + help='Creates volume from image ID. OPTIONAL: Default=None.') @utils.arg('--image_id', help=argparse.SUPPRESS) @utils.arg('--name', metavar='', default=None, - help='Volume name (Optional, Default=None)') + help='Volume name. OPTIONAL: Default=None.') @utils.arg('--display-name', help=argparse.SUPPRESS) @utils.arg('--display_name', @@ -226,7 +228,7 @@ def do_show(cs, args): @utils.arg('--description', metavar='', default=None, - help='Volume description (Optional, Default=None)') + help='Volume description. OPTIONAL: Default=None.') @utils.arg('--display-description', help=argparse.SUPPRESS) @utils.arg('--display_description', @@ -234,30 +236,30 @@ def do_show(cs, args): @utils.arg('--volume-type', metavar='', default=None, - help='Volume type (Optional, Default=None)') + help='Volume type. OPTIONAL: Default=None.') @utils.arg('--volume_type', help=argparse.SUPPRESS) @utils.arg('--availability-zone', metavar='', default=None, - help='Availability zone for volume (Optional, Default=None)') + help='Availability zone for volume. OPTIONAL: Default=None.') @utils.arg('--availability_zone', help=argparse.SUPPRESS) @utils.arg('--metadata', type=str, nargs='*', metavar='', - help='Metadata key=value pairs (Optional, Default=None)', + help='Metadata key and value pairs. OPTIONAL: Default=None.', default=None) @utils.arg('--hint', metavar='', dest='scheduler_hints', action='append', default=[], - help='Scheduler hint like in nova') + help='Scheduler hint, like in nova.') @utils.service_type('volumev2') def do_create(cs, args): - """Add a new volume.""" + """Creates a volume.""" # NOTE(thingee): Backwards-compatibility with v1 args if args.display_name is not None: args.name = args.display_name @@ -274,7 +276,7 @@ def do_create(cs, args): if args.scheduler_hints: for hint in args.scheduler_hints: key, _sep, value = hint.partition('=') - # NOTE(vish): multiple copies of the same hint will + # NOTE(vish): multiple copies of same hint will # result in a list of values if key in hints: if isinstance(hints[key], six.string_types): @@ -282,7 +284,7 @@ def do_create(cs, args): hints[key] += [value] else: hints[key] = value - #NOTE(N.S.): end of the taken piece + #NOTE(N.S.): end of taken piece volume = cs.volumes.create(args.size, args.snapshot_id, @@ -305,10 +307,10 @@ def do_create(cs, args): @utils.arg('volume', metavar='', nargs='+', - help='Name or ID of the volume(s) to delete.') + help='Name or ID of volume or volumes to delete.') @utils.service_type('volumev2') def do_delete(cs, args): - """Remove a volume(s).""" + """Removes one or more volumes.""" failure_count = 0 for volume in args.volume: try: @@ -317,16 +319,16 @@ def do_delete(cs, args): failure_count += 1 print("Delete for volume %s failed: %s" % (volume, e)) if failure_count == len(args.volume): - raise exceptions.CommandError("Unable to delete any of the specified " + raise exceptions.CommandError("Unable to delete any of specified " "volumes.") @utils.arg('volume', metavar='', nargs='+', - help='Name or ID of the volume(s) to delete.') + help='Name or ID of volume or volumes to delete.') @utils.service_type('volumev2') def do_force_delete(cs, args): - """Attempt forced removal of volume(s), regardless of the state(s).""" + """Attempts force-delete of volume, regardless of state.""" failure_count = 0 for volume in args.volume: try: @@ -335,19 +337,20 @@ def do_force_delete(cs, args): failure_count += 1 print("Delete for volume %s failed: %s" % (volume, e)) if failure_count == len(args.volume): - raise exceptions.CommandError("Unable to force delete any of the " + raise exceptions.CommandError("Unable to force delete any of " "specified volumes.") @utils.arg('volume', metavar='', nargs='+', - help='Name or ID of the volume to modify.') + help='Name or ID of volume to modify.') @utils.arg('--state', metavar='', default='available', - help=('Indicate which state to assign the volume. Options include ' - 'available, error, creating, deleting, error_deleting. If no ' - 'state is provided, available will be used.')) + help=('The state to assign to the volume. Valid values are ' + '"available," "error," "creating," "deleting," and ' + '"error_deleting." ' + 'OPTIONAL: Default is available.')) @utils.service_type('volumev2') def do_reset_state(cs, args): - """Explicitly update the state of a volume.""" + """Explicitly updates the volume state.""" failure_count = 0 single = (len(args.volume) == 1) @@ -363,19 +366,19 @@ def do_reset_state(cs, args): if failure_count == len(args.volume): if not single: - msg = "Unable to reset the state for any of the specified volumes." + msg = "Unable to reset the state for any of specified volumes." raise exceptions.CommandError(msg) @utils.arg('volume', metavar='', - help='Name or ID of the volume to rename.') + help='Name or ID of volume to rename.') @utils.arg('name', nargs='?', metavar='', - help='New name for the volume.') + help='New name for volume.') @utils.arg('--description', metavar='', - help='Optional volume description. (Default=None)', + help='Volume description. OPTIONAL: Default=None.', default=None) @utils.arg('--display-description', help=argparse.SUPPRESS) @@ -383,7 +386,7 @@ def do_reset_state(cs, args): help=argparse.SUPPRESS) @utils.service_type('volumev2') def do_rename(cs, args): - """Rename a volume.""" + """Renames a volume.""" kwargs = {} if args.name is not None: @@ -402,19 +405,20 @@ def do_rename(cs, args): @utils.arg('volume', metavar='', - help='Name or ID of the volume to update metadata on.') + help='Name or ID of volume for which to update metadata.') @utils.arg('action', metavar='', choices=['set', 'unset'], - help="Actions: 'set' or 'unset'") + help="The action. Valid values are 'set' or 'unset.'") @utils.arg('metadata', metavar='', nargs='+', default=[], - help='Metadata to set/unset (only key is necessary on unset)') + help='Metadata key and value pair to set or unset. ' + 'For unset, specify only the key.') @utils.service_type('volumev2') def do_metadata(cs, args): - """Set or Delete metadata on a volume.""" + """Sets or deletes volume metadata.""" volume = utils.find_volume(cs, args.volume) metadata = _extract_metadata(args) @@ -433,7 +437,7 @@ def do_metadata(cs, args): type=int, const=1, default=0, - help='Display information from all tenants (Admin only).') + help='Shows details for all tenants. Admin only.') @utils.arg('--all_tenants', nargs='?', type=int, @@ -442,7 +446,7 @@ def do_metadata(cs, args): @utils.arg('--name', metavar='', default=None, - help='Filter results by name') + help='Filters results by a name. OPTIONAL: Default=None.') @utils.arg('--display-name', help=argparse.SUPPRESS) @utils.arg('--display_name', @@ -450,16 +454,16 @@ def do_metadata(cs, args): @utils.arg('--status', metavar='', default=None, - help='Filter results by status') + help='Filters results by a status. OPTIONAL: Default=None.') @utils.arg('--volume-id', metavar='', default=None, - help='Filter results by volume-id') + help='Filters results by a volume ID. OPTIONAL: Default=None.') @utils.arg('--volume_id', help=argparse.SUPPRESS) @utils.service_type('volumev2') def do_snapshot_list(cs, args): - """List all the snapshots.""" + """Lists all snapshots.""" all_tenants = int(os.environ.get("ALL_TENANTS", args.all_tenants)) if args.display_name is not None: @@ -480,27 +484,30 @@ def do_snapshot_list(cs, args): @utils.arg('snapshot', metavar='', - help='Name or ID of the snapshot.') + help='Name or ID of snapshot.') @utils.service_type('volumev2') def do_snapshot_show(cs, args): - """Show details about a snapshot.""" + """Shows snapshot details.""" snapshot = _find_volume_snapshot(cs, args.snapshot) _print_volume_snapshot(snapshot) @utils.arg('volume', metavar='', - help='Name or ID of the volume to snapshot') + help='Name or ID of volume to snapshot.') @utils.arg('--force', metavar='', - help='Optional flag to indicate whether ' - 'to snapshot a volume even if it\'s ' - 'attached to an instance. (Default=False)', + help='Allows or disallows snapshot of ' + 'a volume when the volume is attached to an instance. ' + 'If set to True, ignores the current status of the ' + 'volume when attempting to snapshot it rather ' + 'than forcing it to be available. ' + 'OPTIONAL: Default=False.', default=False) @utils.arg('--name', metavar='', default=None, - help='Optional snapshot name. (Default=None)') + help='Snapshot name. OPTIONAL: Default=None.') @utils.arg('--display-name', help=argparse.SUPPRESS) @utils.arg('--display_name', @@ -508,14 +515,14 @@ def do_snapshot_show(cs, args): @utils.arg('--description', metavar='', default=None, - help='Optional snapshot description. (Default=None)') + help='Snapshot description. OPTIONAL: Default=None.') @utils.arg('--display-description', help=argparse.SUPPRESS) @utils.arg('--display_description', help=argparse.SUPPRESS) @utils.service_type('volumev2') def do_snapshot_create(cs, args): - """Add a new snapshot.""" + """Creates a snapshot.""" if args.display_name is not None: args.name = args.display_name @@ -535,7 +542,7 @@ def do_snapshot_create(cs, args): help='Name or ID of the snapshot(s) to delete.') @utils.service_type('volumev2') def do_snapshot_delete(cs, args): - """Remove one or more snapshots.""" + """Removes one or more snapshots.""" failure_count = 0 for snapshot in args.snapshot: try: @@ -549,11 +556,11 @@ def do_snapshot_delete(cs, args): @utils.arg('snapshot', metavar='', - help='Name or ID of the snapshot.') + help='Name or ID of snapshot.') @utils.arg('name', nargs='?', metavar='', - help='New name for the snapshot.') + help='New name for snapshot.') @utils.arg('--description', metavar='', - help='Optional snapshot description. (Default=None)', + help='Snapshot description. OPTIONAL: Default=None.', default=None) @utils.arg('--display-description', help=argparse.SUPPRESS) @@ -561,7 +568,7 @@ def do_snapshot_delete(cs, args): help=argparse.SUPPRESS) @utils.service_type('volumev2') def do_snapshot_rename(cs, args): - """Rename a snapshot.""" + """Renames a snapshot.""" kwargs = {} if args.name is not None: @@ -580,16 +587,16 @@ def do_snapshot_rename(cs, args): @utils.arg('snapshot', metavar='', nargs='+', - help='Name or ID of the snapshot to modify.') + help='Name or ID of snapshot to modify.') @utils.arg('--state', metavar='', default='available', - help=('Indicate which state to assign the snapshot. ' - 'Options include available, error, creating, ' - 'deleting, error_deleting. If no state is provided, ' - 'available will be used.')) + help=('The state to assign to the snapshot. Valid values are ' + '"available," "error," "creating," "deleting," and ' + '"error_deleting." ' + 'OPTIONAL: Default is "available."')) @utils.service_type('volumev2') def do_snapshot_reset_state(cs, args): - """Explicitly update the state of a snapshot.""" + """Explicitly updates the snapshot state.""" failure_count = 0 single = (len(args.snapshot) == 1) @@ -605,7 +612,7 @@ def do_snapshot_reset_state(cs, args): if failure_count == len(args.snapshot): if not single: - msg = ("Unable to reset the state for any of the the specified " + msg = ("Unable to reset the state for any of the specified " "snapshots.") raise exceptions.CommandError(msg) @@ -621,53 +628,53 @@ def _print_type_and_extra_specs_list(vtypes): @utils.service_type('volumev2') def do_type_list(cs, args): - """Print a list of available 'volume types'.""" + """Lists available 'volume types'.""" vtypes = cs.volume_types.list() _print_volume_type_list(vtypes) @utils.service_type('volumev2') def do_extra_specs_list(cs, args): - """Print a list of current 'volume types and extra specs' (Admin Only).""" + """Lists current volume types and extra specs. Admin only.""" vtypes = cs.volume_types.list() _print_type_and_extra_specs_list(vtypes) @utils.arg('name', metavar='', - help="Name of the new volume type") + help="Name of new volume type.") @utils.service_type('volumev2') def do_type_create(cs, args): - """Create a new volume type.""" + """Creates a volume type.""" vtype = cs.volume_types.create(args.name) _print_volume_type_list([vtype]) @utils.arg('id', metavar='', - help="Name or ID of the volume type to delete") + help="ID of volume type to delete.") @utils.service_type('volumev2') def do_type_delete(cs, args): - """Delete a specific volume type.""" - volume_type = _find_volume_type(cs, args.id) - cs.volume_types.delete(volume_type) + """Deletes a volume type.""" + cs.volume_types.delete(args.id) @utils.arg('vtype', metavar='', - help="Name or ID of the volume type") + help="Name or ID of volume type.") @utils.arg('action', metavar='', choices=['set', 'unset'], - help="Actions: 'set' or 'unset'") + help="The action. Valid values are 'set' or 'unset.'") @utils.arg('metadata', metavar='', nargs='+', default=[], - help='Extra_specs to set/unset (only key is necessary on unset)') + help='The extra specs key and value pair to set or unset. ' + 'For unset, specify only the key.') @utils.service_type('volumev2') def do_type_key(cs, args): - """Set or unset extra_spec for a volume type.""" + """Sets or unsets extra_spec for a volume type.""" vtype = _find_volume_type(cs, args.vtype) keypair = _extract_metadata(args) @@ -679,7 +686,7 @@ def do_type_key(cs, args): @utils.service_type('volumev2') def do_endpoints(cs, args): - """Discover endpoints that get returned from the authenticate services.""" + """Discovers endpoints registered by authentication service.""" catalog = cs.client.service_catalog.catalog for e in catalog['serviceCatalog']: utils.print_dict(e['endpoints'][0], e['name']) @@ -687,7 +694,7 @@ def do_endpoints(cs, args): @utils.service_type('volumev2') def do_credentials(cs, args): - """Show user credentials returned from auth.""" + """Shows user credentials returned from auth.""" catalog = cs.client.service_catalog.catalog utils.print_dict(catalog['user'], "User Credentials") utils.print_dict(catalog['token'], "Token") @@ -741,55 +748,55 @@ def _quota_update(manager, identifier, args): @utils.arg('tenant', metavar='', - help='UUID of tenant to list the quotas for.') + help='ID of tenant for which to list quotas.') @utils.service_type('volumev2') def do_quota_show(cs, args): - """List the quotas for a tenant.""" + """Lists quotas for a tenant.""" _quota_show(cs.quotas.get(args.tenant)) @utils.arg('tenant', metavar='', - help='UUID of tenant to list the quota usage for.') + help='ID of tenant for which to list quota usage.') @utils.service_type('volumev2') def do_quota_usage(cs, args): - """List the quota usage for a tenant.""" + """Lists quota usage for a tenant.""" _quota_usage_show(cs.quotas.get(args.tenant, usage=True)) @utils.arg('tenant', metavar='', - help='UUID of tenant to list the default quotas for.') + help='ID of tenant for which to list quota defaults.') @utils.service_type('volumev2') def do_quota_defaults(cs, args): - """List the default quotas for a tenant.""" + """Lists default quotas for a tenant.""" _quota_show(cs.quotas.defaults(args.tenant)) @utils.arg('tenant', metavar='', - help='UUID of tenant to set the quotas for.') + help='ID of tenant for which to set quotas.') @utils.arg('--volumes', metavar='', type=int, default=None, - help='New value for the "volumes" quota.') + help='The new "volumes" quota value. OPTIONAL: Default=None.') @utils.arg('--snapshots', metavar='', type=int, default=None, - help='New value for the "snapshots" quota.') + help='The new "snapshots" quota value. OPTIONAL: Default=None.') @utils.arg('--gigabytes', metavar='', type=int, default=None, - help='New value for the "gigabytes" quota.') + help='The new "gigabytes" quota value. OPTIONAL: Default=None.') @utils.arg('--volume-type', metavar='', default=None, - help='Volume type (Optional, Default=None)') + help='Volume type. OPTIONAL: Default=None.') @utils.service_type('volumev2') def do_quota_update(cs, args): - """Update the quotas for a tenant.""" + """Updates quotas for a tenant.""" _quota_update(cs.quotas, args.tenant, args) @@ -805,43 +812,43 @@ def do_quota_delete(cs, args): @utils.arg('class_name', metavar='', - help='Name of quota class to list the quotas for.') + help='Name of quota class for which to list quotas.') @utils.service_type('volumev2') def do_quota_class_show(cs, args): - """List the quotas for a quota class.""" + """Lists quotas for a quota class.""" _quota_show(cs.quota_classes.get(args.class_name)) @utils.arg('class-name', metavar='', - help='Name of quota class to set the quotas for.') + help='Name of quota class for which to set quotas.') @utils.arg('--volumes', metavar='', type=int, default=None, - help='New value for the "volumes" quota.') + help='The new "volumes" quota value. OPTIONAL: Default=None.') @utils.arg('--snapshots', metavar='', type=int, default=None, - help='New value for the "snapshots" quota.') + help='The new "snapshots" quota value. OPTIONAL: Default=None.') @utils.arg('--gigabytes', metavar='', type=int, default=None, - help='New value for the "gigabytes" quota.') + help='The new "gigabytes" quota value. OPTIONAL: Default=None.') @utils.arg('--volume-type', metavar='', default=None, - help='Volume type (Optional, Default=None)') + help='Volume type. OPTIONAL: Default=None.') @utils.service_type('volumev2') def do_quota_class_update(cs, args): - """Update the quotas for a quota class.""" + """Updates quotas for a quota class.""" _quota_update(cs.quota_classes, args.class_name, args) @utils.service_type('volumev2') def do_absolute_limits(cs, args): - """Print a list of absolute limits for a user""" + """Lists absolute limits for a user.""" limits = cs.limits.get().absolute columns = ['Name', 'Value'] utils.print_list(limits, columns) @@ -849,7 +856,7 @@ def do_absolute_limits(cs, args): @utils.service_type('volumev2') def do_rate_limits(cs, args): - """Print a list of rate limits for a user""" + """Lists rate limits for a user.""" limits = cs.limits.get().rate columns = ['Verb', 'URI', 'Value', 'Remain', 'Unit', 'Next_Available'] utils.print_list(limits, columns) @@ -863,41 +870,41 @@ def _print_type_extra_specs(vol_type): def _find_volume_type(cs, vtype): - """Get a volume type by name or ID.""" + """Gets a volume type by name or ID.""" return utils.find_resource(cs.volume_types, vtype) @utils.arg('volume', metavar='', - help='Name or ID of the volume to snapshot') + help='Name or ID of volume to snapshot.') @utils.arg('--force', metavar='', - help='Optional flag to indicate whether ' - 'to upload a volume even if it\'s ' - 'attached to an instance. (Default=False)', + help='Enables or disables upload of ' + 'a volume that is attached to an instance. ' + 'OPTIONAL: Default=False.', default=False) @utils.arg('--container-format', metavar='', - help='Optional type for container format ' - '(Default=bare)', + help='Container format type. ' + 'OPTIONAL: Default is bare.', default='bare') @utils.arg('--container_format', help=argparse.SUPPRESS) @utils.arg('--disk-format', metavar='', - help='Optional type for disk format ' - '(Default=raw)', + help='Disk format type. ' + 'OPTIONAL: Default is raw.', default='raw') @utils.arg('--disk_format', help=argparse.SUPPRESS) @utils.arg('image_name', metavar='', - help='Name for created image') + help='The new image name.') @utils.arg('--image_name', help=argparse.SUPPRESS) @utils.service_type('volumev2') def do_upload_to_image(cs, args): - """Upload volume to image service as image.""" + """Uploads volume to Image Service as an image.""" volume = utils.find_volume(cs, args.volume) _print_volume_image(volume.upload_to_image(args.force, args.image_name, @@ -905,53 +912,53 @@ def do_upload_to_image(cs, args): args.disk_format)) -@utils.arg('volume', metavar='', help='ID of the volume to migrate') -@utils.arg('host', metavar='', help='Destination host') +@utils.arg('volume', metavar='', help='ID of volume to migrate.') +@utils.arg('host', metavar='', help='Destination host.') @utils.arg('--force-host-copy', metavar='', choices=['True', 'False'], required=False, - help='Optional flag to force the use of the generic ' - 'host-based migration mechanism, bypassing driver ' - 'optimizations (Default=False).', + help='Enables or disables generic host-based ' + 'force-migration, which bypasses driver ' + 'optimizations. OPTIONAL: Default=False.', default=False) @utils.service_type('volumev2') def do_migrate(cs, args): - """Migrate the volume to the new host.""" + """Migrates volume to a new host.""" volume = utils.find_volume(cs, args.volume) volume.migrate_volume(args.host, args.force_host_copy) @utils.arg('volume', metavar='', - help='Name or ID of the volume to retype') -@utils.arg('new_type', metavar='', help='New volume type') + help='Name or ID of volume for which to modify type.') +@utils.arg('new_type', metavar='', help='New volume type.') @utils.arg('--migration-policy', metavar='', required=False, choices=['never', 'on-demand'], default='never', - help='Policy on migrating the volume during the retype.') + help='Migration policy during retype of volume.') @utils.service_type('volumev2') def do_retype(cs, args): - """Change the volume's type.""" + """Changes the volume type for a volume.""" volume = utils.find_volume(cs, args.volume) volume.retype(args.new_type, args.migration_policy) @utils.arg('volume', metavar='', - help='Name or ID of the volume to backup.') + help='Name or ID of volume to backup.') @utils.arg('--container', metavar='', - help='Optional backup container name. (Default=None)', + help='Backup container name. OPTIONAL: Default=None.', default=None) @utils.arg('--display-name', help=argparse.SUPPRESS) @utils.arg('--name', metavar='', - help='Optional backup name. (Default=None)', + help='Backup name. OPTIONAL: Default=None.', default=None) @utils.arg('--display-description', help=argparse.SUPPRESS) @utils.arg('--description', metavar='', default=None, - help='Options backup description (Default=None)') + help='Backup description. OPTIONAL: Default=None.') @utils.service_type('volumev2') def do_backup_create(cs, args): - """Creates a backup.""" + """Creates a volume backup.""" if args.display_name is not None: args.name = args.display_name @@ -973,10 +980,10 @@ def do_backup_create(cs, args): utils.print_dict(info) -@utils.arg('backup', metavar='', help='Name or ID of the backup.') +@utils.arg('backup', metavar='', help='Name or ID of backup.') @utils.service_type('volumev2') def do_backup_show(cs, args): - """Show details about a backup.""" + """Shows backup details.""" backup = _find_backup(cs, args.backup) info = dict() info.update(backup._info) @@ -987,7 +994,7 @@ def do_backup_show(cs, args): @utils.service_type('volumev2') def do_backup_list(cs, args): - """List all the backups.""" + """Lists all backups.""" backups = cs.backups.list() columns = ['ID', 'Volume ID', 'Status', 'Name', 'Size', 'Object Count', 'Container'] @@ -995,25 +1002,26 @@ def do_backup_list(cs, args): @utils.arg('backup', metavar='', - help='Name or ID of the backup to delete.') + help='Name or ID of backup to delete.') @utils.service_type('volumev2') def do_backup_delete(cs, args): - """Remove a backup.""" + """Removes a backup.""" backup = _find_backup(cs, args.backup) backup.delete() @utils.arg('backup', metavar='', - help='ID of the backup to restore.') + help='ID of backup to restore.') @utils.arg('--volume-id', metavar='', help=argparse.SUPPRESS, default=None) @utils.arg('--volume', metavar='', - help='Optional ID(or name) of the volume to restore to.', + help='Name or ID of volume to which to restore. ' + 'OPTIONAL: Default=None.', default=None) @utils.service_type('volumev2') def do_backup_restore(cs, args): - """Restore a backup.""" + """Restores a backup.""" vol = args.volume or args.volume_id if vol: volume_id = utils.find_volume(cs, vol).id @@ -1045,11 +1053,11 @@ def do_backup_import(cs, args): @utils.arg('volume', metavar='', - help='Name or ID of the volume to transfer.') + help='Name or ID of volume to transfer.') @utils.arg('--name', metavar='', default=None, - help='Optional transfer name. (Default=None)') + help='Transfer name. OPTIONAL: Default=None.') @utils.arg('--display-name', help=argparse.SUPPRESS) @utils.service_type('volumev2') @@ -1069,18 +1077,18 @@ def do_transfer_create(cs, args): @utils.arg('transfer', metavar='', - help='Name or ID of the transfer to delete.') + help='Name or ID of transfer to delete.') @utils.service_type('volumev2') def do_transfer_delete(cs, args): - """Undo a transfer.""" + """Undoes a transfer.""" transfer = _find_transfer(cs, args.transfer) transfer.delete() @utils.arg('transfer', metavar='', - help='ID of the transfer to accept.') + help='ID of transfer to accept.') @utils.arg('auth_key', metavar='', - help='Auth key of the transfer to accept.') + help='Authentication key of transfer to accept.') @utils.service_type('volumev2') def do_transfer_accept(cs, args): """Accepts a volume transfer.""" @@ -1094,17 +1102,17 @@ def do_transfer_accept(cs, args): @utils.service_type('volumev2') def do_transfer_list(cs, args): - """List all the transfers.""" + """Lists all transfers.""" transfers = cs.transfers.list() columns = ['ID', 'Volume ID', 'Name'] utils.print_list(transfers, columns) @utils.arg('transfer', metavar='', - help='Name or ID of the transfer to accept.') + help='Name or ID of transfer to accept.') @utils.service_type('volumev2') def do_transfer_show(cs, args): - """Show details about a transfer.""" + """Shows transfer details.""" transfer = _find_transfer(cs, args.transfer) info = dict() info.update(transfer._info) @@ -1114,25 +1122,25 @@ def do_transfer_show(cs, args): @utils.arg('volume', metavar='', - help='Name or ID of the volume to extend.') + help='Name or ID of volume to extend.') @utils.arg('new_size', metavar='', type=int, - help='New size of volume in GB') + help='New size of volume, in GBs.') @utils.service_type('volumev2') def do_extend(cs, args): - """Attempt to extend the size of an existing volume.""" + """Attempts to extend size of an existing volume.""" volume = utils.find_volume(cs, args.volume) cs.volumes.extend(volume, args.new_size) @utils.arg('--host', metavar='', default=None, - help='Name of host.') + help='Host name. OPTIONAL: Default=None.') @utils.arg('--binary', metavar='', default=None, - help='Service binary.') + help='Service binary. OPTIONAL: Default=None.') @utils.service_type('volumev2') def do_service_list(cs, args): - """List all the services. Filter by host & service binary.""" + """Lists all services. Filter by host and service binary.""" result = cs.services.list(host=args.host, binary=args.binary) columns = ["Binary", "Host", "Zone", "Status", "State", "Updated_at"] # NOTE(jay-lau-513): we check if the response has disabled_reason @@ -1142,23 +1150,23 @@ def do_service_list(cs, args): utils.print_list(result, columns) -@utils.arg('host', metavar='', help='Name of host.') +@utils.arg('host', metavar='', help='Host name.') @utils.arg('binary', metavar='', help='Service binary.') @utils.service_type('volumev2') def do_service_enable(cs, args): - """Enable the service.""" + """Enables the service.""" result = cs.services.enable(args.host, args.binary) columns = ["Host", "Binary", "Status"] utils.print_list([result], columns) -@utils.arg('host', metavar='', help='Name of host.') +@utils.arg('host', metavar='', help='Host name.') @utils.arg('binary', metavar='', help='Service binary.') @utils.arg('--reason', metavar='', help='Reason for disabling service.') @utils.service_type('volumev2') def do_service_disable(cs, args): - """Disable the service.""" + """Disables the service.""" columns = ["Host", "Binary", "Status"] if args.reason: columns.append('Disabled Reason') @@ -1170,7 +1178,7 @@ def do_service_disable(cs, args): def _treeizeAvailabilityZone(zone): - """Build a tree view for availability zones.""" + """Builds a tree view for availability zones.""" AvailabilityZone = availability_zones.AvailabilityZone az = AvailabilityZone(zone.manager, @@ -1213,7 +1221,7 @@ def _treeizeAvailabilityZone(zone): @utils.service_type('volumev2') def do_availability_zone_list(cs, _args): - """List all the availability zones.""" + """Lists all availability zones.""" try: availability_zones = cs.availability_zones.list() except exceptions.Forbidden as e: # policy doesn't allow probably @@ -1231,7 +1239,7 @@ def do_availability_zone_list(cs, _args): def _print_volume_encryption_type_list(encryption_types): """ - Display a tabularized list of volume encryption types. + Lists volume encryption types. :param encryption_types: a list of :class: VolumeEncryptionType instances """ @@ -1242,7 +1250,7 @@ def _print_volume_encryption_type_list(encryption_types): @utils.service_type('volumev2') def do_encryption_type_list(cs, args): - """List encryption type information for all volume types (Admin Only).""" + """Shows encryption type details for volume types. Admin only.""" result = cs.volume_encryption_types.list() utils.print_list(result, ['Volume Type ID', 'Provider', 'Cipher', 'Key Size', 'Control Location']) @@ -1251,10 +1259,10 @@ def do_encryption_type_list(cs, args): @utils.arg('volume_type', metavar='', type=str, - help="Name or ID of the volume type") + help="Name or ID of volume type.") @utils.service_type('volumev2') def do_encryption_type_show(cs, args): - """Show the encryption type information for a volume type (Admin Only).""" + """Shows encryption type details for a volume type. Admin only.""" volume_type = _find_volume_type(cs, args.volume_type) result = cs.volume_encryption_types.get(volume_type) @@ -1269,37 +1277,38 @@ def do_encryption_type_show(cs, args): @utils.arg('volume_type', metavar='', type=str, - help="Name or ID of the volume type") + help="Name or ID of volume type.") @utils.arg('provider', metavar='', type=str, - help="Class providing encryption support (e.g. LuksEncryptor)") + help='The class that provides encryption support. ' + 'For example, LuksEncryptor.') @utils.arg('--cipher', metavar='', type=str, required=False, default=None, - help="Encryption algorithm/mode to use (e.g., aes-xts-plain64) " - "(Optional, Default=None)") + help='The encryption algorithm or mode. ' + 'For example, aes-xts-plain64. OPTIONAL: Default=None.') @utils.arg('--key_size', metavar='', type=int, required=False, default=None, - help="Size of the encryption key, in bits (e.g., 128, 256) " - "(Optional, Default=None)") + help='Size of encryption key, in bits. ' + 'For example, 128 or 256. OPTIONAL: Default=None.') @utils.arg('--control_location', metavar='', choices=['front-end', 'back-end'], type=str, required=False, default='front-end', - help="Notional service where encryption is performed (e.g., " - "front-end=Nova) Values: 'front-end', 'back-end' " - "(Default='front-end')") + help='Notional service where encryption is performed. ' + 'Valid values are "front-end" or "back-end." ' + 'For example, front-end=Nova. OPTIONAL: Default is "front-end."') @utils.service_type('volumev2') def do_encryption_type_create(cs, args): - """Create a new encryption type for a volume type (Admin Only).""" + """Creates encryption type for a volume type. Admin only.""" volume_type = _find_volume_type(cs, args.volume_type) body = {} @@ -1315,10 +1324,10 @@ def do_encryption_type_create(cs, args): @utils.arg('volume_type', metavar='', type=str, - help="Name or ID of the volume type") + help="Name or ID of volume type.") @utils.service_type('volumev2') def do_encryption_type_delete(cs, args): - """Delete the encryption type for a volume type (Admin Only).""" + """Deletes encryption type for a volume type. Admin only.""" volume_type = _find_volume_type(cs, args.volume_type) cs.volume_encryption_types.delete(volume_type) @@ -1341,15 +1350,15 @@ def _print_associations_list(associations): @utils.arg('name', metavar='', - help="Name of the new QoS specs") + help="Name of new QoS specifications.") @utils.arg('metadata', metavar='', nargs='+', default=[], - help='Specifications for QoS') + help="QoS specifications.") @utils.service_type('volumev2') def do_qos_create(cs, args): - """Create a new qos specs.""" + """Creates a qos specs.""" keypair = None if args.metadata is not None: keypair = _extract_metadata(args) @@ -1359,76 +1368,78 @@ def do_qos_create(cs, args): @utils.service_type('volumev2') def do_qos_list(cs, args): - """Get full list of qos specs.""" + """Lists qos specs.""" qos_specs = cs.qos_specs.list() _print_qos_specs_list(qos_specs) @utils.arg('qos_specs', metavar='', - help='ID of the qos_specs to show.') + help="ID of QoS specifications to show.") @utils.service_type('volumev2') def do_qos_show(cs, args): - """Get a specific qos specs.""" + """Shows qos specs details.""" qos_specs = _find_qos_specs(cs, args.qos_specs) _print_qos_specs(qos_specs) @utils.arg('qos_specs', metavar='', - help='ID of the qos_specs to delete.') + help="ID of QoS specifications to delete.") @utils.arg('--force', metavar='', default=False, - help='Optional flag that indicates whether to delete ' - 'specified qos specs even if it is in-use.') + help='Enables or disables deletion of in-use ' + 'QoS specifications. OPTIONAL: Default=False.') @utils.service_type('volumev2') def do_qos_delete(cs, args): - """Delete a specific qos specs.""" + """Deletes a specified qos specs.""" force = strutils.bool_from_string(args.force) qos_specs = _find_qos_specs(cs, args.qos_specs) cs.qos_specs.delete(qos_specs, force) @utils.arg('qos_specs', metavar='', - help='ID of qos_specs.') + help='ID of QoS specifications.') @utils.arg('vol_type_id', metavar='', - help='ID of volume type to be associated with.') + help='ID of volume type with which to associate ' + 'QoS specifications.') @utils.service_type('volumev2') def do_qos_associate(cs, args): - """Associate qos specs with specific volume type.""" + """Associates qos specs with specified volume type.""" cs.qos_specs.associate(args.qos_specs, args.vol_type_id) @utils.arg('qos_specs', metavar='', - help='ID of qos_specs.') + help='ID of QoS specifications.') @utils.arg('vol_type_id', metavar='', - help='ID of volume type to be associated with.') + help='ID of volume type with which to associate ' + 'QoS specifications.') @utils.service_type('volumev2') def do_qos_disassociate(cs, args): - """Disassociate qos specs from specific volume type.""" + """Disassociates qos specs from specified volume type.""" cs.qos_specs.disassociate(args.qos_specs, args.vol_type_id) @utils.arg('qos_specs', metavar='', - help='ID of qos_specs to be operate on.') + help='ID of QoS specifications on which to operate.') @utils.service_type('volumev2') def do_qos_disassociate_all(cs, args): - """Disassociate qos specs from all of its associations.""" + """Disassociates qos specs from all its associations.""" cs.qos_specs.disassociate_all(args.qos_specs) @utils.arg('qos_specs', metavar='', - help='ID of qos specs') + help='ID of QoS specifications.') @utils.arg('action', metavar='', choices=['set', 'unset'], - help="Actions: 'set' or 'unset'") + help="The action. Valid values are 'set' or 'unset.'") @utils.arg('metadata', metavar='key=value', nargs='+', default=[], - help='QoS specs to set/unset (only key is necessary on unset)') -@utils.service_type('volumev2') + help='Metadata key and value pair to set or unset. ' + 'For unset, specify only the key.') def do_qos_key(cs, args): - """Set or unset specifications for a qos spec.""" + """Sets or unsets specifications for a qos spec.""" keypair = _extract_metadata(args) if args.action == 'set': @@ -1438,29 +1449,30 @@ def do_qos_key(cs, args): @utils.arg('qos_specs', metavar='', - help='ID of the qos_specs.') + help='ID of QoS specifications.') @utils.service_type('volumev2') def do_qos_get_association(cs, args): - """Get all associations of specific qos specs.""" + """Lists all associations for specified qos specs.""" associations = cs.qos_specs.get_associations(args.qos_specs) _print_associations_list(associations) @utils.arg('snapshot', metavar='', - help='ID of the snapshot to update metadata on.') + help='ID of snapshot for which to update metadata.') @utils.arg('action', metavar='', choices=['set', 'unset'], - help="Actions: 'set' or 'unset'") + help="The action. Valid values are 'set' or 'unset.'") @utils.arg('metadata', metavar='', nargs='+', default=[], - help='Metadata to set/unset (only key is necessary on unset)') + help='Metadata key and value pair to set or unset. ' + 'For unset, specify only the key.') @utils.service_type('volumev2') def do_snapshot_metadata(cs, args): - """Set or Delete metadata of a snapshot.""" + """Sets or deletes snapshot metadata.""" snapshot = _find_volume_snapshot(cs, args.snapshot) metadata = _extract_metadata(args) @@ -1472,34 +1484,34 @@ def do_snapshot_metadata(cs, args): @utils.arg('snapshot', metavar='', - help='ID of snapshot') + help='ID of snapshot.') @utils.service_type('volumev2') def do_snapshot_metadata_show(cs, args): - """Show metadata of given snapshot.""" + """Shows snapshot metadata.""" snapshot = _find_volume_snapshot(cs, args.snapshot) utils.print_dict(snapshot._info['metadata'], 'Metadata-property') @utils.arg('volume', metavar='', - help='ID of volume') + help='ID of volume.') @utils.service_type('volumev2') def do_metadata_show(cs, args): - """Show metadata of given volume.""" + """Shows volume metadata.""" volume = utils.find_volume(cs, args.volume) utils.print_dict(volume._info['metadata'], 'Metadata-property') @utils.arg('volume', metavar='', - help='ID of the volume to update metadata on.') + help='ID of volume for which to update metadata.') @utils.arg('metadata', metavar='', nargs='+', default=[], - help='Metadata entry/entries to update.') + help='Metadata key and value pair or pairs to update.') @utils.service_type('volumev2') def do_metadata_update_all(cs, args): - """Update all metadata of a volume.""" + """Updates volume metadata.""" volume = utils.find_volume(cs, args.volume) metadata = _extract_metadata(args) metadata = volume.update_all_metadata(metadata) @@ -1508,30 +1520,30 @@ def do_metadata_update_all(cs, args): @utils.arg('snapshot', metavar='', - help='ID of the snapshot to update metadata on.') + help='ID of snapshot for which to update metadata.') @utils.arg('metadata', metavar='', nargs='+', default=[], - help='Metadata entry/entries to update') + help='Metadata key and value pair to update.') @utils.service_type('volumev2') def do_snapshot_metadata_update_all(cs, args): - """Update all metadata of a snapshot.""" + """Updates snapshot metadata.""" snapshot = _find_volume_snapshot(cs, args.snapshot) metadata = _extract_metadata(args) metadata = snapshot.update_all_metadata(metadata) utils.print_dict(metadata) -@utils.arg('volume', metavar='', help='ID of the volume to update.') +@utils.arg('volume', metavar='', help='ID of volume to update.') @utils.arg('read_only', metavar='', choices=['True', 'true', 'False', 'false'], - help='Flag to indicate whether to update volume to ' + help='Enables or disables update of volume to ' 'read-only access mode.') @utils.service_type('volumev2') def do_readonly_mode_update(cs, args): - """Update volume read-only access mode flag.""" + """Updates volume read-only access-mode flag.""" volume = utils.find_volume(cs, args.volume) cs.volumes.update_readonly_flag(volume, strutils.bool_from_string(args.read_only)) diff --git a/cinderclient/v2/volume_backups.py b/cinderclient/v2/volume_backups.py index c28972ee7..ae232c274 100644 --- a/cinderclient/v2/volume_backups.py +++ b/cinderclient/v2/volume_backups.py @@ -36,7 +36,7 @@ class VolumeBackupManager(base.ManagerWithFind): def create(self, volume_id, container=None, name=None, description=None): - """Create a volume backup. + """Creates a volume backup. :param volume_id: The ID of the volume to backup. :param container: The name of the backup service container. @@ -51,7 +51,7 @@ class VolumeBackupManager(base.ManagerWithFind): return self._create('/backups', body, 'backup') def get(self, backup_id): - """Show details of a volume backup. + """Show volume backup details. :param backup_id: The ID of the backup to display. :rtype: :class:`VolumeBackup` diff --git a/cinderclient/v2/volume_encryption_types.py b/cinderclient/v2/volume_encryption_types.py index 8385add7e..1099bc37b 100644 --- a/cinderclient/v2/volume_encryption_types.py +++ b/cinderclient/v2/volume_encryption_types.py @@ -65,7 +65,7 @@ class VolumeEncryptionTypeManager(base.ManagerWithFind): def create(self, volume_type, specs): """ - Create a new encryption type for the specified volume type. + Creates encryption type for a volume type. Default: admin only. :param volume_type: the volume type on which to add an encryption type :param specs: the encryption type specifications to add diff --git a/cinderclient/v2/volume_snapshots.py b/cinderclient/v2/volume_snapshots.py index f232cf0f3..a398b0eb9 100644 --- a/cinderclient/v2/volume_snapshots.py +++ b/cinderclient/v2/volume_snapshots.py @@ -69,7 +69,7 @@ class SnapshotManager(base.ManagerWithFind): def create(self, volume_id, force=False, name=None, description=None): - """Create a snapshot of the given volume. + """Creates a snapshot of the given volume. :param volume_id: The ID of the volume to snapshot. :param force: If force is True, create a snapshot even if the volume is @@ -85,7 +85,7 @@ class SnapshotManager(base.ManagerWithFind): return self._create('/snapshots', body, 'snapshot') def get(self, snapshot_id): - """Get a snapshot. + """Shows snapshot details. :param snapshot_id: The ID of the snapshot to get. :rtype: :class:`Snapshot` diff --git a/cinderclient/v2/volume_transfers.py b/cinderclient/v2/volume_transfers.py index a549cb631..00daf3ec5 100644 --- a/cinderclient/v2/volume_transfers.py +++ b/cinderclient/v2/volume_transfers.py @@ -35,7 +35,7 @@ class VolumeTransferManager(base.ManagerWithFind): resource_class = VolumeTransfer def create(self, volume_id, name=None): - """Create a volume transfer. + """Creates a volume transfer. :param volume_id: The ID of the volume to transfer. :param name: The name of the transfer. diff --git a/cinderclient/v2/volume_types.py b/cinderclient/v2/volume_types.py index 26b396f1d..dc2ec5bba 100644 --- a/cinderclient/v2/volume_types.py +++ b/cinderclient/v2/volume_types.py @@ -71,7 +71,7 @@ class VolumeTypeManager(base.ManagerWithFind): resource_class = VolumeType def list(self, search_opts=None): - """Get a list of all volume types. + """Lists all volume types. :rtype: list of :class:`VolumeType`. """ @@ -86,14 +86,14 @@ class VolumeTypeManager(base.ManagerWithFind): return self._get("/types/%s" % base.getid(volume_type), "volume_type") def delete(self, volume_type): - """Delete a specific volume_type. + """Deletes a specific volume_type. :param volume_type: The name or ID of the :class:`VolumeType` to get. """ self._delete("/types/%s" % base.getid(volume_type)) def create(self, name): - """Create a volume type. + """Creates a volume type. :param name: Descriptive name of the volume type :rtype: :class:`VolumeType` diff --git a/cinderclient/v2/volumes.py b/cinderclient/v2/volumes.py index e6308beca..bfe6670b1 100644 --- a/cinderclient/v2/volumes.py +++ b/cinderclient/v2/volumes.py @@ -144,7 +144,7 @@ class VolumeManager(base.ManagerWithFind): volume_type=None, user_id=None, project_id=None, availability_zone=None, metadata=None, imageRef=None, scheduler_hints=None): - """Create a volume. + """Creates a volume. :param size: Size of volume in GB :param snapshot_id: ID of the snapshot @@ -196,7 +196,7 @@ class VolumeManager(base.ManagerWithFind): return self._get("/volumes/%s" % volume_id, "volume") def list(self, detailed=True, search_opts=None): - """Get a list of all volumes. + """Lists all volumes. :rtype: list of :class:`Volume` """