openstack-upgrade action doesn't properly detect swift package upgrade

Bug #1817384 reported by Drew Freiberger
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Swift Proxy Charm
Fix Released
High
James Page
OpenStack Swift Storage Charm
Fix Released
High
James Page

Bug Description

Running on a xenial-pike cloud, upgrading to xenial-queens (this cloud has seen trusty-mitaka, xenial-mitaka, xenial-newton, xenial-pike, and now going to queens in the process of upgrades)

Running cs:swift-proxy-75 and getting outcome: "no upgrade available"

It appears that apt_pkg.version_compare may have changed it's output in python-apt package 1.1.0~beta1ubuntu0.16.04.2 in xenial-updates/main

I added debugging and setting the following action_sets at the bottom of openstack_upgrade_available() in charmhelpers.contrib.openstack.utils:

    action_set({'swiftcur': cur_vers})
    action_set({'swiftavail': avail_vers})
    action_set({'aptcmp': apt.version_compare(avail_vers, cur_vers)})

You can see apt.version_compare is returning "7" instead of the expected == 1 from the return of this function: return apt.version_compare(avail_vers, cur_vers) == 1

$ juju run-action --wait swift-proxy/1 openstack-upgrade
unit-swift-proxy-1:
  id: 504a5617-6e09-481b-8e20-c1e21e9975a3
  results:
    aptcmp: "7"
    outcome: no upgrade available.
    swiftavail: 2.17.0
    swiftcur: 2.10.2
  status: completed
  timing:
    completed: 2019-02-23 00:57:05 +0000 UTC
    enqueued: 2019-02-23 00:57:00 +0000 UTC
    started: 2019-02-23 00:57:01 +0000 UTC
  unit: swift-proxy/1

Thinking this meant I had to step through from netwon to ocata, I changed to ocata cloud repo and get aptcmp == 3, because it's 2.10.2 to 2.13.0 as latest in ocata, though earliest in ocata was only 2.11.0.

Fix is to change openstack_upgrade_available() return comparison from == 1 to >= 1 in
/var/lib/juju/agents/unit-swift-proxy-*/charm/charmhelpers/contrib/openstack/utils.py
and
/var/lib/juju/agents/unit-swift-storage-*/charm/charmhelpers/contrib/openstack/utils.py

Revision history for this message
Drew Freiberger (afreiberger) wrote :

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=680891 appears to be the documentation culprit that may have lead to this code.

Revision history for this message
Drew Freiberger (afreiberger) wrote :

Filed this against charm-helpers:

https://github.com/juju/charm-helpers/issues/291

Revision history for this message
Drew Freiberger (afreiberger) wrote :
James Page (james-page)
Changed in charm-swift-proxy:
status: New → Triaged
Changed in charm-swift-storage:
status: New → Triaged
Changed in charm-swift-proxy:
importance: Undecided → High
Changed in charm-swift-storage:
importance: Undecided → High
Changed in charm-swift-proxy:
milestone: none → 19.04
Changed in charm-swift-storage:
milestone: none → 19.04
Changed in charm-swift-proxy:
assignee: nobody → James Page (james-page)
Changed in charm-swift-storage:
assignee: nobody → James Page (james-page)
status: Triaged → In Progress
Changed in charm-swift-proxy:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to charm-swift-proxy (master)

Fix proposed to branch: master
Review: https://review.openstack.org/640986

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to charm-swift-storage (master)

Fix proposed to branch: master
Review: https://review.openstack.org/640989

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to charm-swift-storage (master)

Reviewed: https://review.openstack.org/640989
Committed: https://git.openstack.org/cgit/openstack/charm-swift-storage/commit/?id=976391951e6a50011c6db34757b71282f13d502c
Submitter: Zuul
Branch: master

commit 976391951e6a50011c6db34757b71282f13d502c
Author: James Page <email address hidden>
Date: Tue Mar 5 11:48:16 2019 +0000

    upgrade: Fix pike to queens upgrade

    apt.version_compare changed behaviour to return >= 1 in the event
    that a newer package version is detected.

    Resync charmhelpers code to pickup fixes for openstack upgrade
    detection.

    Change-Id: Iacf8db9bbacca782646584a4982b265937b63b9e
    Closes-Bug: 1817384

Changed in charm-swift-storage:
status: In Progress → Fix Committed
Changed in charm-swift-proxy:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to charm-swift-proxy (master)

Reviewed: https://review.openstack.org/640986
Committed: https://git.openstack.org/cgit/openstack/charm-swift-proxy/commit/?id=525f755281b63ca32be05c957f5e2f660a5d2dd5
Submitter: Zuul
Branch: master

commit 525f755281b63ca32be05c957f5e2f660a5d2dd5
Author: James Page <email address hidden>
Date: Tue Mar 5 11:43:19 2019 +0000

    upgrade: Fix pike to queens upgrade

    apt.version_compare changed behaviour to return >= 1 in the event
    that a newer package version is detected.

    Resync charmhelpers code to pickup fixes for openstack upgrade
    detection.

    Change-Id: I567805dd595138acc6147edfda7fa364c8395f81
    Closes-Bug: 1817384

David Ames (thedac)
Changed in charm-swift-proxy:
status: Fix Committed → Fix Released
Changed in charm-swift-storage:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.