Merge "[compute] Support restore server"
This commit is contained in:
commit
fa3a34322c
@ -514,6 +514,21 @@ process for the user: the first is to perform the resize, the second is
|
||||
to either confirm (verify) success and release the old server, or to declare
|
||||
a revert to release the new server and restart the old one.
|
||||
|
||||
server restore
|
||||
--------------
|
||||
|
||||
Restore server(s) from soft-deleted state
|
||||
|
||||
.. program:: server restore
|
||||
.. code:: bash
|
||||
|
||||
os server restore
|
||||
<server> [<server> ...]
|
||||
|
||||
.. describe:: <server>
|
||||
|
||||
Server(s) to restore (name or ID)
|
||||
|
||||
server resume
|
||||
-------------
|
||||
|
||||
|
@ -201,7 +201,7 @@ Those actions with an opposite action are noted in parens if applicable.
|
||||
* ``remove`` (``add``) - remove an object from a group of objects
|
||||
* ``rescue`` (``unrescue``) - reboot a server in a special rescue mode allowing access to the original disks
|
||||
* ``resize`` - change a server's flavor
|
||||
* ``restore`` - restore a heat stack snapshot
|
||||
* ``restore`` - restore a heat stack snapshot or restore a server in soft-deleted state
|
||||
* ``resume`` (``suspend``) - return one or more suspended servers to running state
|
||||
* ``revoke`` (``issue``) - revoke a token
|
||||
* ``save`` - download an object locally
|
||||
|
@ -1273,6 +1273,28 @@ class ResizeServer(command.Command):
|
||||
compute_client.servers.revert_resize(server)
|
||||
|
||||
|
||||
class RestoreServer(command.Command):
|
||||
"""Restore server(s)"""
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(RestoreServer, self).get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'server',
|
||||
metavar='<server>',
|
||||
nargs='+',
|
||||
help=_('Server(s) to restore (name or ID)'),
|
||||
)
|
||||
return parser
|
||||
|
||||
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
|
||||
).restore()
|
||||
|
||||
|
||||
class ResumeServer(command.Command):
|
||||
"""Resume server(s)"""
|
||||
|
||||
|
@ -1171,6 +1171,26 @@ class TestServerResize(TestServer):
|
||||
)
|
||||
|
||||
|
||||
class TestServerRestore(TestServer):
|
||||
|
||||
def setUp(self):
|
||||
super(TestServerRestore, self).setUp()
|
||||
|
||||
# Get the command object to test
|
||||
self.cmd = server.RestoreServer(self.app, None)
|
||||
|
||||
# Set methods to be tested.
|
||||
self.methods = {
|
||||
'restore': None,
|
||||
}
|
||||
|
||||
def test_server_restore_one_server(self):
|
||||
self.run_method_with_servers('restore', 1)
|
||||
|
||||
def test_server_restore_multi_servers(self):
|
||||
self.run_method_with_servers('restore', 3)
|
||||
|
||||
|
||||
class TestServerResume(TestServer):
|
||||
|
||||
def setUp(self):
|
||||
|
@ -0,0 +1,4 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
Add support for the ``server restore`` command.
|
@ -120,6 +120,7 @@ openstack.compute.v2 =
|
||||
server_remove_volume = openstackclient.compute.v2.server:RemoveServerVolume
|
||||
server_rescue = openstackclient.compute.v2.server:RescueServer
|
||||
server_resize = openstackclient.compute.v2.server:ResizeServer
|
||||
server_restore = openstackclient.compute.v2.server:RestoreServer
|
||||
server_resume = openstackclient.compute.v2.server:ResumeServer
|
||||
server_set = openstackclient.compute.v2.server:SetServer
|
||||
server_shelve = openstackclient.compute.v2.server:ShelveServer
|
||||
|
Loading…
Reference in New Issue
Block a user