+++ 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:
1.
2.
3.
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:
/usr/share/rhosp-director-images/ironic-python-agent-latest-10.0.tar
* Latest 10 release image
Points to:
/usr/share/rhosp-director-images/ironic-python-agent-12.0-20171102.3.el7ost.tar
** latest 12 release image
I would agree in case the *latest* symlink did not include version number
Raviv
--- 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=${version%.*}
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
version=%{version}
Then things work correctly.
This needs to be done on every OSP version starting with OSP 8.
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
%post
nvr=0
nv=0
+version=%{version}
ver_major=${version%.*}
for ver in %{app_root}/version-*txt; do
ver=$(basename $(echo $ver | sed 's/\.txt//'))
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