Bug 2233560

Summary: [hackfest] UserWarning: You have a configured API_VERSION with 'latest' in it. In the context of openstacksdk this doesn't make any sense
Product: Red Hat OpenStack Reporter: Alexon Oliveira <alolivei>
Component: openstack-tripleo-commonAssignee: Nobody <nobody>
Status: CLOSED ERRATA QA Contact: David Rosenfeld <drosenfe>
Severity: low Docs Contact:
Priority: low    
Version: 17.1 (Wallaby)CC: alifshit, apevec, ggrimaux, gregraka, igallagh, jamsmith, jbeaudoi, jpichon, lhh, mburns, nobody, slinaber, smooney
Target Milestone: z2Keywords: Triaged
Target Release: 17.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openstack-tripleo-common-15.4.1-17.1.20230927010818.e5b18f2.el9ost Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-01-16 14:32:56 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Alexon Oliveira 2023-08-22 15:10:20 UTC
Description of problem:

After a fresh RHOSP 17.0 or 17.1 install, anytime the command "openstack flavor list" is run, it triggers the following error message:

(overcloud) [stack@undercloud ~]$ openstack flavor list
/usr/lib/python3.9/site-packages/openstack/config/cloud_region.py:452: UserWarning: You have a configured API_VERSION with 'latest' in it. In the context of openstacksdk this doesn't make any sense.
  warnings.warn(

Version-Release number of selected component (if applicable):

17.0
17.1
python3-openstackclient-5.5.2-1.20230404121004.42d9b6e.el9ost.noarch

How reproducible:

Always

Steps to Reproduce:
1. Do a fresh RHOSP 17.0/17.1 standard install with no API customization whatsoever.
2. Run "source ~/overcloudrc"
3. Run "openstack flavor list".
4. Check the warning output.

Actual results:

Getting a warning message about using the latest API version after running a basic command. It only goes away by specifying the "--os-compute-api-version" or changing the overcloudrc file (the export OS_COMPUTE_API_VERSION=2.latest line)

Expected results:

It shouldn't be warning anything after a fresh standard install. If the overcloudrc should be tweaked after a fresh install, that should be advised in the documentation, which is not.

Additional info:

Check the default overcloudrc file:

(overcloud) [stack@undercloud ~]$ cat ~/overcloudrc 
# Clear any old environment that may conflict.
for key in $( set | awk '{FS="="}  /^OS_/ {print $1}' ); do unset $key ; done
export OS_USERNAME=admin
export OS_PROJECT_NAME=admin
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_DOMAIN_NAME=Default
export OS_NO_CACHE=True
export OS_CLOUD=overcloud
export no_proxy=,10.0.0.230,192.0.2.18
export PYTHONWARNINGS='ignore:Certificate has no, ignore:A true SSLContext object is not available'
export OS_AUTH_TYPE=password
export OS_PASSWORD=zqCJanWlH2sMwT7VwWwaLJ4ay
export OS_AUTH_URL=http://10.0.0.230:5000
export OS_IDENTITY_API_VERSION=3
export OS_COMPUTE_API_VERSION=2.latest
export OS_IMAGE_API_VERSION=2
export OS_VOLUME_API_VERSION=3
export OS_REGION_NAME=regionOne

# Add OS_CLOUD to PS1
if [ -z "${CLOUDPROMPT_ENABLED:-}" ]; then
    export PS1=${PS1:-""}
    export PS1=\${OS_CLOUD:+"(\$OS_CLOUD)"}\ $PS1
    export CLOUDPROMPT_ENABLED=1
fi

Comment 1 Alexon Oliveira 2023-08-22 15:25:26 UTC
BTW, manually changing OS_COMPUTE_API_VERSION value in the overcloudrc file from 2.latest to 2.1 solves the issue, but that shouldn't be happening in the first place:

(overcloud) [stack@undercloud ~]$ openstack endpoint list | grep nova
| 555f388113394b278f2366699d09e1f3 | regionOne | nova         | compute        | True    | internal  | http://172.16.2.230:8774/v2.1                 |
| 767290a7278343e2ba010ff2f637a9bf | regionOne | nova         | compute        | True    | public    | http://10.0.0.230:8774/v2.1                   |
| 77d2f56911f646adbbc62d7fab1211b7 | regionOne | nova         | compute        | True    | admin     | http://172.16.2.230:8774/v2.1

(overcloud) [stack@undercloud ~]$ cat overcloudrc 
# Clear any old environment that may conflict.
for key in $( set | awk '{FS="="}  /^OS_/ {print $1}' ); do unset $key ; done
export OS_USERNAME=admin
export OS_PROJECT_NAME=admin
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_DOMAIN_NAME=Default
export OS_NO_CACHE=True
export OS_CLOUD=overcloud
export no_proxy=,10.0.0.230,192.0.2.18
export PYTHONWARNINGS='ignore:Certificate has no, ignore:A true SSLContext object is not available'
export OS_AUTH_TYPE=password
export OS_PASSWORD=zqCJanWlH2sMwT7VwWwaLJ4ay
export OS_AUTH_URL=http://10.0.0.230:5000
export OS_IDENTITY_API_VERSION=3
export OS_COMPUTE_API_VERSION=2.1                 <--- Changed here from 2.latest to 2.1
export OS_IMAGE_API_VERSION=2
export OS_VOLUME_API_VERSION=3
export OS_REGION_NAME=regionOne

# Add OS_CLOUD to PS1
if [ -z "${CLOUDPROMPT_ENABLED:-}" ]; then
    export PS1=${PS1:-""}
    export PS1=\${OS_CLOUD:+"(\$OS_CLOUD)"}\ $PS1
    export CLOUDPROMPT_ENABLED=1
fi

(overcloud) [stack@undercloud ~]$ openstack flavor list
+--------------------------------------+------+-----+------+-----------+-------+-----------+
| ID                                   | Name | RAM | Disk | Ephemeral | VCPUs | Is Public |
+--------------------------------------+------+-----+------+-----------+-------+-----------+
| 4c1db5f3-fb29-4f6c-8ff1-914c6abebc99 | tiny | 512 |    1 |         0 |     1 | True      |
+--------------------------------------+------+-----+------+-----------+-------+-----------+

Comment 2 Alexon Oliveira 2023-08-22 16:45:55 UTC
FYI,

I've submitted a patch in the upstream to fix it:

https://review.opendev.org/c/openstack/tripleo-common/+/892379

Waiting for review.

Comment 3 smooney 2023-08-23 15:14:31 UTC
export OS_COMPUTE_API_VERSION=2.latest is not a real micorvsion and comptue does not recommend defaultign to latest in general.

Comment 4 Alexon Oliveira 2023-08-23 16:00:16 UTC
(In reply to smooney from comment #3)
> export OS_COMPUTE_API_VERSION=2.latest is not a real micorvsion and comptue
> does not recommend defaultign to latest in general.

Exactly, but that was hardcoded in upstream, so I've submitted a patch to correct it, setting up '2.1' instead of the '2.latest:

https://review.opendev.org/c/openstack/tripleo-common/+/892548

Waiting for Zuul's checking.

PS. From what I could see in the repo logs, this was the justification for implementing that (but this is clearly creating a bug):

$ cat releasenotes/notes/export_os_nova_api_version-d5d1501306f8013b.yaml
---
fixes:
  - |
    openstack cli doesn't negotiate a microversion. Live migration and
    multiattach are 2 examples of operations which require arcane incantations
    to make them work correctly, and therefore usually don't.
    This adds ``OS_COMPUTE_API_VERSION=2.latest`` to the overcloudrc file to
    fix it.

$ git log | grep f3e3208fb784ec1d726b3a7252ec8825d64d7103 -A14

commit f3e3208fb784ec1d726b3a7252ec8825d64d7103
Author: Martin Schuppert <mschuppert>
Date:   Mon Oct 7 11:07:51 2019 +0200

    Add OS_COMPUTE_API_VERSION to overcloudrc
    
    openstack cli doesn't negotiate a microversion. Live migration and
    multiattach are 2 examples of operations which require arcane
    incantations
    to make them work correctly, and therefore usually don't.
    This adds ``OS_COMPUTE_API_VERSION=2.latest`` to the overcloudrc
    file to fix it.
    
    Change-Id: I6bb4ef5d3d0e53b12f8636b998d7f7c2426c2b60

Comment 5 Artom Lifshitz 2023-08-23 16:34:04 UTC
With the patch proposed upstream and +1'ed by Compute (Sean specifically), I'd like to move this back to DF. I don't believe there's further action for Compute to take, since this is fairly minor and we will not be QE'ing this or writing docs for it.

Comment 6 Takashi Kajinami 2023-08-23 16:45:07 UTC
I don't think this is really owned by DF.
DF does not own how individual services are deployed, and the problem is
the specific configuration for nova client.

DF can help reviewing the patch (and QEing it if David has remaining bw)
but the required change should be maintained by Compute again the piece
is tightly related to the compute commands in openstackclient.

Comment 7 Alexon Oliveira 2023-08-28 18:42:45 UTC
Wil(In reply to Takashi Kajinami from comment #6)
> I don't think this is really owned by DF.
> DF does not own how individual services are deployed, and the problem is
> the specific configuration for nova client.
> 
> DF can help reviewing the patch (and QEing it if David has remaining bw)
> but the required change should be maintained by Compute again the piece
> is tightly related to the compute commands in openstackclient.

Will we it backport this to Wallaby in downstream too?

Comment 8 Takashi Kajinami 2023-09-04 02:51:39 UTC
I don't understand why this is closed before the actual fix was merged.
Anyway I added +A to the patch so it would be imported to future RHOSP17.1 as long as it is merged later.

Note that this task is currently assigned to Compute team (I'm from DF) so in case you need further question
then please reach out to the person in Compute (like Artom or Sean).
We, DF, are not the main owner but are kind of secondary who help reviewing/merging the tripleo patches.

Comment 9 Alexon Oliveira 2023-09-04 16:15:13 UTC
(In reply to Takashi Kajinami from comment #8)
> I don't understand why this is closed before the actual fix was merged.

Artom,

Could you reply to this one, please?

> Anyway I added +A to the patch so it would be imported to future RHOSP17.1
> as long as it is merged later.
> 

Cool.

> Note that this task is currently assigned to Compute team (I'm from DF) so
> in case you need further question
> then please reach out to the person in Compute (like Artom or Sean).
> We, DF, are not the main owner but are kind of secondary who help
> reviewing/merging the tripleo patches.

Takashi,

Thank you for help, reviewing and replying.

Comment 10 Alexon Oliveira 2023-09-04 18:50:37 UTC
Also patched in downstream via cherry-pick:

https://code.engineering.redhat.com/gerrit/c/openstack-tripleo-common/+/446494

Comment 12 Artom Lifshitz 2023-09-05 01:35:38 UTC
(In reply to Alexon Oliveira from comment #9)
> (In reply to Takashi Kajinami from comment #8)
> > I don't understand why this is closed before the actual fix was merged.
> 
> Artom,
> 
> Could you reply to this one, please?

As I've said previously, DFG:Compute will neither QE this, nor write docs for it (and this has nothing to do with which DFG owns the patch - the patch is just too minor). With the upstream patch merged (and expected to make it into downstream 17.1 in the near future via an import), our work is done, and I feel safe in closing this as UPSTREAM.

> 
> > Anyway I added +A to the patch so it would be imported to future RHOSP17.1
> > as long as it is merged later.
> > 
> 
> Cool.
> 
> > Note that this task is currently assigned to Compute team (I'm from DF) so
> > in case you need further question
> > then please reach out to the person in Compute (like Artom or Sean).
> > We, DF, are not the main owner but are kind of secondary who help
> > reviewing/merging the tripleo patches.
> 
> Takashi,
> 
> Thank you for help, reviewing and replying.

Comment 28 Artom Lifshitz 2023-12-04 16:43:50 UTC
*** Bug 2252389 has been marked as a duplicate of this bug. ***

Comment 35 errata-xmlrpc 2024-01-16 14:32:56 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: Red Hat OpenStack Platform 17.1 (openstack-tripleo-common) security update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2024:0216