From fe59e339ae6dd6a5e9075773fb5c2a0fea9c2e53 Mon Sep 17 00:00:00 2001 From: venkata anil Date: Tue, 14 Feb 2017 05:05:20 +0000 Subject: Allow override of distributed router flag When router_distributed=True is set in neutron.conf, user can't override this and create a centralized router through openstack client. Openstack client allows modifying routers from distributed to centralized after creation but not supporting centralized flag during creation. We allow centralized and distributed flags during router creation with this change. Closes-bug: #1664255 Change-Id: I75f72ca695338ad8c381cfa89fbb9d8e61ee7bc5 --- openstackclient/network/v2/router.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'openstackclient/network') diff --git a/openstackclient/network/v2/router.py b/openstackclient/network/v2/router.py index f322d5d1..0da91baa 100644 --- a/openstackclient/network/v2/router.py +++ b/openstackclient/network/v2/router.py @@ -78,8 +78,7 @@ def _get_attrs(client_manager, parsed_args): attrs['admin_state_up'] = True if parsed_args.disable: attrs['admin_state_up'] = False - # centralized is available only for SetRouter and not for CreateRouter - if 'centralized' in parsed_args and parsed_args.centralized: + if parsed_args.centralized: attrs['distributed'] = False if parsed_args.distributed: attrs['distributed'] = True @@ -176,13 +175,17 @@ class CreateRouter(command.ShowOne): action='store_true', help=_("Disable router") ) - parser.add_argument( + distribute_group = parser.add_mutually_exclusive_group() + distribute_group.add_argument( '--distributed', - dest='distributed', action='store_true', - default=False, help=_("Create a distributed router") ) + distribute_group.add_argument( + '--centralized', + action='store_true', + help=_("Create a centralized router") + ) ha_group = parser.add_mutually_exclusive_group() ha_group.add_argument( '--ha', -- cgit v1.2.1