Add "server start" command to osc.
There is no start command in osc. Add it. Change-Id: Ic50f83413ab17c53396065aabb3f5a1506b52959 Implements: blueprint cmd-with-multi-servers
This commit is contained in:
parent
d4fb5cefda
commit
1809faaf1f
@ -595,6 +595,21 @@ Ssh to server
|
||||
|
||||
Server (name or ID)
|
||||
|
||||
server start
|
||||
------------
|
||||
|
||||
Start server(s)
|
||||
|
||||
.. program:: server start
|
||||
.. code:: bash
|
||||
|
||||
os server start
|
||||
<server> [<server> ...]
|
||||
|
||||
.. describe:: <server>
|
||||
|
||||
Server(s) to start (name or ID)
|
||||
|
||||
server suspend
|
||||
--------------
|
||||
|
||||
|
@ -183,6 +183,7 @@ Those actions with an opposite action are noted in parens if applicable.
|
||||
* ``save`` - download an object locally
|
||||
* ``set`` (``unset``) - set a property on the object, formerly called metadata
|
||||
* ``show`` - display detailed information about the specific object
|
||||
* ``start`` - start one or more servers
|
||||
* ``suspend`` (``resume``) - stop a server and save to disk freeing memory
|
||||
* ``unlock`` (``lock``) - unlock a server
|
||||
* ``unpause`` (``pause``) - return a paused server to running state
|
||||
|
@ -1483,6 +1483,31 @@ class SshServer(command.Command):
|
||||
os.system(cmd % (login, ip_address))
|
||||
|
||||
|
||||
class StartServer(command.Command):
|
||||
"""Start server(s)."""
|
||||
|
||||
log = logging.getLogger(__name__ + '.StartServer')
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(StartServer, self).get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'server',
|
||||
metavar='<server>',
|
||||
nargs="+",
|
||||
help=_('Server(s) to start (name or ID)'),
|
||||
)
|
||||
return parser
|
||||
|
||||
@utils.log_method(log)
|
||||
def take_action(self, parsed_args):
|
||||
compute_client = self.app.client_manager.compute
|
||||
for server in parsed_args.server:
|
||||
utils.find_resource(
|
||||
compute_client.servers,
|
||||
server,
|
||||
).start()
|
||||
|
||||
|
||||
class SuspendServer(command.Command):
|
||||
"""Suspend server"""
|
||||
|
||||
|
@ -133,6 +133,7 @@ openstack.compute.v2 =
|
||||
server_set = openstackclient.compute.v2.server:SetServer
|
||||
server_show = openstackclient.compute.v2.server:ShowServer
|
||||
server_ssh = openstackclient.compute.v2.server:SshServer
|
||||
server_start = openstackclient.compute.v2.server:StartServer
|
||||
server_suspend = openstackclient.compute.v2.server:SuspendServer
|
||||
server_unlock = openstackclient.compute.v2.server:UnlockServer
|
||||
server_unpause = openstackclient.compute.v2.server:UnpauseServer
|
||||
|
Loading…
Reference in New Issue
Block a user