diff --git a/novaclient/v2/server_groups.py b/novaclient/v2/server_groups.py index 62758c34b..7a01ba0db 100644 --- a/novaclient/v2/server_groups.py +++ b/novaclient/v2/server_groups.py @@ -84,10 +84,15 @@ class ServerGroupsManager(base.ManagerWithFind): """ return self._delete('/os-server-groups/%s' % id) - def create(self, **kwargs): + def create(self, name, policies): """Create (allocate) a server group. + :param name: The name of the server group. + :param policies: Policy name or a list of exactly one policy name to + associate with the server group. :rtype: list of :class:`ServerGroup` """ - body = {'server_group': kwargs} + policies = policies if isinstance(policies, list) else [policies] + body = {'server_group': {'name': name, + 'policies': policies}} return self._create('/os-server-groups', body, 'server_group') diff --git a/novaclient/v2/shell.py b/novaclient/v2/shell.py index 48fc4968a..90602c204 100644 --- a/novaclient/v2/shell.py +++ b/novaclient/v2/shell.py @@ -4280,9 +4280,8 @@ def do_server_group_list(cs, args): help=_('Policies for the server groups.')) def do_server_group_create(cs, args): """Create a new server group with the specified details.""" - kwargs = {'name': args.name, - 'policies': args.policy} - server_group = cs.server_groups.create(**kwargs) + server_group = cs.server_groups.create(name=args.name, + policies=args.policy) _print_server_group_details(cs, [server_group])