summaryrefslogtreecommitdiff
path: root/novaclient/v2
diff options
context:
space:
mode:
authorSurya Seetharaman <suryaseetharaman.9@gmail.com>2019-05-17 14:04:17 +0200
committerMatt Riedemann <mriedem.os@gmail.com>2019-05-22 11:06:52 -0400
commitf78a4706d3522e64fd45daaf5e68c017c55c5240 (patch)
treea782cef9f235970eaf1ce69266e84e476494521c /novaclient/v2
parentf0388977c1cc557f4c7cb5bc73964ffdebe35016 (diff)
downloadpython-novaclient-f78a4706d3522e64fd45daaf5e68c017c55c5240.tar.gz
Allow passing negative values for the locked search_opt in cs.servers.list
This patch adds support for novaclient to pass the "locked" search_opts with a "False" value upto the server side. This is required for the OSC change[1] to support the "unlocked" filter parameter. [1] https://review.opendev.org/#/c/659124/ Related to blueprint add-locked-reason Change-Id: I0907f4ad2decb308c9db8b0cf9e7962bf1b517b5
Diffstat (limited to 'novaclient/v2')
-rw-r--r--novaclient/v2/servers.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/novaclient/v2/servers.py b/novaclient/v2/servers.py
index afbd5536..e5a33fb6 100644
--- a/novaclient/v2/servers.py
+++ b/novaclient/v2/servers.py
@@ -862,9 +862,14 @@ class ServerManager(base.BootingManagerWithFind):
search_opts = {}
qparams = {}
-
+ # In microversion 2.73 we added ``locked`` filtering option
+ # for listing server details.
+ if ('locked' in search_opts and
+ self.api_version < api_versions.APIVersion('2.73')):
+ raise exceptions.UnsupportedAttribute("locked", "2.73")
for opt, val in search_opts.items():
- if val:
+ # support locked=False from 2.73 microversion
+ if val or (opt == 'locked' and val is False):
if isinstance(val, six.text_type):
val = val.encode('utf-8')
qparams[opt] = val