Merge "compute: Add support for targeting host during migrate"
This commit is contained in:
commit
d82d577513
@ -2095,15 +2095,16 @@ class Proxy(proxy.Proxy):
|
||||
|
||||
# ========== Server Migrations ==========
|
||||
|
||||
def migrate_server(self, server):
|
||||
def migrate_server(self, server, *, host=None):
|
||||
"""Migrate a server from one host to another
|
||||
|
||||
:param server: Either the ID of a server or a
|
||||
:class:`~openstack.compute.v2.server.Server` instance.
|
||||
:param str host: The host to which to migrate the server.
|
||||
:returns: None
|
||||
"""
|
||||
server = self._get_resource(_server.Server, server)
|
||||
server.migrate(self)
|
||||
server.migrate(self, host=host)
|
||||
|
||||
def live_migrate_server(
|
||||
self,
|
||||
|
@ -841,13 +841,22 @@ class Server(resource.Resource, metadata.MetadataMixin, tag.TagMixin):
|
||||
body = {'unshelve': data or None}
|
||||
self._action(session, body)
|
||||
|
||||
def migrate(self, session):
|
||||
def migrate(self, session, *, host=None):
|
||||
"""Migrate the server.
|
||||
|
||||
:param session: The session to use for making this request.
|
||||
:param host: The host to migrate the server to. (Optional)
|
||||
:returns: None
|
||||
"""
|
||||
body = {"migrate": None}
|
||||
if host and not utils.supports_microversion(session, '2.56'):
|
||||
raise ValueError(
|
||||
"The 'host' option is only supported on microversion 2.56 or "
|
||||
"greater."
|
||||
)
|
||||
|
||||
body: ty.Dict[str, ty.Any] = {"migrate": None}
|
||||
if host:
|
||||
body["migrate"] = {"host": host}
|
||||
self._action(session, body)
|
||||
|
||||
def trigger_crash_dump(self, session):
|
||||
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
The ``migrate_server`` compute proxy API and the ``Server.migrate`` API now
|
||||
accept a ``host`` parameter to migrate to a given host.
|
Loading…
Reference in New Issue
Block a user