Merge "Allow override of distributed router flag"
This commit is contained in:
commit
62d71aa243
@ -63,7 +63,7 @@ Create new router
|
|||||||
openstack router create
|
openstack router create
|
||||||
[--project <project> [--project-domain <project-domain>]]
|
[--project <project> [--project-domain <project-domain>]]
|
||||||
[--enable | --disable]
|
[--enable | --disable]
|
||||||
[--distributed]
|
[--distributed | --centralized]
|
||||||
[--ha | --no-ha]
|
[--ha | --no-ha]
|
||||||
[--description <description>]
|
[--description <description>]
|
||||||
[--availability-zone-hint <availability-zone>]
|
[--availability-zone-hint <availability-zone>]
|
||||||
@ -90,6 +90,19 @@ Create new router
|
|||||||
|
|
||||||
Create a distributed router
|
Create a distributed router
|
||||||
|
|
||||||
|
The default router type (distributed vs centralized) is determined by a
|
||||||
|
configuration setting in the OpenStack deployment. Since we are unable
|
||||||
|
to know that default wihtout attempting to actually create a router it
|
||||||
|
is suggested to use either :option:`--distributed` or :option:`--centralized`
|
||||||
|
in situations where multiple cloud deployments may be used.
|
||||||
|
|
||||||
|
.. option:: --centralized
|
||||||
|
|
||||||
|
Create a centralized router
|
||||||
|
|
||||||
|
See the note in :option:`--distributed` regarding the default used when
|
||||||
|
creating a new router.
|
||||||
|
|
||||||
.. option:: --ha
|
.. option:: --ha
|
||||||
|
|
||||||
Create a highly available router
|
Create a highly available router
|
||||||
|
@ -78,8 +78,7 @@ def _get_attrs(client_manager, parsed_args):
|
|||||||
attrs['admin_state_up'] = True
|
attrs['admin_state_up'] = True
|
||||||
if parsed_args.disable:
|
if parsed_args.disable:
|
||||||
attrs['admin_state_up'] = False
|
attrs['admin_state_up'] = False
|
||||||
# centralized is available only for SetRouter and not for CreateRouter
|
if parsed_args.centralized:
|
||||||
if 'centralized' in parsed_args and parsed_args.centralized:
|
|
||||||
attrs['distributed'] = False
|
attrs['distributed'] = False
|
||||||
if parsed_args.distributed:
|
if parsed_args.distributed:
|
||||||
attrs['distributed'] = True
|
attrs['distributed'] = True
|
||||||
@ -176,13 +175,17 @@ class CreateRouter(command.ShowOne):
|
|||||||
action='store_true',
|
action='store_true',
|
||||||
help=_("Disable router")
|
help=_("Disable router")
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
distribute_group = parser.add_mutually_exclusive_group()
|
||||||
|
distribute_group.add_argument(
|
||||||
'--distributed',
|
'--distributed',
|
||||||
dest='distributed',
|
|
||||||
action='store_true',
|
action='store_true',
|
||||||
default=False,
|
|
||||||
help=_("Create a distributed router")
|
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 = parser.add_mutually_exclusive_group()
|
||||||
ha_group.add_argument(
|
ha_group.add_argument(
|
||||||
'--ha',
|
'--ha',
|
||||||
|
@ -211,6 +211,35 @@ class TestCreateRouter(TestRouter):
|
|||||||
def test_create_with_no_ha_option(self):
|
def test_create_with_no_ha_option(self):
|
||||||
self._test_create_with_ha_options('--no-ha', False)
|
self._test_create_with_ha_options('--no-ha', False)
|
||||||
|
|
||||||
|
def _test_create_with_distributed_options(self, option, distributed):
|
||||||
|
arglist = [
|
||||||
|
option,
|
||||||
|
self.new_router.name,
|
||||||
|
]
|
||||||
|
verifylist = [
|
||||||
|
('name', self.new_router.name),
|
||||||
|
('enable', True),
|
||||||
|
('distributed', distributed),
|
||||||
|
('centralized', not distributed),
|
||||||
|
]
|
||||||
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
|
|
||||||
|
columns, data = (self.cmd.take_action(parsed_args))
|
||||||
|
|
||||||
|
self.network.create_router.assert_called_once_with(**{
|
||||||
|
'admin_state_up': True,
|
||||||
|
'name': self.new_router.name,
|
||||||
|
'distributed': distributed,
|
||||||
|
})
|
||||||
|
self.assertEqual(self.columns, columns)
|
||||||
|
self.assertEqual(self.data, data)
|
||||||
|
|
||||||
|
def test_create_with_distributed_option(self):
|
||||||
|
self._test_create_with_distributed_options('--distributed', True)
|
||||||
|
|
||||||
|
def test_create_with_centralized_option(self):
|
||||||
|
self._test_create_with_distributed_options('--centralized', False)
|
||||||
|
|
||||||
def test_create_with_AZ_hints(self):
|
def test_create_with_AZ_hints(self):
|
||||||
arglist = [
|
arglist = [
|
||||||
self.new_router.name,
|
self.new_router.name,
|
||||||
|
9
releasenotes/notes/bug-1664255-f82c5c13d92fed2a.yaml
Normal file
9
releasenotes/notes/bug-1664255-f82c5c13d92fed2a.yaml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
Allow users to create centralized (distributed=False)
|
||||||
|
routers using the ``--centralized`` option in ``router create``.
|
||||||
|
Without this, routers are created based on the default
|
||||||
|
neutron configuration of the deployment, which, for example,
|
||||||
|
could be 'distributed'.
|
||||||
|
[Bug `1664255 <https://bugs.launchpad.net/bugs/1664255>`_]
|
Loading…
x
Reference in New Issue
Block a user