Merge "compute: Switch server restore to SDK"

This commit is contained in:
Zuul
2023-04-03 20:36:11 +00:00
committed by Gerrit Code Review
3 changed files with 13 additions and 13 deletions

View File

@@ -4044,12 +4044,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):

View File

@@ -7498,21 +7498,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):

View File

@@ -0,0 +1,4 @@
---
features:
- |
The ``server restore`` command has been migrated to SDK.