File tree Expand file tree Collapse file tree
doc/source/command-objects Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -198,6 +198,7 @@ Set router properties
198198 [--distributed | --centralized]
199199 [--description <description>]
200200 [--route destination=<subnet>,gateway=<ip-address> | --no-route]
201+ [--ha | --no-ha]
201202 <router>
202203
203204.. option:: --name <name>
@@ -235,6 +236,14 @@ Set router properties
235236
236237 Clear routes associated with the router
237238
239+ .. option:: --ha
240+
241+ Set the router as highly available (disabled router only)
242+
243+ .. option:: --no-ha
244+
245+ Clear high availablability attribute of the router (disabled router only)
246+
238247.. _router_set-router:
239248.. describe:: <router>
240249
Original file line number Diff line number Diff line change @@ -433,11 +433,19 @@ def get_parser(self, prog_name):
433433 action = 'store_true' ,
434434 help = argparse .SUPPRESS ,
435435 )
436-
437- # TODO(tangchen): Support setting 'ha' property in 'router set'
438- # command. It appears that changing the ha state is supported by
439- # neutron under certain conditions.
440-
436+ routes_ha = parser .add_mutually_exclusive_group ()
437+ routes_ha .add_argument (
438+ '--ha' ,
439+ action = 'store_true' ,
440+ help = _ ("Set the router as highly available "
441+ "(disabled router only)" )
442+ )
443+ routes_ha .add_argument (
444+ '--no-ha' ,
445+ action = 'store_true' ,
446+ help = _ ("Clear high availablability attribute of the router "
447+ "(disabled router only)" )
448+ )
441449 # TODO(tangchen): Support setting 'external_gateway_info' property in
442450 # 'router set' command.
443451
@@ -451,6 +459,10 @@ def take_action(self, parsed_args):
451459 attrs = _get_attrs (self .app .client_manager , parsed_args )
452460
453461 # Get the route attributes.
462+ if parsed_args .ha :
463+ attrs ['ha' ] = True
464+ elif parsed_args .no_ha :
465+ attrs ['ha' ] = False
454466 if parsed_args .no_route :
455467 attrs ['routes' ] = []
456468 elif parsed_args .clear_routes :
Original file line number Diff line number Diff line change @@ -529,6 +529,7 @@ def test_set_this(self):
529529 '--enable' ,
530530 '--distributed' ,
531531 '--name' , 'noob' ,
532+ '--no-ha' ,
532533 '--description' , 'router' ,
533534 ]
534535 verifylist = [
@@ -537,6 +538,7 @@ def test_set_this(self):
537538 ('distributed' , True ),
538539 ('name' , 'noob' ),
539540 ('description' , 'router' ),
541+ ('no_ha' , True ),
540542 ]
541543
542544 parsed_args = self .check_parser (self .cmd , arglist , verifylist )
@@ -546,6 +548,7 @@ def test_set_this(self):
546548 'admin_state_up' : True ,
547549 'distributed' : True ,
548550 'name' : 'noob' ,
551+ 'ha' : False ,
549552 'description' : 'router' ,
550553 }
551554 self .network .update_router .assert_called_once_with (
@@ -557,11 +560,13 @@ def test_set_that(self):
557560 self ._router .name ,
558561 '--disable' ,
559562 '--centralized' ,
563+ '--ha' ,
560564 ]
561565 verifylist = [
562566 ('router' , self ._router .name ),
563567 ('disable' , True ),
564568 ('centralized' , True ),
569+ ('ha' , True ),
565570 ]
566571
567572 parsed_args = self .check_parser (self .cmd , arglist , verifylist )
@@ -570,6 +575,7 @@ def test_set_that(self):
570575 attrs = {
571576 'admin_state_up' : False ,
572577 'distributed' : False ,
578+ 'ha' : True ,
573579 }
574580 self .network .update_router .assert_called_once_with (
575581 self ._router , ** attrs )
Original file line number Diff line number Diff line change 1+ ---
2+ features :
3+ - |
4+ Add support to update high-availability property of
5+ a router by adding ``--ha`` and ``--no-ha`` option
6+ to ``router set`` CLI.
7+ [Bug `1631492 <https://bugs.launchpad.net/bugs/1631492>`_]
You can’t perform that action at this time.
0 commit comments