Support server unshelve to specific host

Closes-Bug: #2075972
Change-Id: I9b20bb8c32ed95bb4d3dad3f8f0e139380d45c27
This commit is contained in:
Balazs Gibizer 2024-08-05 12:10:13 +02:00
parent fc0d683a1c
commit 05c442ddf1
3 changed files with 24 additions and 2 deletions

View File

@ -1183,7 +1183,7 @@ class Proxy(proxy.Proxy):
server = self._get_resource(_server.Server, server)
server.shelve_offload(self)
def unshelve_server(self, server):
def unshelve_server(self, server, *, host=None):
"""Unshelves or restores a shelved server.
Policy defaults enable only users with administrative role or the
@ -1192,10 +1192,12 @@ class Proxy(proxy.Proxy):
:param server: Either the ID of a server or a
:class:`~openstack.compute.v2.server.Server` instance.
:param host: An optional parameter specifying the name the compute
host to unshelve to. (New in API version 2.91).
:returns: None
"""
server = self._get_resource(_server.Server, server)
server.unshelve(self)
server.unshelve(self, host=host)
def trigger_server_crash_dump(self, server):
"""Trigger a crash dump in a server.

View File

@ -1276,6 +1276,21 @@ class TestCompute(TestComputeProxy):
self.proxy.unshelve_server,
method_args=["value"],
expected_args=[self.proxy],
expected_kwargs={
"host": None,
},
)
def test_server_unshelve_with_options(self):
self._verify(
"openstack.compute.v2.server.Server.unshelve",
self.proxy.unshelve_server,
method_args=["value"],
method_kwargs={"host": "HOST2"},
expected_args=[self.proxy],
expected_kwargs={
"host": "HOST2",
},
)
def test_server_trigger_dump(self):

View File

@ -0,0 +1,5 @@
---
fixes:
- |
Fixed the issue that unshelving a server to a specific host was failed
due to unhandled host option.