Bug 1040704

Summary: Upgrade of openstack-quantum to openstack-neutron hangs
Product: [Fedora] Fedora EPEL Reporter: Joseph W. Breu <joseph.breu>
Component: openstack-neutronAssignee: Terry Wilson <twilson>
Status: CLOSED CURRENTRELEASE QA Contact: Roey Dekel <rdekel>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: el6CC: breu, chrisw, lars, lpeer, oblaut, rdekel, twilson, yeylon
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: openstack-neutron-2013.2-13.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1042987 (view as bug list) Environment:
Last Closed: 2014-04-07 17:30:29 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:
Attachments:
Description Flags
Fixes %pretrans scriptlet in openstack-neutron.spec none

Description Joseph W. Breu 2013-12-11 23:09:44 UTC
The %pretrans statement in the openstack-neutron package generates a shell script called UPGRADE_FROM_QUANTUM that incorrectly parses the output of chkconfig to generate a list of services to enable.  This does not correctly take into account services that are turned off for all runlevels and generates a script that incorrectly calls the services themselves - some of which do not background and do not terminate.

cat /var/lib/rpm-state/UPGRADE_FROM_QUANTUM
chkconfig --levels 2345 neutron-openvswitch-agent on
neutron-server

In this case, neutron-server was set to off on all three run levels however the script itself calls neutron-server which does not background nor terminate and thus the rpm package installation does not return control to the console.

The culprit code is:

%pretrans
if rpm --quiet -q openstack-quantum; then
    mkdir -p  %{_localstatedir}/lib/rpm-state/

    # Create a script for restoring init script enabling that we can also
    # use as a flag to detect quantum -> grizzly upgrades in %posttrans
    chkconfig --type sysv --list|grep ^quantum| \
      sed -re 's/[0-6]:off//g
               s/([0-6]):on\s*/\1/g
               s/quantum/neutron/g
               s/^([a-z0-9-]+)\s+([0-6]+)/chkconfig --levels \2 \1 on/' > %{_localstatedir}/lib/rpm-state/UPGRADE_FROM_QUANTUM
fi


This should actually read:

%pretrans
if rpm --quiet -q openstack-quantum; then
    mkdir -p  %{_localstatedir}/lib/rpm-state/

    # Create a script for restoring init script enabling that we can also
    # use as a flag to detect quantum -> grizzly upgrades in %posttrans
    chkconfig --type sysv --list|grep ^quantum| \
      sed -re 's/[0-6]:off//g
               s/([0-6]):on\s*/\1/g
               s/quantum/neutron/g
               s/^([a-z0-9-]+)\s+$/chkconfig \1 off/
               s/^([a-z0-9-]+)\s+([0-6]+)/chkconfig --levels \2 \1 on/' > %{_localstatedir}/lib/rpm-state/UPGRADE_FROM_QUANTUM
fi


This will generate a script for the upgrade that reads:

chkconfig --levels 2345 neutron-openvswitch-agent on
chkconfig neutron-server off

Comment 1 Joseph W. Breu 2013-12-11 23:10:10 UTC
If this isn't the correct place to report this bug let me know.

Comment 3 Joseph W. Breu 2013-12-12 22:50:06 UTC
Is there an ETA on the fix for this?  This is a blocker for us as we can't upgrade quantum to neutron without the rpm transaction blowing up

Comment 4 Joseph W. Breu 2013-12-13 14:47:58 UTC
Moving to Fedora EPEL per my email with Perry

Comment 5 Lars Kellogg-Stedman 2013-12-18 16:27:29 UTC
That sed expression needs to add a '_' to avoid breaking with service names that contain an underscore.  So:

      sed -re 's/[0-6]:off//g
               s/([0-6]):on\s*/\1/g
               s/quantum/neutron/g
               s/^([a-z0-9_-]+)\s+$/chkconfig \1 off/
               s/^([a-z0-9_-]+)\s+([0-6]+)/chkconfig --levels \2 \1 on/'

Comment 6 Lars Kellogg-Stedman 2013-12-18 16:31:46 UTC
Created attachment 838428 [details]
Fixes %pretrans scriptlet in openstack-neutron.spec

The attached patch (against branch rhos-4.0-rhel-6) corrects the %pretrans scriptlet.

Comment 7 Lars Kellogg-Stedman 2013-12-18 16:45:20 UTC
Confiramation:

With services configured like this:

# chkconfig --list | grep quantum
quantum-dhcp-agent	0:off	1:off	2:on	3:on	4:on	5:on	6:off
quantum-l3-agent	0:off	1:off	2:on	3:on	4:on	5:on	6:off
quantum-metadata-agent	0:off	1:off	2:on	3:on	4:on	5:on	6:off
quantum-openvswitch-agent	0:off	1:off	2:off	3:off	4:off	5:off	6:off
quantum-server 	0:off	1:off	2:on	3:on	4:on	5:on	6:off

The existing scriptlet results in this output in UPGRADE_FROM_QUANTUM:

chkconfig --levels 2345 neutron-dhcp-agent on
chkconfig --levels 2345 neutron-l3-agent on
chkconfig --levels 2345 neutron-metadata-agent on
neutron-openvswitch-agent							
chkconfig --levels 2345 neutron-server on

Whereas the patched scriptlet results in:

chkconfig --levels 2345 neutron-dhcp-agent on
chkconfig --levels 2345 neutron-l3-agent on
chkconfig --levels 2345 neutron-metadata-agent on
chkconfig neutron-openvswitch-agent off
chkconfig --levels 2345 neutron-server on

Comment 8 Lars Kellogg-Stedman 2013-12-18 17:37:28 UTC
Hah, didn't see that it had been fixed. Never mind...