Group specs can not be set in share group type create CLI
Added group specs in share group type create CLI Closes-Bug: 1709746 Change-Id: Ie11f6c63e41d4de4ef94c21e3a2979943d25484a
This commit is contained in:
parent
8ebd4b3bb7
commit
1614b34a83
@ -2332,7 +2332,7 @@ class ShellTest(test_utils.TestCase):
|
||||
mock.ANY, columns=mock.ANY)
|
||||
|
||||
@ddt.data(True, False)
|
||||
def test_share_group_type_create_with_access(self, public):
|
||||
def test_share_group_type_create_with_access_and_group_specs(self, public):
|
||||
fake_share_type_1 = type('FakeShareType', (object,), {'id': '1234'})
|
||||
fake_share_type_2 = type('FakeShareType', (object,), {'id': '5678'})
|
||||
self.mock_object(
|
||||
@ -2342,14 +2342,15 @@ class ShellTest(test_utils.TestCase):
|
||||
'share_group_type': {
|
||||
'name': 'test-group-type-1',
|
||||
'share_types': ['1234', '5678'],
|
||||
'group_specs': {},
|
||||
'group_specs': {'spec1': 'value1'},
|
||||
'is_public': public,
|
||||
}
|
||||
}
|
||||
|
||||
self.run_command(
|
||||
'share-group-type-create test-group-type-1 type1,type2 '
|
||||
'--is-public %s' % six.text_type(public))
|
||||
'share-group-type-create test-group-type-1 '
|
||||
'type1,type2 --is-public %s --group-specs '
|
||||
'spec1=value1' % six.text_type(public))
|
||||
|
||||
self.assert_called('POST', '/share-group-types', body=expected)
|
||||
|
||||
|
@ -3985,6 +3985,17 @@ def do_share_group_type_specs_list(cs, args):
|
||||
metavar='<is_public>',
|
||||
action='single_alias',
|
||||
help='Make type accessible to the public (default true).')
|
||||
@cliutils.arg(
|
||||
'--group-specs',
|
||||
'--group_specs',
|
||||
metavar='<key=value>',
|
||||
type=str,
|
||||
nargs='*',
|
||||
action='single_alias',
|
||||
default=None,
|
||||
help='Share Group type extra specs by key and value. '
|
||||
'OPTIONAL: Default=None. '
|
||||
'Example: "--group-specs consistent_snapshot_support=host".',)
|
||||
@cliutils.service_type('sharev2')
|
||||
@api_versions.experimental_api
|
||||
def do_share_group_type_create(cs, args):
|
||||
@ -3998,6 +4009,8 @@ def do_share_group_type_create(cs, args):
|
||||
'name': args.name,
|
||||
'is_public': strutils.bool_from_string(args.is_public, default=True),
|
||||
}
|
||||
if args.group_specs is not None:
|
||||
kwargs['group_specs'] = _extract_group_specs(args)
|
||||
|
||||
sg_type = cs.share_group_types.create(**kwargs)
|
||||
_print_share_group_type(sg_type)
|
||||
|
@ -0,0 +1,3 @@
|
||||
---
|
||||
fixes:
|
||||
- Added group specs in share group type create CLI.
|
Loading…
x
Reference in New Issue
Block a user