summaryrefslogtreecommitdiff
path: root/novaclient/v2
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2022-08-02 15:47:54 +0000
committerGerrit Code Review <review@openstack.org>2022-08-02 15:47:54 +0000
commit89a76edc8d68212d65b6189669f9a7207f09655d (patch)
treee0be45f4260973f07d7339ac64ab9a07875bc8d5 /novaclient/v2
parent4d4cdb49922b5e27ab1f892a5a5f7ac5994eedf1 (diff)
parentee9b277c5f442f299b853118c900c3ee2996c67a (diff)
downloadpython-novaclient-89a76edc8d68212d65b6189669f9a7207f09655d.tar.gz
Merge "Microversion 2.91: Support specifying destination host to unshelve"
Diffstat (limited to 'novaclient/v2')
-rw-r--r--novaclient/v2/servers.py65
1 files changed, 63 insertions, 2 deletions
diff --git a/novaclient/v2/servers.py b/novaclient/v2/servers.py
index 76709ec5..8a9301f6 100644
--- a/novaclient/v2/servers.py
+++ b/novaclient/v2/servers.py
@@ -314,7 +314,7 @@ class Server(base.Resource):
"""
return self.manager.unshelve(self)
- @api_versions.wraps("2.77")
+ @api_versions.wraps("2.77", "2.90")
def unshelve(self, availability_zone=None):
"""
Unshelve -- Unshelve the server.
@@ -326,6 +326,37 @@ class Server(base.Resource):
return self.manager.unshelve(self,
availability_zone=availability_zone)
+ @api_versions.wraps("2.91")
+ def unshelve(self, availability_zone=object(), host=None):
+ """
+ Unshelve -- Unshelve the server.
+
+ :param availability_zone: If specified the instance will be unshelved
+ to the availability_zone.
+ If None is passed the instance defined
+ availability_zone is unpin and the instance
+ will be scheduled to any availability_zone
+ (free scheduling).
+ If not specified the instance will be
+ unshelved to either its defined
+ availability_zone or any
+ availability_zone (free scheduling).
+ :param host: The specified host
+ (Optional)
+ :returns: An instance of novaclient.base.TupleWithMeta
+ """
+ if (
+ availability_zone is None or isinstance(availability_zone, str)
+ ) and host:
+ return self.manager.unshelve(
+ self, availability_zone=availability_zone, host=host)
+ if availability_zone is None or isinstance(availability_zone, str):
+ return self.manager.unshelve(
+ self, availability_zone=availability_zone)
+ if host:
+ return self.manager.unshelve(self, host=host)
+ return self.manager.unshelve(self)
+
def diagnostics(self):
"""Diagnostics -- Retrieve server diagnostics."""
return self.manager.diagnostics(self)
@@ -1266,7 +1297,7 @@ class ServerManager(base.BootingManagerWithFind):
"""
return self._action('unshelve', server, None)
- @api_versions.wraps("2.77")
+ @api_versions.wraps("2.77", "2.90")
def unshelve(self, server, availability_zone=None):
"""
Unshelve the server.
@@ -1281,6 +1312,36 @@ class ServerManager(base.BootingManagerWithFind):
info = {'availability_zone': availability_zone}
return self._action('unshelve', server, info)
+ @api_versions.wraps("2.91")
+ def unshelve(self, server, availability_zone=object(), host=None):
+ """
+ Unshelve the server.
+
+ :param availability_zone: If specified the instance will be unshelved
+ to the availability_zone.
+ If None is passed the instance defined
+ availability_zone is unpin and the instance
+ will be scheduled to any availability_zone
+ (free scheduling).
+ If not specified the instance will be
+ unshelved to either its defined
+ availability_zone or any
+ availability_zone (free scheduling).
+ :param host: The specified host
+ (Optional)
+ :returns: An instance of novaclient.base.TupleWithMeta
+ """
+ info = None
+
+ if availability_zone is None or isinstance(availability_zone, str):
+ info = {'availability_zone': availability_zone}
+ if host:
+ if info:
+ info['host'] = host
+ else:
+ info = {'host': host}
+ return self._action('unshelve', server, info)
+
def ips(self, server):
"""
Return IP Addresses associated with the server.