[osci] New OpenStack packages version is lower then previous

Bug #1342716 reported by Dmitry Ilyin on 2014-07-16
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fuel for OpenStack
Critical
Dmitry Burmistrov
5.0.x
Critical
Dmitry Burmistrov

Bug Description

Related bug: 1342041

Our new openstack packages have versions like 2014.1.1.fuel5.1-mira0 and previous release packages have versions like 2014.1.fuel5.0-mira4

Even if the new package version look higher then previous it's not and it creates several problems with updates.

Puppet's yum modules users versioncmp fuction to compare old and new version when it tries to update a package. It works like this:

["2014", ".", "1", ".", "fuel", "5", ".", "0", "-", "mira", "4"]
["2014", ".", "1", ".", "1", ".", "fuel", "5", ".", "1", "-", "mira", "0"]
2014 vs 2014
. vs .
1 vs 1
. vs .
fuel vs 1
1

First, it splits veriosn to componets and then compares each pair. It have returned 1 and it mean that first is newer then second. As you can see it's a second "1" to blame because it moves "fuel" to the next pair. The correct comparsion should look like this:

["2014", ".", "1", ".", "fuel", "5", ".", "0", "-", "mira", "4"]
["2014", ".", "1", ".", "fuel", "5", ".", "1", "-", "mira", "0"]
2014 vs 2014
. vs .
1 vs 1
. vs .
fuel vs fuel
5 vs 5
. vs .
0 vs 1
-1

But we cannot just rename the package because 2014.1.1 is the version of the OpenStack release.

There is a quick fix for yum provider: https://review.openstack.org/#/c/106997/

Same problem can be seen on the Ubuntu nodes. Apt refuses to update to update packages to the "new" version because it's "older". Trying to "downgrade" to the "new" package olso doesn't work because all dependencies expect to have package that have version >= then required and older doesn't work.

Obviously, we cant fix the apt problem the same way as yum can be fixed and we need some way to make new version be actually newer. The problem is also being made harder by the fact that previously released 5.0 packages cannot be renamed now.

* We can increase epoch for the new packages to force them be newer then all packages previously released.
* We can also make versioning like this: fuel5.1-2014.1.1-mira0 it should handle new releases.
* Why do we even add fuel release to packages. With updates we are implementing already wery thin connection between Fuel and OpenStack release is blurred even farther. Lets name then just like: 2014.1.1-mira0

Dmitry Ilyin (idv1985) on 2014-07-16
Changed in fuel:
milestone: none → 5.1
assignee: nobody → Fuel OSCI Team (fuel-osci)
importance: Undecided → High
status: New → Confirmed
Dmitry Ilyin (idv1985) on 2014-07-16
description: updated
Dmitry Ilyin (idv1985) on 2014-07-16
description: updated
Dmitry Ilyin (idv1985) on 2014-07-16
description: updated
Dmitry Ilyin (idv1985) wrote :

As for me, the best solution would be not to include fuel version at all and increase epoch to migrate from the old naming to the new one.

summary: - New OpenStack packages version is lower then previous
+ [osci] New OpenStack packages version is lower then previous
Changed in fuel:
importance: High → Critical
Dmitry Ilyin (idv1985) wrote :

How to check versions:

UBUNTU:

dpkg --compare-versions "${a}" "lt" "${b}"

if [ $? -eq "0" ]; then
  echo "${a} < ${b}"
else
  echo "${a} >= ${b}"
fi

CENTOS:

yum install rpmdevtools

rpmdev-vercmp $a $b

PUPPET:

  def versioncmp(version_a, version_b)
    vre = /[-.]|\d+|[^-.\d]+/
    ax = version_a.scan(vre)
    bx = version_b.scan(vre)

    puts ax.inspect
    puts bx.inspect

    while (ax.length>0 && bx.length>0)
      a = ax.shift
      b = bx.shift

      puts "#{a} vs #{b}"

      if( a == b ) then next
      elsif (a == '-' && b == '-') then next
      elsif (a == '-') then return -1
      elsif (b == '-') then return 1
      elsif (a == '.' && b == '.') then next
      elsif (a == '.' ) then return -1
      elsif (b == '.' ) then return 1
      elsif (a =~ /^\d+$/ && b =~ /^\d+$/) then
        if( a =~ /^0/ or b =~ /^0/ ) then
          return a.to_s.upcase <=> b.to_s.upcase
        end
        return a.to_i <=> b.to_i
      else
        return a.upcase <=> b.upcase
      end
    end
    version_a <=> version_b;
  end

 puts versioncmp('2014.1.fuel5.0-mira4', '2014.1.1.fuel5.1-mira0')

Roman Vyalov (r0mikiam) on 2014-07-17
Changed in fuel:
assignee: Fuel OSCI Team (fuel-osci) → Dmitry Burmistrov (dburmistrov)
Dmitry Ilyin (idv1985) wrote :

Another solution would be to use naming convention:

XXXX.X.X.fuelX.X.X-miraX

2014.1.0.fuel5.0.0-mira4
2014.1.1.fuel5.1.0-mira0

And use epoch increase one time to move from the old naming convention to the new one

Dmitry Ilyin (idv1985) wrote :

CENTOS: GOOD

rpmdev-vercmp '2014.1.fuel5.0-mira4' '2014.1.1.fuel5.1-mira0'
2014.1.fuel5.0-mira4 < 2014.1.1.fuel5.1-mira0

UBUNTU: BAD

sh -x compare.sh '2014.1.fuel5.0-mira4' '2014.1.1.fuel5.1-mira0'
+ a=2014.1.fuel5.0-mira4
+ b=2014.1.1.fuel5.1-mira0
+ dpkg --compare-versions 2014.1.fuel5.0-mira4 lt 2014.1.1.fuel5.1-mira0
+ [ 1 -eq 0 ]
+ echo 2014.1.fuel5.0-mira4 >= 2014.1.1.fuel5.1-mira0
2014.1.fuel5.0-mira4 >= 2014.1.1.fuel5.1-mira0

PUPPET: BAD

["2014", ".", "1", ".", "fuel", "5", ".", "0", "-", "mira", "4"]
["2014", ".", "1", ".", "1", ".", "fuel", "5", ".", "1", "-", "mira", "0"]
2014 vs 2014
. vs .
1 vs 1
. vs .
fuel vs 1
2014.1.fuel5.0-mira4 > 2014.1.1.fuel5.1-mira0

So, rpm does support our current naimg convention but deb and puppet does not. Bogdan fixed puppet's comparsion and CentOS updates are working. But Ubuntu has no fix yet.

Dmitry Ilyin (idv1985) wrote :

This could help:
sh -x compare.sh '2014.1.fuel5.0-mira4' '2014.1.r1.fuel5.1-mira0'
+ a=2014.1.fuel5.0-mira4
+ b=2014.1.r1.fuel5.1-mira0
+ dpkg --compare-versions 2014.1.fuel5.0-mira4 lt 2014.1.r1.fuel5.1-mira0
+ [ 0 -eq 0 ]
+ echo 2014.1.fuel5.0-mira4 < 2014.1.r1.fuel5.1-mira0
2014.1.fuel5.0-mira4 < 2014.1.r1.fuel5.1-mira0

Dmitry Ilyin (idv1985) wrote :

It works for puppet too:

["2014", ".", "1", ".", "fuel", "5", ".", "0", "-", "mira", "4"]
["2014", ".", "1", ".", "r", "1", ".", "fuel", "5", ".", "1", "-", "mira", "0"]
2014 vs 2014
. vs .
1 vs 1
. vs .
fuel vs r
2014.1.fuel5.0-mira4 < 2014.1.r1.fuel5.1-mira0

tags: added: patching
tags: added: upgrade
Dmitry Burmistrov (dburmistrov) wrote :

Changing debian packages version to 2014.1.rX-fuelY.Z~miraN

Andrew Woodward (xarses) wrote :

Moving back to 5.0.1 and up to critical, Having different mechanisms between un-released versions quite dangerous, We should include this with all un-released versions. I could see the possibility for rollbacks to be a problem as well if we don't include it.

Dmitry Burmistrov (dburmistrov) wrote :

Version was changed to 2014.1.rX both for 5.0.x and 5.1.x

Dmitry Pyzhov (dpyzhov) on 2014-08-14
no longer affects: fuel/5.1.x
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers