Rename 'reboot' to 'restart'
Change-Id: I412fdb2123feb57b9fd5bcdb47ab389271d0d7e0 Closes-Bug: #1682679
This commit is contained in:
@@ -34,7 +34,7 @@ openstack.container.v1 =
|
|||||||
appcontainer_show = zunclient.osc.v1.containers:ShowContainer
|
appcontainer_show = zunclient.osc.v1.containers:ShowContainer
|
||||||
appcontainer_list = zunclient.osc.v1.containers:ListContainer
|
appcontainer_list = zunclient.osc.v1.containers:ListContainer
|
||||||
appcontainer_delete = zunclient.osc.v1.containers:DeleteContainer
|
appcontainer_delete = zunclient.osc.v1.containers:DeleteContainer
|
||||||
appcontainer_reboot = zunclient.osc.v1.containers:RebootContainer
|
appcontainer_restart = zunclient.osc.v1.containers:RestartContainer
|
||||||
appcontainer_start = zunclient.osc.v1.containers:StartContainer
|
appcontainer_start = zunclient.osc.v1.containers:StartContainer
|
||||||
appcontainer_pause = zunclient.osc.v1.containers:PauseContainer
|
appcontainer_pause = zunclient.osc.v1.containers:PauseContainer
|
||||||
appcontainer_unpause = zunclient.osc.v1.containers:UnpauseContainer
|
appcontainer_unpause = zunclient.osc.v1.containers:UnpauseContainer
|
||||||
|
@@ -242,22 +242,22 @@ class DeleteContainer(command.Command):
|
|||||||
{'container': container, 'e': e})
|
{'container': container, 'e': e})
|
||||||
|
|
||||||
|
|
||||||
class RebootContainer(command.Command):
|
class RestartContainer(command.Command):
|
||||||
"""Reboot specified container"""
|
"""Restart specified container"""
|
||||||
log = logging.getLogger(__name__ + ".RebootContainer")
|
log = logging.getLogger(__name__ + ".RestartContainer")
|
||||||
|
|
||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super(RebootContainer, self).get_parser(prog_name)
|
parser = super(RestartContainer, self).get_parser(prog_name)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'container',
|
'container',
|
||||||
metavar='<container>',
|
metavar='<container>',
|
||||||
nargs='+',
|
nargs='+',
|
||||||
help='ID or name of the (container)s to reboot.')
|
help='ID or name of the (container)s to restart.')
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--timeout',
|
'--timeout',
|
||||||
metavar='<timeout>',
|
metavar='<timeout>',
|
||||||
default=10,
|
default=10,
|
||||||
help='Seconds to wait for stop before rebooting (container)s')
|
help='Seconds to wait for stop before restarting (container)s')
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
@@ -265,11 +265,11 @@ class RebootContainer(command.Command):
|
|||||||
containers = parsed_args.container
|
containers = parsed_args.container
|
||||||
for container in containers:
|
for container in containers:
|
||||||
try:
|
try:
|
||||||
client.containers.reboot(container, parsed_args.timeout)
|
client.containers.restart(container, parsed_args.timeout)
|
||||||
print(_('Request to reboot container %s has been accepted')
|
print(_('Request to restart container %s has been accepted')
|
||||||
% container)
|
% container)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Reboot for container %(container)s failed: %(e)s" %
|
print("Restart for container %(container)s failed: %(e)s" %
|
||||||
{'container': container, 'e': e})
|
{'container': container, 'e': e})
|
||||||
|
|
||||||
|
|
||||||
|
@@ -415,8 +415,8 @@ class ContainerManagerTest(testtools.TestCase):
|
|||||||
self.assertEqual(expect, self.api.calls)
|
self.assertEqual(expect, self.api.calls)
|
||||||
self.assertTrue(containers)
|
self.assertTrue(containers)
|
||||||
|
|
||||||
def test_containers_reboot(self):
|
def test_containers_restart(self):
|
||||||
containers = self.mgr.reboot(CONTAINER1['id'], timeout)
|
containers = self.mgr.restart(CONTAINER1['id'], timeout)
|
||||||
expect = [
|
expect = [
|
||||||
('POST', '/v1/containers/%s/reboot?timeout=10' % CONTAINER1['id'],
|
('POST', '/v1/containers/%s/reboot?timeout=10' % CONTAINER1['id'],
|
||||||
{'Content-Length': '0'}, None)
|
{'Content-Length': '0'}, None)
|
||||||
|
@@ -127,7 +127,7 @@ class ContainerManager(base.Manager):
|
|||||||
return self._action(id, '/stop',
|
return self._action(id, '/stop',
|
||||||
qparams={'timeout': timeout})
|
qparams={'timeout': timeout})
|
||||||
|
|
||||||
def reboot(self, id, timeout):
|
def restart(self, id, timeout):
|
||||||
return self._action(id, '/reboot',
|
return self._action(id, '/reboot',
|
||||||
qparams={'timeout': timeout})
|
qparams={'timeout': timeout})
|
||||||
|
|
||||||
|
@@ -209,20 +209,20 @@ def do_show(cs, args):
|
|||||||
@utils.arg('containers',
|
@utils.arg('containers',
|
||||||
metavar='<container>',
|
metavar='<container>',
|
||||||
nargs='+',
|
nargs='+',
|
||||||
help='ID or name of the (container)s to reboot.')
|
help='ID or name of the (container)s to restart.')
|
||||||
@utils.arg('-t', '--timeout',
|
@utils.arg('-t', '--timeout',
|
||||||
metavar='<timeout>',
|
metavar='<timeout>',
|
||||||
default=10,
|
default=10,
|
||||||
help='Seconds to wait for stop before rebooting (container)s')
|
help='Seconds to wait for stop before restarting (container)s')
|
||||||
def do_reboot(cs, args):
|
def do_restart(cs, args):
|
||||||
"""Reboot specified containers."""
|
"""Restart specified containers."""
|
||||||
for container in args.containers:
|
for container in args.containers:
|
||||||
try:
|
try:
|
||||||
cs.containers.reboot(container, args.timeout)
|
cs.containers.restart(container, args.timeout)
|
||||||
print("Request to reboot container %s has been accepted." %
|
print("Request to restart container %s has been accepted." %
|
||||||
container)
|
container)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Reboot for container %(container)s failed: %(e)s" %
|
print("Restart for container %(container)s failed: %(e)s" %
|
||||||
{'container': container, 'e': e})
|
{'container': container, 'e': e})
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user