compute: Switch server restore to SDK
Change-Id: I8df9711b736991c01136988aa06c8540d640f52f Signed-off-by: Stephen Finucane <sfinucan@redhat.com> Depends-On: https://review.opendev.org/c/openstack/openstacksdk/+/868108
This commit is contained in:
parent
29fafabeed
commit
004b2ab2fb
@ -4050,12 +4050,13 @@ class RestoreServer(command.Command):
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
compute_client = self.app.client_manager.compute
|
||||
compute_client = self.app.client_manager.sdk_connection.compute
|
||||
for server in parsed_args.server:
|
||||
utils.find_resource(
|
||||
compute_client.servers,
|
||||
server
|
||||
).restore()
|
||||
server_id = compute_client.find_server(
|
||||
server,
|
||||
ignore_missing=False,
|
||||
).id
|
||||
compute_client.restore_server(server_id)
|
||||
|
||||
|
||||
class ResumeServer(command.Command):
|
||||
|
@ -7499,21 +7499,16 @@ class TestServerRevertMigration(TestServer):
|
||||
class TestServerRestore(TestServer):
|
||||
|
||||
def setUp(self):
|
||||
super(TestServerRestore, self).setUp()
|
||||
super().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)
|
||||
self.run_method_with_sdk_servers('restore_server', 1)
|
||||
|
||||
def test_server_restore_multi_servers(self):
|
||||
self.run_method_with_servers('restore', 3)
|
||||
self.run_method_with_sdk_servers('restore_server', 3)
|
||||
|
||||
|
||||
class TestServerResume(TestServer):
|
||||
|
@ -0,0 +1,4 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
The ``server restore`` command has been migrated to SDK.
|
Loading…
Reference in New Issue
Block a user