summaryrefslogtreecommitdiff
path: root/novaclient/v2/servers.py
diff options
context:
space:
mode:
Diffstat (limited to 'novaclient/v2/servers.py')
-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.