Added pool list support for v1

This patch will add pool list
support in zaqar client v1.

Change-Id: I6da0c391706dd3cecb86e3f1f6f304d481bfa976
This commit is contained in:
Md Nadeem 2015-11-25 15:50:14 +09:00 committed by Fei Long Wang
parent 9a81043dbc
commit 61d9b16481
2 changed files with 43 additions and 0 deletions

View File

@ -60,6 +60,7 @@ openstack.messaging.v1 =
pool_show = zaqarclient.queues.v1.cli:ShowPool
pool_update = zaqarclient.queues.v1.cli:UpdatePool
pool_delete = zaqarclient.queues.v1.cli:DeletePool
pool_list = zaqarclient.queues.v1.cli:ListPools
messaging_flavor_delete = zaqarclient.queues.v1.cli:DeleteFlavor
openstack.cli.extension =

View File

@ -359,6 +359,48 @@ class DeletePool(command.Command):
client.pool(pool_name, auto_create=False).delete()
class ListPools(lister.Lister):
"""List available Pools"""
log = logging.getLogger(__name__ + ".ListPools")
def get_parser(self, prog_name):
parser = super(ListPools, self).get_parser(prog_name)
parser.add_argument(
"--marker",
metavar="<pool_name>",
help="Pool's paging marker")
parser.add_argument(
"--limit",
metavar="<limit>",
help="Page size limit")
parser.add_argument(
"--detailed",
type=bool,
metavar="<detailed>",
help="Detailed output")
return parser
def take_action(self, parsed_args):
client = _get_client(self, parsed_args)
kwargs = {}
columns = ["Name", "Weight", "URI", "Group"]
if parsed_args.marker is not None:
kwargs["marker"] = parsed_args.marker
if parsed_args.limit is not None:
kwargs["limit"] = parsed_args.limit
if parsed_args.detailed is not None and parsed_args.detailed:
kwargs["detailed"] = parsed_args.detailed
columns.append("Options")
data = client.pools(**kwargs)
columns = tuple(columns)
return (columns,
(utils.get_item_properties(s, columns) for s in data))
class DeleteFlavor(command.Command):
"""Delete a flavor"""