Merge "Deprecate project usage list command"
This commit is contained in:
commit
9057cedfd4
@ -18,7 +18,7 @@ List resource usage per project
|
||||
|
||||
.. option:: --start <start>
|
||||
|
||||
Usage range start date, ex 2012-01-20 (default: 4 weeks ago).
|
||||
Usage range start date, ex 2012-01-20 (default: 4 weeks ago)
|
||||
|
||||
.. option:: --end <end>
|
||||
|
||||
@ -27,7 +27,7 @@ List resource usage per project
|
||||
usage show
|
||||
----------
|
||||
|
||||
Show resource usage for a single project.
|
||||
Show resource usage for a single project
|
||||
|
||||
.. program:: usage show
|
||||
.. code:: bash
|
||||
@ -39,11 +39,11 @@ Show resource usage for a single project.
|
||||
|
||||
.. option:: --project <project>
|
||||
|
||||
Name or ID of project to show usage for.
|
||||
Name or ID of project to show usage for
|
||||
|
||||
.. option:: --start <start>
|
||||
|
||||
Usage range start date, ex 2012-01-20 (default: 4 weeks ago).
|
||||
Usage range start date, ex 2012-01-20 (default: 4 weeks ago)
|
||||
|
||||
.. option:: --end <end>
|
||||
|
||||
|
@ -27,7 +27,7 @@ from openstackclient.common import utils
|
||||
|
||||
|
||||
class ListUsage(lister.Lister):
|
||||
"""List resource usage per project. """
|
||||
"""List resource usage per project"""
|
||||
|
||||
log = logging.getLogger(__name__ + ".ListUsage")
|
||||
|
||||
@ -38,7 +38,7 @@ class ListUsage(lister.Lister):
|
||||
metavar="<start>",
|
||||
default=None,
|
||||
help="Usage range start date, ex 2012-01-20"
|
||||
" (default: 4 weeks ago)."
|
||||
" (default: 4 weeks ago)"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--end",
|
||||
@ -119,7 +119,7 @@ class ListUsage(lister.Lister):
|
||||
|
||||
|
||||
class ShowUsage(show.ShowOne):
|
||||
"""Show resource usage for a single project. """
|
||||
"""Show resource usage for a single project"""
|
||||
|
||||
log = logging.getLogger(__name__ + ".ShowUsage")
|
||||
|
||||
@ -129,20 +129,20 @@ class ShowUsage(show.ShowOne):
|
||||
"--project",
|
||||
metavar="<project>",
|
||||
default=None,
|
||||
help="Name or ID of project to show usage for."
|
||||
help="Name or ID of project to show usage for"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--start",
|
||||
metavar="<start>",
|
||||
default=None,
|
||||
help="Usage range start date, ex 2012-01-20"
|
||||
" (default: 4 weeks ago)."
|
||||
" (default: 4 weeks ago)"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--end",
|
||||
metavar="<end>",
|
||||
default=None,
|
||||
help="Usage range end date, ex 2012-01-20 (default: tomorrow)."
|
||||
help="Usage range end date, ex 2012-01-20 (default: tomorrow)"
|
||||
)
|
||||
return parser
|
||||
|
||||
@ -188,3 +188,20 @@ class ShowUsage(show.ShowOne):
|
||||
info['CPU Hours'] = float("%.2f" % usage.total_vcpus_usage)
|
||||
info['Disk GB-Hours'] = float("%.2f" % usage.total_local_gb_usage)
|
||||
return zip(*sorted(six.iteritems(info)))
|
||||
|
||||
|
||||
# This is out of order due to the subclass, will eventually be removed
|
||||
|
||||
class ListProjectUsage(ListUsage):
|
||||
"""List resource usage per project"""
|
||||
|
||||
deprecated = True
|
||||
|
||||
log = logging.getLogger('DEPRECATED:')
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.warning(
|
||||
"%s is deprecated, use 'usage list'",
|
||||
getattr(self, 'cmd_name', 'this command'),
|
||||
)
|
||||
return super(ListProjectUsage, self).take_action(parsed_args)
|
||||
|
@ -303,7 +303,8 @@ class OpenStackShell(app.App):
|
||||
def prepare_to_run_command(self, cmd):
|
||||
"""Set up auth and API versions"""
|
||||
self.log.info(
|
||||
'command: %s.%s',
|
||||
'command: %s -> %s.%s',
|
||||
getattr(cmd, 'cmd_name', '<none>'),
|
||||
cmd.__class__.__module__,
|
||||
cmd.__class__.__name__,
|
||||
)
|
||||
|
@ -97,7 +97,7 @@ openstack.compute.v2 =
|
||||
keypair_list = openstackclient.compute.v2.keypair:ListKeypair
|
||||
keypair_show = openstackclient.compute.v2.keypair:ShowKeypair
|
||||
|
||||
project_usage_list = openstackclient.compute.v2.usage:ListUsage
|
||||
project_usage_list = openstackclient.compute.v2.usage:ListProjectUsage
|
||||
|
||||
security_group_create = openstackclient.compute.v2.security_group:CreateSecurityGroup
|
||||
security_group_delete = openstackclient.compute.v2.security_group:DeleteSecurityGroup
|
||||
|
Loading…
Reference in New Issue
Block a user