Enable "openstack server pause" command to take multiple servers.
Current "openstack server pause" command could only pause one server. Improve it to be able to handle more than one servers. Also improve the doc to reflect the new feature. Change-Id: I809f77f0720457c9cdc1028a70b391c75885984c Implements: blueprint cmd-with-multi-servers
This commit is contained in:
parent
6dfa304617
commit
a337f664d2
@ -311,17 +311,17 @@ Migrate server to different host
|
||||
server pause
|
||||
------------
|
||||
|
||||
Pause server
|
||||
Pause server(s)
|
||||
|
||||
.. program:: server pause
|
||||
.. code:: bash
|
||||
|
||||
os server pause
|
||||
<server>
|
||||
<server> [<server> ...]
|
||||
|
||||
.. describe:: <server>
|
||||
|
||||
Server (name or ID)
|
||||
Server(s) to pause (name or ID)
|
||||
|
||||
server reboot
|
||||
-------------
|
||||
|
@ -172,7 +172,7 @@ Those actions with an opposite action are noted in parens if applicable.
|
||||
* ``lock`` (``unlock``) - lock a server so that non-admin user won't be able to execute actions
|
||||
* ``migrate`` - move a server to a different host; ``--live`` performs a
|
||||
live migration if possible
|
||||
* ``pause`` (``unpause``) - stop a server and leave it in memory
|
||||
* ``pause`` (``unpause``) - stop one or more servers and leave them in memory
|
||||
* ``reboot`` - forcibly reboot a server
|
||||
* ``rebuild`` - rebuild a server using (most of) the same arguments as in the original create
|
||||
* ``remove`` (``add``) - remove an object from a group of objects
|
||||
|
@ -915,7 +915,7 @@ class MigrateServer(command.Command):
|
||||
|
||||
|
||||
class PauseServer(command.Command):
|
||||
"""Pause server"""
|
||||
"""Pause server(s)"""
|
||||
|
||||
log = logging.getLogger(__name__ + '.PauseServer')
|
||||
|
||||
@ -924,18 +924,19 @@ class PauseServer(command.Command):
|
||||
parser.add_argument(
|
||||
'server',
|
||||
metavar='<server>',
|
||||
help=_('Server (name or ID)'),
|
||||
nargs='+',
|
||||
help=_('Server(s) to pause (name or ID)'),
|
||||
)
|
||||
return parser
|
||||
|
||||
@utils.log_method(log)
|
||||
def take_action(self, parsed_args):
|
||||
|
||||
compute_client = self.app.client_manager.compute
|
||||
utils.find_resource(
|
||||
compute_client.servers,
|
||||
parsed_args.server,
|
||||
).pause()
|
||||
for server in parsed_args.server:
|
||||
utils.find_resource(
|
||||
compute_client.servers,
|
||||
server
|
||||
).pause()
|
||||
|
||||
|
||||
class RebootServer(command.Command):
|
||||
|
Loading…
x
Reference in New Issue
Block a user