Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1514547 - installing older version images (yum localinstall) create wrong latest links in rhosp-director-images [openstack-8]
Summary: installing older version images (yum localinstall) create wrong latest links ...
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: rhosp-director-images
Version: 8.0 (Liberty)
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
: 8.0 (Liberty)
Assignee: Mike Burns
QA Contact: Omri Hochman
Depends On:
TreeView+ depends on / blocked
Reported: 2017-11-17 18:25 UTC by Mike Burns
Modified: 2019-01-21 20:03 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1509665
Last Closed: 2019-01-21 20:03:16 UTC
Target Upstream Version:

Attachments (Terms of Use)

Description Mike Burns 2017-11-17 18:25:18 UTC
+++ This bug was initially created as a clone of Bug #1509665 +++

Description of problem:
When installing older images form url, the latest link points to the already installed images (example ls -l console output):
[stack@undercloud-0 osp_images]$ ls -l /usr/share/rhosp-director-images/*latest*
lrwxrwxrwx. 1 root root 79 Nov  5 09:00 /usr/share/rhosp-director-images/ironic-python-agent-latest-10.0.tar -> /usr/share/rhosp-director-images/ironic-python-agent-12.0-20171102.3.el7ost.tar
lrwxrwxrwx. 1 root root 79 Nov  5 08:50 /usr/share/rhosp-director-images/ironic-python-agent-latest-12.0.tar -> /usr/share/rhosp-director-images/ironic-python-agent-12.0-20171102.3.el7ost.tar
lrwxrwxrwx. 1 root root 74 Nov  5 09:00 /usr/share/rhosp-director-images/overcloud-full-latest-10.0.tar -> /usr/share/rhosp-director-images/overcloud-full-12.0-20171102.3.el7ost.tar
lrwxrwxrwx. 1 root root 74 Nov  5 08:50 /usr/share/rhosp-director-images/overcloud-full-latest-12.0.tar -> /usr/share/rhosp-director-images/overcloud-full-12.0-20171102.3.el7ost.tar

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

How reproducible:
After having image package install on your system,
try to install images form different version 

Steps to Reproduce:

Actual results:
All *latest* links points to the newer version images

Expected results:
Each *latet* link points to it's own version 

Additional info:
This operation it needing in the "mixed version" scenarios where undercloud is N versions ahead of overcloud

--- Additional comment from Mike Burns on 2017-11-07 07:15:11 EST ---

This is exactly how it's supposed to work.  -latest is always supposed to point to the "newest" version on the system.  If an older version is desired, you must point to the version specific image file rather that the -latest symlink.

--- Additional comment from Raviv Bar-Tal on 2017-11-08 08:29:08 EST ---

I disagree, the latest link also include the version number,
In the case above the symlink:
* Latest 10 release image
Points to:
** latest 12 release image 

I would agree in case the *latest* symlink did not include version number


--- Additional comment from Mike Burns on 2017-11-17 12:34:33 EST ---

Reopening to investigate

--- Additional comment from Mike Burns on 2017-11-17 13:13:48 EST ---

Installing OSP 12 images, then OSP 10 images produces this:  

overcloud-full-latest-10.0.tar -> /usr/share/rhosp-director-images/overcloud-full-12.0-20171116.1.el7ost.tar
ironic-python-agent-latest-10.0.tar -> /usr/share/rhosp-director-images/ironic-python-agent-12.0-20171116.1.el7ost.tar

Installing in the opposite direction, 10 first, then 12:

ironic-python-agent-latest-10.0.tar -> /usr/share/rhosp-director-images/ironic-python-agent-10.0-20171108.1.el7ost.tar
overcloud-full-latest-10.0.tar -> /usr/share/rhosp-director-images/overcloud-full-10.0-20171108.1.el7ost.tar

So it's only the install of an older version that breaks this

--- Additional comment from Mike Burns on 2017-11-17 13:18:30 EST ---

I think I've found the culprit.  In the %post script:


ver_major is used to check whether a particular version.txt file is for the same major release as the rpm being installed.  In the spec file, ${version} is not defined, only %{version} is.  In spec, you also cannot do the %.* variable parsing, so the spec needs to add this in the %post script prior to the ver+major= line


Then things work correctly.

This needs to be done on every OSP version starting with OSP 8.

Comment 1 Mike Burns 2017-11-20 14:23:46 UTC
This is the specfile change:

diff --git a/rhosp-director-images.spec b/rhosp-director-images.spec
index ee5401a..5b37081 100644
--- a/rhosp-director-images.spec
+++ b/rhosp-director-images.spec
@@ -55,6 +55,7 @@ echo %{version},%{release} > %{buildroot}%{app_root}/version-%{version}-%{releas
 for ver in %{app_root}/version-*txt; do
     ver=$(basename $(echo $ver |  sed 's/\.txt//'))

Comment 2 Mike Burns 2017-11-20 16:08:13 UTC
Note for testing:

This only shows up when you install images from an older release *after* a newer release.

IOW, without the fix:

Install OSP 12 images, then OSP 10 images --> failure

Install OSP 10 images, then OSP 12 images --> works

Note You need to log in before you can comment on or make changes to this bug.