Add support make a router HA
Currently router set CLI does not provide the support make a router highly available. The following patch enables the same. Checking for setting a router as HA is left on the neutron server itself. Partially-Implements: blueprint network-commands-options Change-Id: I0d0548cf037a14e5ccb2f732918ee9d1f63f43b4 Closes-Bug:#1631492
This commit is contained in:
parent
a58bacc619
commit
bae09c3c3f
@ -198,6 +198,7 @@ Set router properties
|
|||||||
[--distributed | --centralized]
|
[--distributed | --centralized]
|
||||||
[--description <description>]
|
[--description <description>]
|
||||||
[--route destination=<subnet>,gateway=<ip-address> | --no-route]
|
[--route destination=<subnet>,gateway=<ip-address> | --no-route]
|
||||||
|
[--ha | --no-ha]
|
||||||
<router>
|
<router>
|
||||||
|
|
||||||
.. option:: --name <name>
|
.. option:: --name <name>
|
||||||
@ -235,6 +236,14 @@ Set router properties
|
|||||||
|
|
||||||
Clear routes associated with the router
|
Clear routes associated with the router
|
||||||
|
|
||||||
|
.. option:: --ha
|
||||||
|
|
||||||
|
Set the router as highly available (disabled router only)
|
||||||
|
|
||||||
|
.. option:: --no-ha
|
||||||
|
|
||||||
|
Clear high availablability attribute of the router (disabled router only)
|
||||||
|
|
||||||
.. _router_set-router:
|
.. _router_set-router:
|
||||||
.. describe:: <router>
|
.. describe:: <router>
|
||||||
|
|
||||||
|
@ -433,11 +433,19 @@ class SetRouter(command.Command):
|
|||||||
action='store_true',
|
action='store_true',
|
||||||
help=argparse.SUPPRESS,
|
help=argparse.SUPPRESS,
|
||||||
)
|
)
|
||||||
|
routes_ha = parser.add_mutually_exclusive_group()
|
||||||
# TODO(tangchen): Support setting 'ha' property in 'router set'
|
routes_ha.add_argument(
|
||||||
# command. It appears that changing the ha state is supported by
|
'--ha',
|
||||||
# neutron under certain conditions.
|
action='store_true',
|
||||||
|
help=_("Set the router as highly available "
|
||||||
|
"(disabled router only)")
|
||||||
|
)
|
||||||
|
routes_ha.add_argument(
|
||||||
|
'--no-ha',
|
||||||
|
action='store_true',
|
||||||
|
help=_("Clear high availablability attribute of the router "
|
||||||
|
"(disabled router only)")
|
||||||
|
)
|
||||||
# TODO(tangchen): Support setting 'external_gateway_info' property in
|
# TODO(tangchen): Support setting 'external_gateway_info' property in
|
||||||
# 'router set' command.
|
# 'router set' command.
|
||||||
|
|
||||||
@ -451,6 +459,10 @@ class SetRouter(command.Command):
|
|||||||
attrs = _get_attrs(self.app.client_manager, parsed_args)
|
attrs = _get_attrs(self.app.client_manager, parsed_args)
|
||||||
|
|
||||||
# Get the route attributes.
|
# Get the route attributes.
|
||||||
|
if parsed_args.ha:
|
||||||
|
attrs['ha'] = True
|
||||||
|
elif parsed_args.no_ha:
|
||||||
|
attrs['ha'] = False
|
||||||
if parsed_args.no_route:
|
if parsed_args.no_route:
|
||||||
attrs['routes'] = []
|
attrs['routes'] = []
|
||||||
elif parsed_args.clear_routes:
|
elif parsed_args.clear_routes:
|
||||||
|
@ -529,6 +529,7 @@ class TestSetRouter(TestRouter):
|
|||||||
'--enable',
|
'--enable',
|
||||||
'--distributed',
|
'--distributed',
|
||||||
'--name', 'noob',
|
'--name', 'noob',
|
||||||
|
'--no-ha',
|
||||||
'--description', 'router',
|
'--description', 'router',
|
||||||
]
|
]
|
||||||
verifylist = [
|
verifylist = [
|
||||||
@ -537,6 +538,7 @@ class TestSetRouter(TestRouter):
|
|||||||
('distributed', True),
|
('distributed', True),
|
||||||
('name', 'noob'),
|
('name', 'noob'),
|
||||||
('description', 'router'),
|
('description', 'router'),
|
||||||
|
('no_ha', True),
|
||||||
]
|
]
|
||||||
|
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
@ -546,6 +548,7 @@ class TestSetRouter(TestRouter):
|
|||||||
'admin_state_up': True,
|
'admin_state_up': True,
|
||||||
'distributed': True,
|
'distributed': True,
|
||||||
'name': 'noob',
|
'name': 'noob',
|
||||||
|
'ha': False,
|
||||||
'description': 'router',
|
'description': 'router',
|
||||||
}
|
}
|
||||||
self.network.update_router.assert_called_once_with(
|
self.network.update_router.assert_called_once_with(
|
||||||
@ -557,11 +560,13 @@ class TestSetRouter(TestRouter):
|
|||||||
self._router.name,
|
self._router.name,
|
||||||
'--disable',
|
'--disable',
|
||||||
'--centralized',
|
'--centralized',
|
||||||
|
'--ha',
|
||||||
]
|
]
|
||||||
verifylist = [
|
verifylist = [
|
||||||
('router', self._router.name),
|
('router', self._router.name),
|
||||||
('disable', True),
|
('disable', True),
|
||||||
('centralized', True),
|
('centralized', True),
|
||||||
|
('ha', True),
|
||||||
]
|
]
|
||||||
|
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
@ -570,6 +575,7 @@ class TestSetRouter(TestRouter):
|
|||||||
attrs = {
|
attrs = {
|
||||||
'admin_state_up': False,
|
'admin_state_up': False,
|
||||||
'distributed': False,
|
'distributed': False,
|
||||||
|
'ha': True,
|
||||||
}
|
}
|
||||||
self.network.update_router.assert_called_once_with(
|
self.network.update_router.assert_called_once_with(
|
||||||
self._router, **attrs)
|
self._router, **attrs)
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Add support to update high-availability property of
|
||||||
|
a router by adding ``--ha`` and ``--no-ha`` option
|
||||||
|
to ``router set`` CLI.
|
||||||
|
[Bug `1631492 <https://bugs.launchpad.net/bugs/1631492>`_]
|
Loading…
Reference in New Issue
Block a user