Merge "Switch server suspend and server resume to SDK"

This commit is contained in:
Zuul 2021-11-30 19:07:58 +00:00 committed by Gerrit Code Review
commit e02fd2ab18
3 changed files with 19 additions and 14 deletions

View File

@ -4099,13 +4099,13 @@ class ResumeServer(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_id = compute_client.find_server(
server,
).resume()
ignore_missing=False,
).id
compute_client.resume_server(server_id)
class SetServer(command.Command):
@ -4670,13 +4670,13 @@ class SuspendServer(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_id = compute_client.find_server(
server,
).suspend()
ignore_missing=False,
).id
compute_client.suspend_server(server_id)
class UnlockServer(command.Command):

View File

@ -7617,10 +7617,10 @@ class TestServerResume(TestServer):
}
def test_server_resume_one_server(self):
self.run_method_with_servers('resume', 1)
self.run_method_with_sdk_servers('resume_server', 1)
def test_server_resume_multi_servers(self):
self.run_method_with_servers('resume', 3)
self.run_method_with_sdk_servers('resume_server', 3)
class TestServerSet(TestServer):
@ -8284,10 +8284,10 @@ class TestServerSuspend(TestServer):
}
def test_server_suspend_one_server(self):
self.run_method_with_servers('suspend', 1)
self.run_method_with_sdk_servers('suspend_server', 1)
def test_server_suspend_multi_servers(self):
self.run_method_with_servers('suspend', 3)
self.run_method_with_sdk_servers('suspend_server', 3)
class TestServerUnlock(TestServer):

View File

@ -0,0 +1,5 @@
---
features:
- |
Migrate ``server suspend`` and ``server resume`` commands from novaclient
to sdk.