Support to update auto_heal of container
Change-Id: I775598956b948eb969cd090db9825c2786d610a6
This commit is contained in:
@@ -909,7 +909,17 @@ class UpdateContainer(command.ShowOne):
|
|||||||
'--name',
|
'--name',
|
||||||
metavar='<name>',
|
metavar='<name>',
|
||||||
help='The new name of container to update')
|
help='The new name of container to update')
|
||||||
|
auto_heal_value = parser.add_mutually_exclusive_group()
|
||||||
|
auto_heal_value.add_argument(
|
||||||
|
'--auto-heal',
|
||||||
|
required=False,
|
||||||
|
action='store_true',
|
||||||
|
help='Automatic recovery the status of contaier')
|
||||||
|
auto_heal_value.add_argument(
|
||||||
|
'--no-auto-heal',
|
||||||
|
required=False,
|
||||||
|
action='store_true',
|
||||||
|
help='Needless recovery the status of contaier')
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
@@ -919,6 +929,10 @@ class UpdateContainer(command.ShowOne):
|
|||||||
opts['memory'] = parsed_args.memory
|
opts['memory'] = parsed_args.memory
|
||||||
opts['cpu'] = parsed_args.cpu
|
opts['cpu'] = parsed_args.cpu
|
||||||
opts['name'] = parsed_args.name
|
opts['name'] = parsed_args.name
|
||||||
|
if 'auto_heal' in parsed_args and parsed_args.auto_heal:
|
||||||
|
opts['auto_heal'] = True
|
||||||
|
if 'no_auto_heal' in parsed_args and parsed_args.no_auto_heal:
|
||||||
|
opts['auto_heal'] = False
|
||||||
opts = zun_utils.remove_null_parms(**opts)
|
opts = zun_utils.remove_null_parms(**opts)
|
||||||
if not opts:
|
if not opts:
|
||||||
raise exc.CommandError("You must update at least one property")
|
raise exc.CommandError("You must update at least one property")
|
||||||
|
|||||||
@@ -698,12 +698,26 @@ def do_run(cs, args):
|
|||||||
@utils.arg('--name',
|
@utils.arg('--name',
|
||||||
metavar='<name>',
|
metavar='<name>',
|
||||||
help='The new name for the container')
|
help='The new name for the container')
|
||||||
|
@utils.exclusive_arg(
|
||||||
|
'auto_heal_value',
|
||||||
|
'--auto-heal',
|
||||||
|
required=False, action='store_true',
|
||||||
|
help='Automatic recovery the status of contaier')
|
||||||
|
@utils.exclusive_arg(
|
||||||
|
'auto_heal_value',
|
||||||
|
'--no-auto-heal',
|
||||||
|
required=False, action='store_true',
|
||||||
|
help='Needless recovery the status of contaier')
|
||||||
def do_update(cs, args):
|
def do_update(cs, args):
|
||||||
"""Update one or more attributes of the container."""
|
"""Update one or more attributes of the container."""
|
||||||
opts = {}
|
opts = {}
|
||||||
opts['memory'] = args.memory
|
opts['memory'] = args.memory
|
||||||
opts['cpu'] = args.cpu
|
opts['cpu'] = args.cpu
|
||||||
opts['name'] = args.name
|
opts['name'] = args.name
|
||||||
|
if 'auto_heal' in args and args.auto_heal:
|
||||||
|
opts['auto_heal'] = True
|
||||||
|
if 'no_auto_heal' in args and args.no_auto_heal:
|
||||||
|
opts['auto_heal'] = False
|
||||||
opts = zun_utils.remove_null_parms(**opts)
|
opts = zun_utils.remove_null_parms(**opts)
|
||||||
if not opts:
|
if not opts:
|
||||||
raise exc.CommandError("You must update at least one property")
|
raise exc.CommandError("You must update at least one property")
|
||||||
|
|||||||
Reference in New Issue
Block a user