summaryrefslogtreecommitdiff
path: root/openstackclient/compute
diff options
context:
space:
mode:
authorStephen Finucane <sfinucan@redhat.com>2022-10-26 18:18:50 +0300
committerStephen Finucane <sfinucan@redhat.com>2022-11-08 11:28:31 +0000
commitffb69116b30cfbf7b981666528a3e417d502f93b (patch)
tree61995c59d43bc94f8ec471b7415cca60263c5f02 /openstackclient/compute
parented0d568b948a04e893270d297c538773d058b73e (diff)
downloadpython-openstackclient-ffb69116b30cfbf7b981666528a3e417d502f93b.tar.gz
compute: Add missing microversion check for networks
The 'auto' and 'none' network allocation policies are only supported on compute API microversion 2.37 or later. Enforce this in the code. Change-Id: I90f8fb1e61ead4bd406ea76bbeb731b913805b13 Signed-off-by: Stephen Finucane <sfinucan@redhat.com> Story: 2010385 Task: 46657
Diffstat (limited to 'openstackclient/compute')
-rw-r--r--openstackclient/compute/v2/server.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/openstackclient/compute/v2/server.py b/openstackclient/compute/v2/server.py
index 1d072463..609faf5a 100644
--- a/openstackclient/compute/v2/server.py
+++ b/openstackclient/compute/v2/server.py
@@ -1615,6 +1615,14 @@ class CreateServer(command.ShowOne):
)
raise exceptions.CommandError(msg)
+ if compute_client.api_version < api_versions.APIVersion('2.37'):
+ msg = _(
+ '--os-compute-api-version 2.37 or greater is '
+ 'required to support explicit auto-allocation of a '
+ 'network or to disable network allocation'
+ )
+ raise exceptions.CommandError(msg)
+
nics = nics[0]
else:
for nic in nics: