compute: don't pass networks: auto for older microversions

Change I1a6ba311ddedc1b8910051257299d3acd367df46 made this
unconditionally specify "networks: auto" when no network info was
specified.  From the nova release notes

 "Starting with microversion 2.37, this field is required and the
 special string values auto and none can be specified for
 networks. auto tells the Compute service to use a network that is
 available to the project, if one exists."

So we should restrict where this is specified.

This was noticed when trying to use openstacksdk >=0.99 against the
Rackspace API.  I have run this change against that API and verified
it is not passing the argument.

Change-Id: Ifc5bd0ddc92bbbc7b250df3f3931518f62cc339f
This commit is contained in:
Ian Wienand 2022-11-23 11:43:06 +11:00
parent 03b2493cd0
commit 2baee35a5b
No known key found for this signature in database
1 changed files with 4 additions and 2 deletions

View File

@ -889,8 +889,10 @@ class ComputeCloudMixin:
if networks:
kwargs['networks'] = networks
else:
# If user has not passed networks - let Nova try the best.
kwargs['networks'] = 'auto'
# If user has not passed networks - let Nova try the best;
# note earlier microversions expect this to be blank.
if utils.supports_microversion(self.compute, '2.37'):
kwargs['networks'] = 'auto'
if image:
if isinstance(image, dict):