Enable "openstack server suspend" command to take multiple servers.
Current "openstack server suspend" command could only suspend one server. Improve it to be able to handle more than one servers. Also improve the doc to reflect the new feature. Change-Id: Ic0417ee28f46c9198a35744c0180342e61966b26 Implements: blueprint cmd-with-multi-servers
This commit is contained in:
parent
42a5909f6a
commit
4955117dff
@ -628,17 +628,17 @@ Stop server(s)
|
||||
server suspend
|
||||
--------------
|
||||
|
||||
Suspend server
|
||||
Suspend server(s)
|
||||
|
||||
.. program:: server suspend
|
||||
.. code:: bash
|
||||
|
||||
os server suspend
|
||||
<server>
|
||||
<server> [<server> ...]
|
||||
|
||||
.. describe:: <server>
|
||||
|
||||
Server (name or ID)
|
||||
Server(s) to suspend (name or ID)
|
||||
|
||||
server unlock
|
||||
-------------
|
||||
|
@ -185,7 +185,7 @@ Those actions with an opposite action are noted in parens if applicable.
|
||||
* ``show`` - display detailed information about the specific object
|
||||
* ``start`` (``stop``) - start one or more servers
|
||||
* ``stop`` (``start``) - stop one or more servers
|
||||
* ``suspend`` (``resume``) - stop a server and save to disk freeing memory
|
||||
* ``suspend`` (``resume``) - stop one or more servers and save to disk freeing memory
|
||||
* ``unlock`` (``lock``) - unlock one or more servers
|
||||
* ``unpause`` (``pause``) - return one or more paused servers to running state
|
||||
* ``unrescue`` (``rescue``) - return a server to normal boot mode
|
||||
|
@ -1585,7 +1585,7 @@ class StopServer(command.Command):
|
||||
|
||||
|
||||
class SuspendServer(command.Command):
|
||||
"""Suspend server"""
|
||||
"""Suspend server(s)"""
|
||||
|
||||
log = logging.getLogger(__name__ + '.SuspendServer')
|
||||
|
||||
@ -1594,7 +1594,8 @@ class SuspendServer(command.Command):
|
||||
parser.add_argument(
|
||||
'server',
|
||||
metavar='<server>',
|
||||
help=_('Server (name or ID)'),
|
||||
nargs='+',
|
||||
help=_('Server(s) to suspend (name or ID)'),
|
||||
)
|
||||
return parser
|
||||
|
||||
@ -1602,10 +1603,11 @@ class SuspendServer(command.Command):
|
||||
def take_action(self, parsed_args):
|
||||
|
||||
compute_client = self.app.client_manager.compute
|
||||
utils.find_resource(
|
||||
compute_client.servers,
|
||||
parsed_args.server,
|
||||
).suspend()
|
||||
for server in parsed_args.server:
|
||||
utils.find_resource(
|
||||
compute_client.servers,
|
||||
server,
|
||||
).suspend()
|
||||
|
||||
|
||||
class UnlockServer(command.Command):
|
||||
|
Loading…
x
Reference in New Issue
Block a user