Merge "trivial: Cleanup docs for 'server list'"
This commit is contained in:
commit
f2c49142f0
@ -1390,9 +1390,11 @@ class ListServer(command.Lister):
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--ip6',
|
'--ip6',
|
||||||
metavar='<ip-address-regex>',
|
metavar='<ip-address-regex>',
|
||||||
help=_('Regular expression to match IPv6 addresses. Note '
|
help=_(
|
||||||
'that this option only applies for non-admin users '
|
'Regular expression to match IPv6 addresses. Note '
|
||||||
'when using ``--os-compute-api-version`` 2.5 or greater.'),
|
'that this option only applies for non-admin users '
|
||||||
|
'when using ``--os-compute-api-version`` 2.5 or greater.'
|
||||||
|
),
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--name',
|
'--name',
|
||||||
@ -1443,6 +1445,12 @@ class ListServer(command.Lister):
|
|||||||
help=_('Search by user (admin only) (name or ID)'),
|
help=_('Search by user (admin only) (name or ID)'),
|
||||||
)
|
)
|
||||||
identity_common.add_user_domain_option_to_parser(parser)
|
identity_common.add_user_domain_option_to_parser(parser)
|
||||||
|
parser.add_argument(
|
||||||
|
'--deleted',
|
||||||
|
action='store_true',
|
||||||
|
default=False,
|
||||||
|
help=_('Only display deleted servers (admin only)'),
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--long',
|
'--long',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
@ -1454,74 +1462,83 @@ class ListServer(command.Lister):
|
|||||||
'-n', '--no-name-lookup',
|
'-n', '--no-name-lookup',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
default=False,
|
default=False,
|
||||||
help=_('Skip flavor and image name lookup.'
|
help=_(
|
||||||
'Mutually exclusive with "--name-lookup-one-by-one"'
|
'Skip flavor and image name lookup. '
|
||||||
' option.'),
|
'Mutually exclusive with "--name-lookup-one-by-one" option.'
|
||||||
|
),
|
||||||
)
|
)
|
||||||
name_lookup_group.add_argument(
|
name_lookup_group.add_argument(
|
||||||
'--name-lookup-one-by-one',
|
'--name-lookup-one-by-one',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
default=False,
|
default=False,
|
||||||
help=_('When looking up flavor and image names, look them up'
|
help=_(
|
||||||
'one by one as needed instead of all together (default). '
|
'When looking up flavor and image names, look them up'
|
||||||
'Mutually exclusive with "--no-name-lookup|-n" option.'),
|
'one by one as needed instead of all together (default). '
|
||||||
|
'Mutually exclusive with "--no-name-lookup|-n" option.'
|
||||||
|
),
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--marker',
|
'--marker',
|
||||||
metavar='<server>',
|
metavar='<server>',
|
||||||
default=None,
|
default=None,
|
||||||
help=_('The last server of the previous page. Display '
|
help=_(
|
||||||
'list of servers after marker. Display all servers if not '
|
'The last server of the previous page. Display '
|
||||||
'specified. When used with ``--deleted``, the marker must '
|
'list of servers after marker. Display all servers if not '
|
||||||
'be an ID, otherwise a name or ID can be used.'),
|
'specified. When used with ``--deleted``, the marker must '
|
||||||
|
'be an ID, otherwise a name or ID can be used.'
|
||||||
|
),
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--limit',
|
'--limit',
|
||||||
metavar='<num-servers>',
|
metavar='<num-servers>',
|
||||||
type=int,
|
type=int,
|
||||||
default=None,
|
default=None,
|
||||||
help=_("Maximum number of servers to display. If limit equals -1, "
|
help=_(
|
||||||
"all servers will be displayed. If limit is greater than "
|
"Maximum number of servers to display. If limit equals -1, "
|
||||||
"'osapi_max_limit' option of Nova API, "
|
"all servers will be displayed. If limit is greater than "
|
||||||
"'osapi_max_limit' will be used instead."),
|
"'osapi_max_limit' option of Nova API, "
|
||||||
)
|
"'osapi_max_limit' will be used instead."
|
||||||
parser.add_argument(
|
),
|
||||||
'--deleted',
|
|
||||||
action="store_true",
|
|
||||||
default=False,
|
|
||||||
help=_('Only display deleted servers (Admin only).')
|
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--changes-before',
|
'--changes-before',
|
||||||
metavar='<changes-before>',
|
metavar='<changes-before>',
|
||||||
default=None,
|
default=None,
|
||||||
help=_("List only servers changed before a certain point of time. "
|
help=_(
|
||||||
"The provided time should be an ISO 8061 formatted time "
|
"List only servers changed before a certain point of time. "
|
||||||
"(e.g., 2016-03-05T06:27:59Z). "
|
"The provided time should be an ISO 8061 formatted time "
|
||||||
"(Supported by API versions '2.66' - '2.latest')")
|
"(e.g., 2016-03-05T06:27:59Z). "
|
||||||
|
'(supported by --os-compute-api-version 2.66 or above)'
|
||||||
|
),
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--changes-since',
|
'--changes-since',
|
||||||
metavar='<changes-since>',
|
metavar='<changes-since>',
|
||||||
default=None,
|
default=None,
|
||||||
help=_("List only servers changed after a certain point of time."
|
help=_(
|
||||||
" The provided time should be an ISO 8061 formatted time"
|
"List only servers changed after a certain point of time. "
|
||||||
" (e.g., 2016-03-04T06:27:59Z).")
|
"The provided time should be an ISO 8061 formatted time "
|
||||||
|
"(e.g., 2016-03-04T06:27:59Z)."
|
||||||
|
),
|
||||||
)
|
)
|
||||||
lock_group = parser.add_mutually_exclusive_group()
|
lock_group = parser.add_mutually_exclusive_group()
|
||||||
lock_group.add_argument(
|
lock_group.add_argument(
|
||||||
'--locked',
|
'--locked',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
default=False,
|
default=False,
|
||||||
help=_('Only display locked servers. '
|
help=_(
|
||||||
'Requires ``--os-compute-api-version`` 2.73 or greater.'),
|
'Only display locked servers '
|
||||||
|
'(supported by --os-compute-api-version 2.73 or above)'
|
||||||
|
),
|
||||||
)
|
)
|
||||||
lock_group.add_argument(
|
lock_group.add_argument(
|
||||||
'--unlocked',
|
'--unlocked',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
default=False,
|
default=False,
|
||||||
help=_('Only display unlocked servers. '
|
help=_(
|
||||||
'Requires ``--os-compute-api-version`` 2.73 or greater.'),
|
'Only display unlocked servers '
|
||||||
|
'(supported by --os-compute-api-version 2.73 or above)'
|
||||||
|
),
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--tags',
|
'--tags',
|
||||||
@ -1624,18 +1641,25 @@ class ListServer(command.Lister):
|
|||||||
|
|
||||||
search_opts['not-tags'] = parsed_args.not_tags
|
search_opts['not-tags'] = parsed_args.not_tags
|
||||||
|
|
||||||
support_locked = (compute_client.api_version >=
|
if parsed_args.locked:
|
||||||
api_versions.APIVersion('2.73'))
|
if compute_client.api_version < api_versions.APIVersion('2.73'):
|
||||||
if not support_locked and (parsed_args.locked or parsed_args.unlocked):
|
msg = _(
|
||||||
msg = _('--os-compute-api-version 2.73 or greater is required to '
|
'--os-compute-api-version 2.73 or greater is required to '
|
||||||
'use the (un)locked filter option.')
|
'support the --locked option'
|
||||||
raise exceptions.CommandError(msg)
|
)
|
||||||
elif support_locked:
|
raise exceptions.CommandError(msg)
|
||||||
# Only from 2.73.
|
|
||||||
if parsed_args.locked:
|
search_opts['locked'] = True
|
||||||
search_opts['locked'] = True
|
elif parsed_args.unlocked:
|
||||||
if parsed_args.unlocked:
|
if compute_client.api_version < api_versions.APIVersion('2.73'):
|
||||||
search_opts['locked'] = False
|
msg = _(
|
||||||
|
'--os-compute-api-version 2.73 or greater is required to '
|
||||||
|
'support the --unlocked option'
|
||||||
|
)
|
||||||
|
raise exceptions.CommandError(msg)
|
||||||
|
|
||||||
|
search_opts['locked'] = False
|
||||||
|
|
||||||
LOG.debug('search options: %s', search_opts)
|
LOG.debug('search options: %s', search_opts)
|
||||||
|
|
||||||
if search_opts['changes-before']:
|
if search_opts['changes-before']:
|
||||||
@ -1842,17 +1866,21 @@ class ListServer(command.Lister):
|
|||||||
s.flavor_name = ''
|
s.flavor_name = ''
|
||||||
s.flavor_id = ''
|
s.flavor_id = ''
|
||||||
|
|
||||||
table = (column_headers,
|
table = (
|
||||||
(utils.get_item_properties(
|
column_headers,
|
||||||
s, columns,
|
(
|
||||||
mixed_case_fields=mixed_case_fields,
|
utils.get_item_properties(
|
||||||
formatters={
|
s, columns,
|
||||||
'OS-EXT-STS:power_state':
|
mixed_case_fields=mixed_case_fields,
|
||||||
_format_servers_list_power_state,
|
formatters={
|
||||||
'Networks': _format_servers_list_networks,
|
'OS-EXT-STS:power_state':
|
||||||
'Metadata': utils.format_dict,
|
_format_servers_list_power_state,
|
||||||
},
|
'Networks': _format_servers_list_networks,
|
||||||
) for s in data))
|
'Metadata': utils.format_dict,
|
||||||
|
},
|
||||||
|
) for s in data
|
||||||
|
),
|
||||||
|
)
|
||||||
return table
|
return table
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user