diff options
author | Jenkins <jenkins@review.openstack.org> | 2017-01-26 15:33:12 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2017-01-26 15:33:12 +0000 |
commit | 4c5e9f16e3addf5e082ec102fecf8ba3aec541f3 (patch) | |
tree | 1d0c2326e015c9d9453fcbb4ed29f038f71c6a8e | |
parent | b73b3932404c4645e05aaefae5502ab2304a5334 (diff) | |
parent | aaffe41e3161ff5684eb87202780680f2a006fbe (diff) | |
download | python-cinderclient-4c5e9f16e3addf5e082ec102fecf8ba3aec541f3.tar.gz |
Merge "Support filter volumes by group_id"
-rw-r--r-- | cinderclient/tests/unit/v3/test_shell.py | 12 | ||||
-rw-r--r-- | cinderclient/v3/shell.py | 6 |
2 files changed, 18 insertions, 0 deletions
diff --git a/cinderclient/tests/unit/v3/test_shell.py b/cinderclient/tests/unit/v3/test_shell.py index dc3dd68..bafc847 100644 --- a/cinderclient/tests/unit/v3/test_shell.py +++ b/cinderclient/tests/unit/v3/test_shell.py @@ -71,6 +71,18 @@ class ShellTest(utils.TestCase): # NOTE(jdg): we default to detail currently self.assert_called('GET', '/volumes/detail') + def test_list_with_group_id_before_3_10(self): + self.assertRaises(exceptions.UnsupportedAttribute, + self.run_command, + 'list --group_id fake_id') + + @ddt.data("3.10", "3.11") + def test_list_with_group_id_after_3_10(self, version): + command = ('--os-volume-api-version %s list --group_id fake_id' % + version) + self.run_command(command) + self.assert_called('GET', '/volumes/detail?group_id=fake_id') + def test_list_availability_zone(self): self.run_command('availability-zone-list') self.assert_called('GET', '/os-availability-zone') diff --git a/cinderclient/v3/shell.py b/cinderclient/v3/shell.py index cf3e425..13cba23 100644 --- a/cinderclient/v3/shell.py +++ b/cinderclient/v3/shell.py @@ -31,6 +31,11 @@ from cinderclient import utils from cinderclient.v2.shell import * # flake8: noqa +@utils.arg('--group_id', + metavar='<group_id>', + default=None, + help='Filters results by a group_id. Default=None.', + start_version='3.10') @utils.arg('--all-tenants', dest='all_tenants', metavar='<0|1>', @@ -137,6 +142,7 @@ def do_list(cs, args): 'glance_metadata': shell_utils.extract_metadata(args, type='image_metadata') if args.image_metadata else None, + 'group_id': getattr(args, 'group_id', None), } # If unavailable/non-existent fields are specified, these fields will |