Merge "Bootable filter for listening volumes from CLI"

This commit is contained in:
Jenkins
2016-02-08 16:49:49 +00:00
committed by Gerrit Code Review
2 changed files with 15 additions and 0 deletions

View File

@@ -194,6 +194,14 @@ class ShellTest(utils.TestCase):
self.run_command('list --status=available')
self.assert_called('GET', '/volumes/detail?status=available')
def test_list_filter_bootable_true(self):
self.run_command('list --bootable=true')
self.assert_called('GET', '/volumes/detail?bootable=true')
def test_list_filter_bootable_false(self):
self.run_command('list --bootable=false')
self.assert_called('GET', '/volumes/detail?bootable=false')
def test_list_filter_name(self):
self.run_command('list --name=1234')
self.assert_called('GET', '/volumes/detail?name=1234')

View File

@@ -165,6 +165,12 @@ def _extract_metadata(args):
metavar='<status>',
default=None,
help='Filters results by a status. Default=None.')
@utils.arg('--bootable',
metavar='<True|true|False|false>',
const=True,
nargs='?',
choices=['True', 'true', 'False', 'false'],
help='Filters results by bootable status. Default=None.')
@utils.arg('--migration_status',
metavar='<migration_status>',
default=None,
@@ -229,6 +235,7 @@ def do_list(cs, args):
'project_id': args.tenant,
'name': args.name,
'status': args.status,
'bootable': args.bootable,
'migration_status': args.migration_status,
'metadata': _extract_metadata(args) if args.metadata else None,
}