PSARC/2015/233 OpenStack Common Package s11u2-sru
authorDrew Fisher <drew.fisher@oracle.com>
Wed, 27 May 2015 15:21:04 -0600
branchs11u2-sru
changeset 4380 2ac4d1fcad4a
parent 4361 17379d4babfa
child 4396 8a9e2a2ea8c6
PSARC/2015/233 OpenStack Common Package 20866995 glance.images table is corrupted/missing on upgrade from 69 to 71 20984895 Upgrade still fails when the mappings change section to 'None' 20984926 nova-upgrade has multiple deprecation mappings for DEFAULT.sql_connection 20990795 OpenStack upgrade methods should preserve some values from the previous release 20992699 Restore OpenStack upgrade services once upgrade bugs are fixed in s12/s11.3 21085479 An openstack-common package should be added to Userland 21150246 MySQL needs more time to come online
components/openstack/cinder/cinder.p5m
components/openstack/cinder/files/cinder-upgrade
components/openstack/cinder/files/cinder-upgrade.xml
components/openstack/common/Makefile
components/openstack/common/common.license
components/openstack/common/files/openstack_common.py
components/openstack/common/openstack-common.p5m
components/openstack/common/openstack.p5m
components/openstack/glance/files/glance-upgrade
components/openstack/glance/files/glance-upgrade.xml
components/openstack/glance/glance.p5m
components/openstack/heat/files/heat-upgrade
components/openstack/heat/files/heat-upgrade.xml
components/openstack/heat/heat.p5m
components/openstack/horizon/horizon.p5m
components/openstack/keystone/files/keystone-upgrade
components/openstack/keystone/files/keystone-upgrade.xml
components/openstack/keystone/keystone.p5m
components/openstack/neutron/files/evs/migrate/evs-neutron-migration.py
components/openstack/neutron/files/neutron-upgrade
components/openstack/neutron/files/neutron-upgrade.xml
components/openstack/neutron/neutron.p5m
components/openstack/nova/files/nova-upgrade
components/openstack/nova/files/nova-upgrade.xml
components/openstack/nova/nova.p5m
components/openstack/swift/files/swift-upgrade
components/openstack/swift/files/swift-upgrade.xml
components/openstack/swift/swift.p5m
--- a/components/openstack/cinder/cinder.p5m	Wed May 27 05:22:49 2015 -0700
+++ b/components/openstack/cinder/cinder.p5m	Wed May 27 15:21:04 2015 -0600
@@ -71,7 +71,8 @@
 file files/cinder-api path=lib/svc/method/cinder-api
 file files/cinder-backup path=lib/svc/method/cinder-backup
 file files/cinder-scheduler path=lib/svc/method/cinder-scheduler
-file files/cinder-upgrade path=lib/svc/method/cinder-upgrade
+file files/cinder-upgrade path=lib/svc/method/cinder-upgrade \
+    pkg.depend.bypass-generate=.*/openstack_common.*
 file files/cinder-volume path=lib/svc/method/cinder-volume
 file files/cinder-volume-setup path=lib/svc/method/cinder-volume-setup
 file path=usr/bin/cinder-manage pkg.depend.bypass-generate=.*/bpython.*
@@ -557,12 +558,41 @@
 # force a dependency on package delivering zfs(1M)
 depend type=require fmri=__TBD pkg.debug.depend.file=usr/sbin/zfs
 
+# force a dependency on cloud/openstack/openstack-common until it is
+# available in the WOS
+depend type=require fmri=cloud/openstack/openstack-common
+
 # force a dependency on argparse; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python-2/argparse-$(PYV)
 
 # force a dependency on babel; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python-2/babel-$(PYV)
 
+# force a dependency on greenlet; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/greenlet-$(PYV)
+
+# force a dependency on lxml; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/lxml-$(PYV)
+
+# force a dependency on paste; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/paste-$(PYV)
+
+# force a dependency on paste.deploy; pkgdepend work is needed to flush this
+# out.
+depend type=require fmri=library/python-2/paste.deploy-$(PYV)
+
+# force a dependency on routes; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/routes-$(PYV)
+
+# force a dependency on setuptools; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/setuptools-$(PYV)
+
+# force a dependency on stevedore; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/stevedore-$(PYV)
+
+# force a dependency on webob; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/webob-$(PYV)
+
 # force a dependency on barbicanclient; pkgdepend work is needed to flush this
 # out.
 depend type=require fmri=library/python/barbicanclient-$(PYV)
@@ -571,9 +601,6 @@
 # out.
 depend type=require fmri=library/python/glanceclient-$(PYV)
 
-# force a dependency on greenlet; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/greenlet-$(PYV)
-
 # force a dependency on iso8601; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python/iso8601-$(PYV)
 
@@ -584,9 +611,6 @@
 # force a dependency on keystonemiddleware; used via a paste.deploy filter
 depend type=require fmri=library/python/keystonemiddleware-$(PYV)
 
-# force a dependency on lxml; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/lxml-$(PYV)
-
 # force a dependency on novaclient; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python/novaclient-$(PYV)
 
@@ -603,37 +627,18 @@
 # force a dependency on osprofiler; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python/osprofiler-$(PYV)
 
-# force a dependency on paste; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/paste-$(PYV)
-
-# force a dependency on paste.deploy; pkgdepend work is needed to flush this
-# out.
-depend type=require fmri=library/python-2/paste.deploy-$(PYV)
-
 # force a dependency on pbr; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python/pbr-$(PYV)
 
-# force a dependency on routes; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/routes-$(PYV)
-
-# force a dependency on setuptools; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/setuptools-$(PYV)
-
 # force a dependency on six; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python/six-$(PYV)
 
-# force a dependency on stevedore; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/stevedore-$(PYV)
-
 # force a dependency on swiftclient; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python/swiftclient-$(PYV)
 
 # force a dependency on taskflow; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python/taskflow-$(PYV)
 
-# force a dependency on webob; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/webob-$(PYV)
-
 # force a dependency on the Solaris Install library; pkgdepend work is needed to
 # flush this out.
 depend type=require fmri=system/library/install
--- a/components/openstack/cinder/files/cinder-upgrade	Wed May 27 05:22:49 2015 -0700
+++ b/components/openstack/cinder/files/cinder-upgrade	Wed May 27 15:21:04 2015 -0600
@@ -14,21 +14,19 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-from ConfigParser import NoOptionError
-from datetime import datetime
-import errno
 import glob
 import os
-import shutil
 from subprocess import check_call, Popen, PIPE
 import sys
-import time
 import traceback
 
 import iniparse
 import smf_include
 import sqlalchemy
 
+from openstack_common import alter_mysql_tables, create_backups, modify_conf, \
+    move_conf
+
 
 CINDER_CONF_MAPPINGS = {
     # Deprecated group/name
@@ -72,140 +70,31 @@
     ('DEFAULT', 'matchmaker_ringfile'): ('matchmaker_ring', 'ringfile'),
 }
 
-
-def update_mapping(section, key, mapping):
-    """ look for deprecated variables and, if found, convert it to the new
-    section/key.
-    """
-
-    if (section, key) in mapping:
-        print "Deprecated value found: [%s] %s" % (section, key)
-        section, key = mapping[(section, key)]
-        if section is None and key is None:
-            print "Removing from configuration"
-        else:
-            print "Updating to: [%s] %s" % (section, key)
-    return section, key
-
-
-def alter_mysql_tables(engine):
-    """ Convert MySQL tables to use utf8
-    """
-
-    import MySQLdb
-
-    for _none in range(5):
-        try:
-            db = MySQLdb.connect(host=engine.url.host,
-                                 user=engine.url.username,
-                                 passwd=engine.url.password,
-                                 db=engine.url.database)
-            break
-        except MySQLdb.OperationalError as err:
-            # mysql is not ready. sleep for 2 more seconds
-            time.sleep(2)
-    else:
-        print "Unable to connect to MySQL:  %s" % err
-        print ("Please verify MySQL is properly configured and online "
-               "before using svcadm(1M) to clear this service.")
-        sys.exit(smf_include.SMF_EXIT_ERR_FATAL)
-
-    cursor = db.cursor()
-    cursor.execute("ALTER DATABASE %s CHARACTER SET = 'utf8'" %
-                   engine.url.database)
-    cursor.execute("ALTER DATABASE %s COLLATE = 'utf8_general_ci'" %
-                   engine.url.database)
-    cursor.execute("SHOW tables")
-    res = cursor.fetchall()
-    if res:
-        cursor.execute("SET foreign_key_checks = 0")
-        for item in res:
-            cursor.execute("ALTER TABLE %s.%s CONVERT TO "
-                           "CHARACTER SET 'utf8', COLLATE 'utf8_general_ci'"
-                           % (engine.url.database, item[0]))
-        cursor.execute("SET foreign_key_checks = 1")
-        db.commit()
-        db.close()
-
-
-def modify_conf(old_file, mapping=None):
-    """ Copy over all uncommented options from the old configuration file.  In
-    addition, look for deprecated section/keys and convert them to the new
-    section/key.
-    """
-
-    new_file = old_file + '.new'
+CINDER_CONF_EXCEPTIONS = [
+    ('DEFAULT', 'osapi_volume_workers'),
+    ('DEFAULT', 'auth_strategy'),
+    ('DEFAULT', 'san_is_local'),
+    ('DEFAULT', 'volume_driver'),
+    ('database', 'connection'),
+    ('keystone_authtoken', 'auth_uri'),
+    ('keystone_authtoken', 'identity_uri'),
+    ('keystone_authtoken', 'admin_user'),
+    ('keystone_authtoken', 'admin_password'),
+    ('keystone_authtoken', 'admin_tenant_name'),
+    ('keystone_authtoken', 'signing_dir'),
+]
 
-    # open the previous version
-    old = iniparse.ConfigParser()
-    old.readfp(open(old_file))
-
-    # open the new version
-    new = iniparse.ConfigParser()
-    try:
-        new.readfp(open(new_file))
-    except IOError as err:
-        if err.errno == errno.ENOENT:
-            # The upgrade did not deliver a .new file so, return
-            print "%s not found - continuing with %s" % (new_file, old_file)
-            return
-        else:
-            raise
-    print "\nupdating %s" % old_file
-
-    # walk every single section for uncommented options
-    default_items = set(old.items('DEFAULT'))
-    for section in old.sections() + ['DEFAULT']:
-
-        # DEFAULT items show up in every section so remove them
-        if section != 'DEFAULT':
-            section_items = set(old.items(section)) - default_items
-        else:
-            section_items = default_items
-
-        for key, value in section_items:
-            # keep a copy of the old value
-            oldvalue = value
-            oldsection = section
-
-            if mapping is not None:
-                section, key = update_mapping(section, key, mapping)
-
-                if section is None and key is None:
-                    # option is deprecated so continue
-                    continue
-
-            if not new.has_section(section):
-                if section != 'DEFAULT':
-                    new.add_section(section)
-
-            # print to the log when a value for the same section.key is
-            # changing to a new value
-            try:
-                new_value = new.get(section, key)
-                if new_value != value and '%SERVICE' not in new_value:
-                    print "Changing [%s] %s:\n- %s\n+ %s" % \
-                        (section, key, oldvalue, new_value)
-                    print
-            except NoOptionError:
-                # the new configuration file does not have this option set so
-                # just continue
-                pass
-
-            # Only copy the old value to the new conf file if the entry doesn't
-            # exist or if it contains '%SERVICE'
-            if not new.has_option(section, key) or \
-               '%SERVICE' in new.get(section, key):
-                new.set(section, key, value)
-            section = oldsection
-
-    # copy the old conf file to a backup
-    today = datetime.now().strftime("%Y%m%d%H%M%S")
-    shutil.copy2(old_file, old_file + '.' + today)
-
-    # copy the new conf file in place
-    with open(old_file, 'wb+') as fh:
-        new.write(fh)
+CINDER_MOVE_CONFIG = {
+    ('filter:authtoken', 'auth_uri'): ('keystone_authtoken', 'auth_uri'),
+    ('filter:authtoken', 'identity_uri'):
+        ('keystone_authtoken', 'identity_uri'),
+    ('filter:authtoken', 'admin_tenant_name'):
+        ('keystone_authtoken', 'admin_tenant_name'),
+    ('filter:authtoken', 'admin_user'): ('keystone_authtoken', 'admin_user'),
+    ('filter:authtoken', 'admin_password'):
+        ('keystone_authtoken', 'admin_password'),
+    ('filter:authtoken', 'signing_dir'): ('keystone_authtoken', 'signing_dir'),
+}
 
 
 def start():
@@ -230,8 +119,19 @@
     if glob.glob('/etc/cinder/*.new'):
         # the versions are different, so perform an upgrade
         # modify the configuration files
+
+        # backup all the old configuration files
+        create_backups('/etc/cinder')
+
         modify_conf('/etc/cinder/api-paste.ini')
-        modify_conf('/etc/cinder/cinder.conf', CINDER_CONF_MAPPINGS)
+
+        # before modifying cinder.conf, move the [filter:authtoken] entries
+        # from the updated api-paste.ini to the old cinder.conf
+        move_conf('/etc/cinder/api-paste.ini', '/etc/cinder/cinder.conf',
+                  CINDER_MOVE_CONFIG)
+
+        modify_conf('/etc/cinder/cinder.conf', CINDER_CONF_MAPPINGS,
+                    CINDER_CONF_EXCEPTIONS)
         modify_conf('/etc/cinder/logging.conf')
 
     config = iniparse.RawConfigParser()
@@ -259,6 +159,8 @@
     os.putenv('LC_ALL', 'C')
     try:
         smf_include.smf_main()
+    except RuntimeError:
+        sys.exit(smf_include.SMF_EXIT_ERR_FATAL)
     except Exception as err:
         print 'Unknown error:  %s' % err
         print
--- a/components/openstack/cinder/files/cinder-upgrade.xml	Wed May 27 05:22:49 2015 -0700
+++ b/components/openstack/cinder/files/cinder-upgrade.xml	Wed May 27 15:21:04 2015 -0600
@@ -33,7 +33,7 @@
     <logfile_attributes permissions='600'/>
 
     <exec_method timeout_seconds="300" type="method" name="start"
-      exec=":true">
+      exec="/lib/svc/method/cinder-upgrade %m">
       <method_context>
         <method_credential user='cinder' group='cinder' />
       </method_context>
--- a/components/openstack/common/Makefile	Wed May 27 05:22:49 2015 -0700
+++ b/components/openstack/common/Makefile	Wed May 27 15:21:04 2015 -0600
@@ -20,7 +20,7 @@
 #
 
 #
-# Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
 #
 
 include ../../../make-rules/shared-macros.mk
@@ -34,8 +34,10 @@
 
 ASLR_MODE = $(ASLR_NOT_APPLICABLE)
 
-# Do not apply the standard license transforms for this component.
-LICENSE_TRANSFORMS =
+# Used for placement of openstack_common.py
+PYTHON_VERSIONS=	2.6
+PYTHON_VERSION=		2.6
+PKG_MACROS +=		PYVER=$(PYTHON_VERSIONS)
 
 # common targets
 prep:
@@ -45,7 +47,9 @@
 	@/bin/true
 
 install:	FRC
-	@/bin/true
+	($(MKDIR) $(PROTO_DIR)$(PYTHON_LIB); \
+	    $(CP) files/openstack_common.py $(PROTO_DIR)$(PYTHON_LIB); \
+	 $(PYTHON) -m compileall $(PROTO_DIR)/$(PYTHON_VENDOR_PACKAGES))
 
 download::
 	@echo 'No downloads for this component'
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/openstack/common/common.license	Wed May 27 15:21:04 2015 -0600
@@ -0,0 +1,211 @@
+The following applies to all products licensed under the Apache 2.0 License:
+
+You may not use the identified files except in compliance with the Apache License, Version 2.0 (the "License.")
+ 
+You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.  A copy of the license is also reproduced below.
+
+Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+
+See the License for the specific language governing permissions and limitations under the License.
+
+		                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/openstack/common/files/openstack_common.py	Wed May 27 15:21:04 2015 -0600
@@ -0,0 +1,232 @@
+# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+#
+#    Licensed under the Apache License, Version 2.0 (the "License"); you may
+#    not use this file except in compliance with the License. You may obtain
+#    a copy of the License at
+#
+#         http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing, software
+#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+#    License for the specific language governing permissions and limitations
+#    under the License.
+
+
+""" openstack_upgrade - common functions used by the various OpenStack
+components to facilitate upgrading of configuration files and MySQL
+databases/tables (if in use)
+"""
+
+from ConfigParser import NoOptionError
+from datetime import datetime
+import errno
+import glob
+import os
+import shutil
+import time
+
+import iniparse
+
+
+def create_backups(directory):
+    """ create backups of each configuration file which also has a .new file
+    from the upgrade.
+    """
+
+    today = datetime.now().strftime("%Y%m%d%H%M%S")
+    cwd = os.getcwd()
+    os.chdir(directory)
+    for new_file in glob.glob('*.new'):
+        # copy the old conf file to a backup
+        old_file = new_file.replace('.new', '')
+        try:
+            shutil.copy2(old_file, old_file + '.' + today)
+        except (IOError, OSError):
+            print 'unable to create a backup of %s' % old_file
+
+    os.chdir(cwd)
+
+
+def update_mapping(section, key, mapping):
+    """ look for deprecated variables and, if found, convert it to the new
+    section/key.
+    """
+
+    if (section, key) in mapping:
+        print "Deprecated value found: [%s] %s" % (section, key)
+        section, key = mapping[(section, key)]
+        if section is None and key is None:
+            print "Removing from configuration"
+        else:
+            print "Updating to: [%s] %s" % (section, key)
+    return section, key
+
+
+def alter_mysql_tables(engine):
+    """ Convert MySQL tables to use utf8
+    """
+
+    import MySQLdb
+
+    for _none in range(60):
+        try:
+            db = MySQLdb.connect(host=engine.url.host,
+                                 user=engine.url.username,
+                                 passwd=engine.url.password,
+                                 db=engine.url.database)
+            break
+        except MySQLdb.OperationalError as err:
+            # mysql is not ready. sleep for 2 more seconds
+            time.sleep(2)
+    else:
+        print "Unable to connect to MySQL:  %s" % err
+        print ("Please verify MySQL is properly configured and online "
+               "before using svcadm(1M) to clear this service.")
+        raise RuntimeError
+
+    cursor = db.cursor()
+    cursor.execute("SHOW table status")
+    cursor.execute("ALTER DATABASE %s CHARACTER SET = 'utf8'" %
+                   engine.url.database)
+    cursor.execute("ALTER DATABASE %s COLLATE = 'utf8_general_ci'" %
+                   engine.url.database)
+    cursor.execute("SHOW tables")
+    res = cursor.fetchall()
+    if res:
+        cursor.execute("SET foreign_key_checks = 0")
+        for item in res:
+            cursor.execute("ALTER TABLE %s.%s CONVERT TO "
+                           "CHARACTER SET 'utf8', COLLATE 'utf8_general_ci'"
+                           % (engine.url.database, item[0]))
+        cursor.execute("SET foreign_key_checks = 1")
+        db.commit()
+        db.close()
+
+
+def modify_conf(old_file, mapping=None, exception_list=None):
+    """ Copy over all uncommented options from the old configuration file.  In
+    addition, look for deprecated section/keys and convert them to the new
+    section/key.
+    """
+
+    new_file = old_file + '.new'
+
+    # open the previous version
+    old = iniparse.ConfigParser()
+    old.readfp(open(old_file))
+
+    # open the new version
+    new = iniparse.ConfigParser()
+    try:
+        new.readfp(open(new_file))
+    except IOError as err:
+        if err.errno == errno.ENOENT:
+            # The upgrade did not deliver a .new file so, return
+            print "%s not found - continuing with %s" % (new_file, old_file)
+            return
+        else:
+            raise
+    print "\nupdating %s" % old_file
+
+    # walk every single section for uncommented options
+    default_items = set(old.items('DEFAULT'))
+    for old_section in old.sections() + ['DEFAULT']:
+
+        # DEFAULT items show up in every section so remove them
+        if old_section != 'DEFAULT':
+            section_items = set(old.items(old_section)) - default_items
+        else:
+            section_items = default_items
+
+        for old_key, value in section_items:
+            # Look for deprecated section/keys
+            if mapping is not None:
+                new_section, new_key = update_mapping(old_section, old_key,
+                                                      mapping)
+                if new_section is None and new_key is None:
+                    # option is deprecated so continue
+                    continue
+            else:
+                # no deprecated values for this file so just copy the values
+                # over
+                new_section, new_key = old_section, old_key
+
+            # Look for exceptions
+            if exception_list is not None:
+                if (new_section, new_key) in exception_list:
+                    if (new_section != 'DEFAULT' and
+                        not new.has_section(new_section)):
+                        new.add_section(new_section)
+                    print "Preserving [%s] %s = %s" % \
+                        (new_section, new_key, value)
+                    new.set(new_section, new_key, value)
+                    continue
+
+            if new_section != 'DEFAULT' and not new.has_section(new_section):
+                new.add_section(new_section)
+
+            # print to the log when a value for old_section.old_key is changing
+            # to a new value
+            try:
+                new_value = new.get(new_section, new_key)
+                if new_value != value and '%SERVICE' not in new_value:
+                    print "Changing [%s] %s:\n- %s\n+ %s" % \
+                        (old_section, old_key, value, new_value)
+                    print
+            except NoOptionError:
+                # the new configuration file does not have this option set so
+                # just continue
+                pass
+
+            # Only copy the old value to the new conf file if the entry doesn't
+            # exist in the new file or if it contains '%SERVICE'
+            if not new.has_option(new_section, new_key) or \
+               '%SERVICE' in new.get(new_section, new_key):
+                new.set(new_section, new_key, value)
+
+    # copy the new conf file in place
+    with open(old_file, 'wb+') as fh:
+        new.write(fh)
+
+
+def move_conf(original_file, new_file, mapping):
+    """ move each entry in mapping from the original file to the new file.
+    """
+    # open the original file
+    original = iniparse.ConfigParser()
+    original.readfp(open(original_file))
+
+    # open the new file
+    new = iniparse.ConfigParser()
+    new.readfp(open(new_file))
+
+    # The mappings dictionary look similar to the deprecation mappings:
+    # (original_section, original_key): (new_section, new_key)
+    for (original_section, original_key) in mapping:
+        try:
+            original_value = original.get(original_section, original_key)
+        except NoOptionError:
+            # the original file does not contain this mapping so continue
+            continue
+
+        new_section, new_key = mapping.get((original_section, original_key))
+
+        if new_section != 'DEFAULT' and not new.has_section(new_section):
+            new.add_section(new_section)
+
+        print 'Moving [%s] %s from %s to [%s] %s in %s' % \
+            (original_section, original_key, original_file,
+             new_section, new_key, new_file)
+
+        # set the option in the new file
+        new.set(new_section, new_key, original_value)
+
+        # remove the option from the old file
+        original.remove_option(original_section, original_key)
+
+    with open(original_file, 'wb+') as fh:
+        original.write(fh)
+
+    with open(new_file, 'wb+') as fh:
+        new.write(fh)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/openstack/common/openstack-common.p5m	Wed May 27 15:21:04 2015 -0600
@@ -0,0 +1,49 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+#
+
+set name=pkg.fmri \
+    value=pkg:/cloud/openstack/[email protected]$(IPS_COMPONENT_VERSION),$(BUILD_VERSION)
+set name=pkg.summary value="OpenStack Common Package"
+set name=pkg.description \
+    value="Library package for common data structures and functions used by other OpenStack projects within Solaris."
+set name=pkg.human-version value="Juno $(COMPONENT_VERSION)"
+set name=info.classification \
+    value="org.opensolaris.category.2008:System/Administration and Configuration" \
+    value="org.opensolaris.category.2008:System/Enterprise Management" \
+    value=org.opensolaris.category.2008:System/Virtualization \
+    value="org.opensolaris.category.2008:Web Services/Application and Web Servers"
+set name=info.upstream value="OpenStack <[email protected]>"
+set name=info.upstream-url value=$(COMPONENT_PROJECT_URL)
+set name=org.opensolaris.arc-caseid value=PSARC/2013/350 value=PSARC/2015/110 \
+    value=PSARC/2015/233
+set name=org.opensolaris.consolidation value=$(CONSOLIDATION)
+#
+file path=usr/lib/python$(PYVER)/vendor-packages/openstack_common.py
+#
+# License Note:  This package contains no third-party code but is
+# licensed under Apache v2.0 like other OpenStack content developed
+# in-house.  No TPNO is required.
+#
+license common.license license="Apache v2.0"
--- a/components/openstack/common/openstack.p5m	Wed May 27 05:22:49 2015 -0700
+++ b/components/openstack/common/openstack.p5m	Wed May 27 15:21:04 2015 -0600
@@ -49,6 +49,7 @@
 depend type=group fmri=cloud/openstack/swift
 depend type=group fmri=database/mysql-55
 depend type=group fmri=database/mysql-55/client
+depend type=group fmri=library/python-2/python-mysql
 depend type=group fmri=library/python/barbicanclient
 depend type=group fmri=library/python/ceilometerclient
 depend type=group fmri=library/python/cinderclient
@@ -57,7 +58,6 @@
 depend type=group fmri=library/python/keystoneclient
 depend type=group fmri=library/python/neutronclient
 depend type=group fmri=library/python/novaclient
-depend type=group fmri=library/python-2/python-mysql
 depend type=group fmri=library/python/saharaclient
 depend type=group fmri=library/python/swiftclient
 depend type=group fmri=library/python/troveclient
--- a/components/openstack/glance/files/glance-upgrade	Wed May 27 05:22:49 2015 -0700
+++ b/components/openstack/glance/files/glance-upgrade	Wed May 27 15:21:04 2015 -0600
@@ -14,21 +14,18 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-from ConfigParser import NoOptionError
-from datetime import datetime
-import errno
 import glob
 import os
-import shutil
 from subprocess import check_call, Popen, PIPE
 import sys
-import time
 import traceback
 
 import iniparse
 import smf_include
 import sqlalchemy
 
+from openstack_common import alter_mysql_tables, create_backups, modify_conf
+
 
 GLANCE_API_MAPPINGS = {
     # Deprecated group/name
@@ -52,8 +49,133 @@
     ('DEFAULT', 'sql_connection_debug'): ('database', 'connection_debug'),
     ('DEFAULT', 'sql_connection_trace'): ('database', 'connection_trace'),
     ('DATABASE', 'sqlalchemy_pool_timeout'): ('database', 'pool_timeout'),
+    ('DEFAULT', 'filesystem_store_datadir'):
+        ('glance_store', 'filesystem_store_datadir'),
+    ('DEFAULT', 'swift_store_auth_version'):
+         ('glance_store', 'swift_store_auth_version'),
+    ('DEFAULT', 'swift_store_auth_address'):
+         ('glance_store', 'swift_store_auth_address'),
+    ('DEFAULT', 'swift_store_user'): ('glance_store', 'swift_store_user'),
+    ('DEFAULT', 'swift_store_key'): ('glance_store', 'swift_store_key'),
+    ('DEFAULT', 'swift_store_container'):
+         ('glance_store', 'swift_store_container'),
+    ('DEFAULT', 'swift_store_create_container_on_put'):
+         ('glance_store', 'swift_store_create_container_on_put'),
+    ('DEFAULT', 'swift_store_large_object_size'):
+         ('glance_store', 'swift_store_large_object_size'),
+    ('DEFAULT', 'swift_store_large_object_chunk_size'):
+         ('glance_store', 'swift_store_large_object_chunk_size'),
+    ('DEFAULT', 'swift_enable_snet'): ('glance_store', 'swift_enable_snet'),
+    ('DEFAULT', 's3_store_host'): ('glance_store', 's3_store_host'),
+    ('DEFAULT', 's3_store_access_key'):
+         ('glance_store', 's3_store_access_key'),
+    ('DEFAULT', 's3_store_secret_key'):
+         ('glance_store', 's3_store_secret_key'),
+    ('DEFAULT', 's3_store_bucket'): ('glance_store', 's3_store_bucket'),
+    ('DEFAULT', 's3_store_create_bucket_on_put'):
+         ('glance_store', 's3_store_create_bucket_on_put'),
+    ('DEFAULT', 'sheepdog_store_address'):
+         ('glance_store', 'sheepdog_store_address'),
+    ('DEFAULT', 'sheepdog_store_port'):
+         ('glance_store', 'sheepdog_store_port'),
+    ('DEFAULT', 'sheepdog_store_chunk_size'):
+         ('glance_store', 'sheepdog_store_chunk_size'),
 }
 
+GLANCE_API_EXCEPTIONS = [
+    ('DEFAULT', 'bind_host'),
+    ('DEFAULT', 'bind_port'),
+    ('DEFAULT', 'log_file'),
+    ('DEFAULT', 'backlog'),
+    ('DEFAULT', 'workers'),
+    ('DEFAULT', 'registry_host'),
+    ('DEFAULT', 'registry_port'),
+    ('DEFAULT', 'registry_client_protocol'),
+    ('DEFAULT', 'rabbit_host'),
+    ('DEFAULT', 'rabbit_port'),
+    ('DEFAULT', 'rabbit_use_ssl'),
+    ('DEFAULT', 'rabbit_userid'),
+    ('DEFAULT', 'rabbit_password'),
+    ('DEFAULT', 'rabbit_virtual_host'),
+    ('DEFAULT', 'rabbit_notification_exchange'),
+    ('DEFAULT', 'rabbit_notification_topic'),
+    ('DEFAULT', 'rabbit_durable_queues'),
+    ('DEFAULT', 'qpid_notification_exchange'),
+    ('DEFAULT', 'qpid_notification_topic'),
+    ('DEFAULT', 'qpid_hostname'),
+    ('DEFAULT', 'qpid_port'),
+    ('DEFAULT', 'qpid_usernamd'),
+    ('DEFAULT', 'qpid_password'),
+    ('DEFAULT', 'qpid_sasl_mechanisms'),
+    ('DEFAULT', 'qpid_reconnect_timeout'),
+    ('DEFAULT', 'qpid_reconnect_limit'),
+    ('DEFAULT', 'qpid_reconnect_interval_min'),
+    ('DEFAULT', 'qpid_reconnect_interval_max'),
+    ('DEFAULT', 'qpid_reconnect_interval'),
+    ('DEFAULT', 'qpid_heartbeat'),
+    ('DEFAULT', 'qpid_protocol'),
+    ('DEFAULT', 'qpid_tcp_nodelay'),
+    ('DEFAULT', 'delayed_delete'),
+    ('DEFAULT', 'scrub_time'),
+    ('DEFAULT', 'scrubber_datadir'),
+    ('DEFAULT', 'image_cache_dir'),
+    ('database', 'connection'),
+    ('keystone_authtoken', 'auth_uri'),
+    ('keystone_authtoken', 'identity_uri'),
+    ('keystone_authtoken', 'admin_tenant_name'),
+    ('keystone_authtoken', 'admin_user'),
+    ('keystone_authtoken', 'admin_password'),
+    ('keystone_authtoken', 'revocation_cache_time'),
+    ('keystone_authtoken', 'signing_dir'),
+    ('paste_deploy', 'flavor'),
+    ('glance_store', 'filesystem_store_datadir'),
+    ('glance_store', 'swift_store_auth_version'),
+    ('glance_store', 'swift_store_auth_address'),
+    ('glance_store', 'swift_store_user'),
+    ('glance_store', 'swift_store_key'),
+    ('glance_store', 'swift_store_container'),
+    ('glance_store', 'swift_store_create_container_on_put'),
+    ('glance_store', 'swift_store_large_object_size'),
+    ('glance_store', 'swift_store_large_object_chunk_size'),
+    ('glance_store', 'swift_enable_snet'),
+    ('glance_store', 's3_store_host'),
+    ('glance_store', 's3_store_access_key'),
+    ('glance_store', 's3_store_secret_key'),
+    ('glance_store', 's3_store_bucket'),
+    ('glance_store', 's3_store_create_bucket_on_put'),
+    ('glance_store', 'sheepdog_store_address'),
+    ('glance_store', 'sheepdog_store_port'),
+    ('glance_store', 'sheepdog_store_chunk_size'),
+]
+
+GLANCE_CACHE_EXCEPTIONS = [
+    ('DEFAULT', 'log_file'),
+    ('DEFAULT', 'image_cache_dir'),
+    ('DEFAULT', 'image_cache_stall_time'),
+    ('DEFAULT', 'image_cache_max_size'),
+    ('DEFAULT', 'registry_host'),
+    ('DEFAULT', 'registry_port'),
+    ('DEFAULT', 'auth_url'),
+    ('DEFAULT', 'admin_tenant_name'),
+    ('DEFAULT', 'admin_user'),
+    ('DEFAULT', 'admin_password'),
+    ('DEFAULT', 'filesystem_store_datadir'),
+    ('DEFAULT', 'swift_store_auth_version'),
+    ('DEFAULT', 'swift_store_auth_address'),
+    ('DEFAULT', 'swift_store_user'),
+    ('DEFAULT', 'swift_store_key'),
+    ('DEFAULT', 'swift_store_container'),
+    ('DEFAULT', 'swift_store_create_container_on_put'),
+    ('DEFAULT', 'swift_store_large_object_size'),
+    ('DEFAULT', 'swift_store_large_object_chunk_size'),
+    ('DEFAULT', 'swift_enable_snet'),
+    ('DEFAULT', 's3_store_host'),
+    ('DEFAULT', 's3_store_access_key'),
+    ('DEFAULT', 's3_store_secret_key'),
+    ('DEFAULT', 's3_store_bucket'),
+    ('DEFAULT', 's3_store_create_bucket_on_put'),
+]
+
 GLANCE_REGISTRY_MAPPINGS = {
     # Deprecated group/name
     ('DEFAULT', 'db_backend'): ('database', 'backend'),
@@ -78,140 +200,69 @@
     ('DATABASE', 'sqlalchemy_pool_timeout'): ('database', 'pool_timeout'),
 }
 
-
-def update_mapping(section, key, mapping):
-    """ look for deprecated variables and, if found, convert it to the new
-    section/key.
-    """
-
-    if (section, key) in mapping:
-        print "Deprecated value found: [%s] %s" % (section, key)
-        section, key = mapping[(section, key)]
-        if section is None and key is None:
-            print "Removing from configuration"
-        else:
-            print "Updating to: [%s] %s" % (section, key)
-    return section, key
-
-
-def alter_mysql_tables(engine):
-    """ Convert MySQL tables to use utf8
-    """
-
-    import MySQLdb
-
-    for _none in range(5):
-        try:
-            db = MySQLdb.connect(host=engine.url.host,
-                                 user=engine.url.username,
-                                 passwd=engine.url.password,
-                                 db=engine.url.database)
-            break
-        except MySQLdb.OperationalError as err:
-            # mysql is not ready. sleep for 2 more seconds
-            time.sleep(2)
-    else:
-        print "Unable to connect to MySQL:  %s" % err
-        print ("Please verify MySQL is properly configured and online "
-               "before using svcadm(1M) to clear this service.")
-        sys.exit(smf_include.SMF_EXIT_ERR_FATAL)
-
-    cursor = db.cursor()
-    cursor.execute("ALTER DATABASE %s CHARACTER SET = 'utf8'" %
-                   engine.url.database)
-    cursor.execute("ALTER DATABASE %s COLLATE = 'utf8_general_ci'" %
-                   engine.url.database)
-    cursor.execute("SHOW tables")
-    res = cursor.fetchall()
-    if res:
-        cursor.execute("SET foreign_key_checks = 0")
-        for item in res:
-            cursor.execute("ALTER TABLE %s.%s CONVERT TO "
-                           "CHARACTER SET 'utf8', COLLATE 'utf8_general_ci'"
-                           % (engine.url.database, item[0]))
-        cursor.execute("SET foreign_key_checks = 1")
-        db.commit()
-        db.close()
-
-
-def modify_conf(old_file, mapping=None):
-    """ Copy over all uncommented options from the old configuration file.  In
-    addition, look for deprecated section/keys and convert them to the new
-    section/key.
-    """
-
-    new_file = old_file + '.new'
+GLANCE_REGISTRY_EXCEPTIONS = [
+    ('DEFAULT', 'bind_host'),
+    ('DEFAULT', 'bind_host'),
+    ('DEFAULT', 'log_file'),
+    ('DEFAULT', 'backlog'),
+    ('DEFAULT', 'workers'),
+    ('DEFAULT', 'api_limit_max'),
+    ('DEFAULT', 'limit_param_default'),
+    ('DEFAULT', 'rabbit_host'),
+    ('DEFAULT', 'rabbit_port'),
+    ('DEFAULT', 'rabbit_use_ssl'),
+    ('DEFAULT', 'rabbit_userid'),
+    ('DEFAULT', 'rabbit_password'),
+    ('DEFAULT', 'rabbit_virtual_host'),
+    ('DEFAULT', 'rabbit_notification_exchange'),
+    ('DEFAULT', 'rabbit_notification_topic'),
+    ('DEFAULT', 'rabbit_durable_queues'),
+    ('DEFAULT', 'qpid_notification_exchange'),
+    ('DEFAULT', 'qpid_notification_topic'),
+    ('DEFAULT', 'qpid_hostname'),
+    ('DEFAULT', 'qpid_port'),
+    ('DEFAULT', 'qpid_usernamd'),
+    ('DEFAULT', 'qpid_password'),
+    ('DEFAULT', 'qpid_sasl_mechanisms'),
+    ('DEFAULT', 'qpid_reconnect_timeout'),
+    ('DEFAULT', 'qpid_reconnect_limit'),
+    ('DEFAULT', 'qpid_reconnect_interval_min'),
+    ('DEFAULT', 'qpid_reconnect_interval_max'),
+    ('DEFAULT', 'qpid_reconnect_interval'),
+    ('DEFAULT', 'qpid_heartbeat'),
+    ('DEFAULT', 'qpid_protocol'),
+    ('DEFAULT', 'qpid_tcp_nodelay'),
+    ('database', 'connection'),
+    ('keystone_authtoken', 'auth_uri'),
+    ('keystone_authtoken', 'identity_uri'),
+    ('keystone_authtoken', 'admin_tenant_name'),
+    ('keystone_authtoken', 'admin_user'),
+    ('keystone_authtoken', 'admin_password'),
+    ('keystone_authtoken', 'signing_dir'),
+    ('paste_deploy', 'flavor'),
+]
 
-    # open the previous version
-    old = iniparse.ConfigParser()
-    old.readfp(open(old_file))
-
-    # open the new version
-    new = iniparse.ConfigParser()
-    try:
-        new.readfp(open(new_file))
-    except IOError as err:
-        if err.errno == errno.ENOENT:
-            # The upgrade did not deliver a .new file so, return
-            print "%s not found - continuing with %s" % (new_file, old_file)
-            return
-        else:
-            raise
-    print "\nupdating %s" % old_file
-
-    # walk every single section for uncommented options
-    default_items = set(old.items('DEFAULT'))
-    for section in old.sections() + ['DEFAULT']:
-
-        # DEFAULT items show up in every section so remove them
-        if section != 'DEFAULT':
-            section_items = set(old.items(section)) - default_items
-        else:
-            section_items = default_items
-
-        for key, value in section_items:
-            # keep a copy of the old value
-            oldvalue = value
-            oldsection = section
-
-            if mapping is not None:
-                section, key = update_mapping(section, key, mapping)
+GLANCE_SCRUBBER_MAPPINGS = {
+    # Deprecated group/name
+    ('DEFAULT', 'filesystem_store_datadir'):
+        ('glance_store', 'filesystem_store_datadir'),
+}
 
-                if section is None and key is None:
-                    # option is deprecated so continue
-                    continue
-
-            if not new.has_section(section):
-                if section != 'DEFAULT':
-                    new.add_section(section)
-
-            # print to the log when a value for the same section.key is
-            # changing to a new value
-            try:
-                new_value = new.get(section, key)
-                if new_value != value and '%SERVICE' not in new_value:
-                    print "Changing [%s] %s:\n- %s\n+ %s" % \
-                        (section, key, oldvalue, new_value)
-                    print
-            except NoOptionError:
-                # the new configuration file does not have this option set so
-                # just continue
-                pass
-
-            # Only copy the old value to the new conf file if the entry doesn't
-            # exist or if it contains '%SERVICE'
-            if not new.has_option(section, key) or \
-               '%SERVICE' in new.get(section, key):
-                new.set(section, key, value)
-            section = oldsection
-
-    # copy the old conf file to a backup
-    today = datetime.now().strftime("%Y%m%d%H%M%S")
-    shutil.copy2(old_file, old_file + '.' + today)
-
-    # copy the new conf file in place
-    with open(old_file, 'wb+') as fh:
-        new.write(fh)
+GLANCE_SCRUBBER_EXCEPTIONS = [
+    ('DEFAULT', 'log_file'),
+    ('DEFAULT', 'wakeup_time'),
+    ('DEFAULT', 'scrubber_datadir'),
+    ('DEFAULT', 'cleanup_scrubber'),
+    ('DEFAULT', 'cleanup_scrubber_time'),
+    ('DEFAULT', 'registry_host'),
+    ('DEFAULT', 'registry_port'),
+    ('DEFAULT', 'auth_url'),
+    ('DEFAULT', 'admin_tenant_name'),
+    ('DEFAULT', 'admin_user'),
+    ('DEFAULT', 'admin_password'),
+    ('database', 'connection'),
+    ('glance_store', 'filesystem_store_datadir'),
+]
 
 
 def start():
@@ -236,13 +287,22 @@
     if glob.glob('/etc/glance/*.new'):
         # the versions are different, so perform an upgrade
         # modify the configuration files
-        modify_conf('/etc/glance/glance-api.conf', GLANCE_API_MAPPINGS)
+
+        # backup all the old configuration files
+        create_backups('/etc/glance')
+
+        modify_conf('/etc/glance/glance-api.conf', GLANCE_API_MAPPINGS,
+                    GLANCE_API_EXCEPTIONS)
         modify_conf('/etc/glance/glance-api-paste.ini')
-        modify_conf('/etc/glance/glance-cache.conf')
+        modify_conf('/etc/glance/glance-cache.conf',
+                    exception_list=GLANCE_CACHE_EXCEPTIONS)
         modify_conf('/etc/glance/glance-registry.conf',
-                    GLANCE_REGISTRY_MAPPINGS)
+                    GLANCE_REGISTRY_MAPPINGS,
+                    GLANCE_REGISTRY_EXCEPTIONS)
         modify_conf('/etc/glance/glance-registry-paste.ini')
-        modify_conf('/etc/glance/glance-scrubber.conf')
+        modify_conf('/etc/glance/glance-scrubber.conf',
+                    GLANCE_SCRUBBER_MAPPINGS,
+                    GLANCE_SCRUBBER_EXCEPTIONS)
         modify_conf('/etc/glance/logging.conf')
 
     config = iniparse.RawConfigParser()
@@ -262,6 +322,7 @@
     check_call(['/usr/sbin/svccfg', '-s', os.environ['SMF_FMRI'], 'setprop',
                'config/upgrade-id', '=', pkg_ver])
     check_call(['/usr/sbin/svccfg', '-s', os.environ['SMF_FMRI'], 'refresh'])
+
     sys.exit(smf_include.SMF_EXIT_OK)
 
 
@@ -269,6 +330,8 @@
     os.putenv('LC_ALL', 'C')
     try:
         smf_include.smf_main()
+    except RuntimeError:
+        sys.exit(smf_include.SMF_EXIT_ERR_FATAL)
     except Exception as err:
         print 'Unknown error:  %s' % err
         print
--- a/components/openstack/glance/files/glance-upgrade.xml	Wed May 27 05:22:49 2015 -0700
+++ b/components/openstack/glance/files/glance-upgrade.xml	Wed May 27 15:21:04 2015 -0600
@@ -33,7 +33,7 @@
     <logfile_attributes permissions='600'/>
 
     <exec_method timeout_seconds="300" type="method" name="start"
-      exec=":true">
+      exec="/lib/svc/method/glance-upgrade %m">
       <method_context>
         <method_credential user='glance' group='glance' />
       </method_context>
--- a/components/openstack/glance/glance.p5m	Wed May 27 05:22:49 2015 -0700
+++ b/components/openstack/glance/glance.p5m	Wed May 27 15:21:04 2015 -0600
@@ -136,7 +136,8 @@
 file files/glance-api path=lib/svc/method/glance-api
 file files/glance-registry path=lib/svc/method/glance-registry
 file files/glance-scrubber path=lib/svc/method/glance-scrubber
-file files/glance-upgrade path=lib/svc/method/glance-upgrade
+file files/glance-upgrade path=lib/svc/method/glance-upgrade \
+    pkg.depend.bypass-generate=.*/openstack_common.*
 file path=usr/bin/glance-cache-manage
 file path=usr/bin/glance-cache-prefetcher
 file path=usr/bin/glance-manage
@@ -377,6 +378,10 @@
 # flush this out.
 depend type=group fmri=library/python-2/anyjson-$(PYV)
 
+# force a group dependency on the optional simplejson; pkgdepend work is needed
+# to flush this out.
+depend type=group fmri=library/python-2/simplejson-$(PYV)
+
 # force a group dependency on the optional dnspython; pkgdepend work is needed
 # to flush this out.
 depend type=group fmri=library/python/dnspython-$(PYV)
@@ -385,9 +390,9 @@
 # to flush this out.
 depend type=group fmri=library/python/pysendfile-$(PYV)
 
-# force a group dependency on the optional simplejson; pkgdepend work is needed
-# to flush this out.
-depend type=group fmri=library/python-2/simplejson-$(PYV)
+# force a dependency on cloud/openstack/openstack-common until it is
+# available in the WOS
+depend type=require fmri=cloud/openstack/openstack-common
 
 # force a dependency on argparse; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python-2/argparse-$(PYV)
@@ -395,18 +400,43 @@
 # force a dependency on babel; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python-2/babel-$(PYV)
 
-# force a dependency on glance_store; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python/glance_store-$(PYV)
-
 # force a dependency on httplib2; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python-2/httplib2-$(PYV)
 
+# force a dependency on jsonschema; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/jsonschema-$(PYV)
+
+# force a dependency on netaddr; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/netaddr-$(PYV)
+
+# force a dependency on ordereddict; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/ordereddict-$(PYV)
+
+# force a dependency on paste; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/paste-$(PYV)
+
+# force a dependency on paste.deploy; pkgdepend work is needed to flush this
+# out.
+depend type=require fmri=library/python-2/paste.deploy-$(PYV)
+
+# force a dependency on pyopenssl; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/pyopenssl-$(PYV)
+
+# force a dependency on routes; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/routes-$(PYV)
+
+# force a dependency on stevedore; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/stevedore-$(PYV)
+
+# force a dependency on webob; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/webob-$(PYV)
+
+# force a dependency on glance_store; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python/glance_store-$(PYV)
+
 # force a dependency on iso8601; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python/iso8601-$(PYV)
 
-# force a dependency on jsonschema; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/jsonschema-$(PYV)
-
 # force a dependency on keystoneclient; pkgdepend work is needed to flush this
 # out.
 depend type=require fmri=library/python/keystoneclient-$(PYV)
@@ -414,12 +444,6 @@
 # force a dependency on keystonemiddleware; used via a paste.deploy filter
 depend type=require fmri=library/python/keystonemiddleware-$(PYV)
 
-# force a dependency on netaddr; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/netaddr-$(PYV)
-
-# force a dependency on ordereddict; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/ordereddict-$(PYV)
-
 # force a dependency on oslo.db; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python/oslo.db-$(PYV)
 
@@ -436,37 +460,18 @@
 # force a dependency on osprofiler; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python/osprofiler-$(PYV)
 
-# force a dependency on paste; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/paste-$(PYV)
-
-# force a dependency on paste.deploy; pkgdepend work is needed to flush this
-# out.
-depend type=require fmri=library/python-2/paste.deploy-$(PYV)
-
 # force a dependency on pbr; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python/pbr-$(PYV)
 
 # force a dependency on posix_ipc; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python/posix_ipc-$(PYV)
 
-# force a dependency on pyopenssl; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/pyopenssl-$(PYV)
-
 # force a dependency on retrying; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python/retrying-$(PYV)
 
-# force a dependency on routes; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/routes-$(PYV)
-
 # force a dependency on six; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python/six-$(PYV)
 
-# force a dependency on stevedore; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/stevedore-$(PYV)
-
-# force a dependency on webob; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/webob-$(PYV)
-
 # force a dependency on wsme; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python/wsme-$(PYV)
 
--- a/components/openstack/heat/files/heat-upgrade	Wed May 27 05:22:49 2015 -0700
+++ b/components/openstack/heat/files/heat-upgrade	Wed May 27 15:21:04 2015 -0600
@@ -14,21 +14,19 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-from ConfigParser import NoOptionError
-from datetime import datetime
-import errno
 import glob
 import os
-import shutil
 from subprocess import check_call, Popen, PIPE
 import sys
-import time
 import traceback
 
 import iniparse
 import smf_include
 import sqlalchemy
 
+from openstack_common import alter_mysql_tables, create_backups, modify_conf, \
+    move_conf
+
 
 HEAT_CONF_MAPPINGS = {
     # Deprecated group/name
@@ -67,140 +65,26 @@
     ('DEFAULT', 'list_notifier_drivers'): (None, None),
 }
 
-
-def update_mapping(section, key, mapping):
-    """ look for deprecated variables and, if found, convert it to the new
-    section/key.
-    """
-
-    if (section, key) in mapping:
-        print "Deprecated value found: [%s] %s" % (section, key)
-        section, key = mapping[(section, key)]
-        if section is None and key is None:
-            print "Removing from configuration"
-        else:
-            print "Updating to: [%s] %s" % (section, key)
-    return section, key
-
-
-def alter_mysql_tables(engine):
-    """ Convert MySQL tables to use utf8
-    """
-
-    import MySQLdb
-
-    for _none in range(5):
-        try:
-            db = MySQLdb.connect(host=engine.url.host,
-                                 user=engine.url.username,
-                                 passwd=engine.url.password,
-                                 db=engine.url.database)
-            break
-        except MySQLdb.OperationalError as err:
-            # mysql is not ready. sleep for 2 more seconds
-            time.sleep(2)
-    else:
-        print "Unable to connect to MySQL:  %s" % err
-        print ("Please verify MySQL is properly configured and online "
-               "before using svcadm(1M) to clear this service.")
-        sys.exit(smf_include.SMF_EXIT_ERR_FATAL)
-
-    cursor = db.cursor()
-    cursor.execute("ALTER DATABASE %s CHARACTER SET = 'utf8'" %
-                   engine.url.database)
-    cursor.execute("ALTER DATABASE %s COLLATE = 'utf8_general_ci'" %
-                   engine.url.database)
-    cursor.execute("SHOW tables")
-    res = cursor.fetchall()
-    if res:
-        cursor.execute("SET foreign_key_checks = 0")
-        for item in res:
-            cursor.execute("ALTER TABLE %s.%s CONVERT TO "
-                           "CHARACTER SET 'utf8', COLLATE 'utf8_general_ci'"
-                           % (engine.url.database, item[0]))
-        cursor.execute("SET foreign_key_checks = 1")
-        db.commit()
-        db.close()
-
-
-def modify_conf(old_file, mapping=None):
-    """ Copy over all uncommented options from the old configuration file.  In
-    addition, look for deprecated section/keys and convert them to the new
-    section/key.
-    """
-
-    new_file = old_file + '.new'
+HEAT_CONF_EXCEPTIONS = [
+    ('database', 'connection'),
+    ('keystone_authtoken', 'auth_uri'),
+    ('keystone_authtoken', 'identity_uri'),
+    ('keystone_authtoken', 'admin_user'),
+    ('keystone_authtoken', 'admin_password'),
+    ('keystone_authtoken', 'admin_tenant_name'),
+    ('keystone_authtoken', 'signing_dir'),
+]
 
-    # open the previous version
-    old = iniparse.ConfigParser()
-    old.readfp(open(old_file))
-
-    # open the new version
-    new = iniparse.ConfigParser()
-    try:
-        new.readfp(open(new_file))
-    except IOError as err:
-        if err.errno == errno.ENOENT:
-            # The upgrade did not deliver a .new file so, return
-            print "%s not found - continuing with %s" % (new_file, old_file)
-            return
-        else:
-            raise
-    print "\nupdating %s" % old_file
-
-    # walk every single section for uncommented options
-    default_items = set(old.items('DEFAULT'))
-    for section in old.sections() + ['DEFAULT']:
-
-        # DEFAULT items show up in every section so remove them
-        if section != 'DEFAULT':
-            section_items = set(old.items(section)) - default_items
-        else:
-            section_items = default_items
-
-        for key, value in section_items:
-            # keep a copy of the old value
-            oldvalue = value
-            oldsection = section
-
-            if mapping is not None:
-                section, key = update_mapping(section, key, mapping)
-
-                if section is None and key is None:
-                    # option is deprecated so continue
-                    continue
-
-            if not new.has_section(section):
-                if section != 'DEFAULT':
-                    new.add_section(section)
-
-            # print to the log when a value for the same section.key is
-            # changing to a new value
-            try:
-                new_value = new.get(section, key)
-                if new_value != value and '%SERVICE' not in new_value:
-                    print "Changing [%s] %s:\n- %s\n+ %s" % \
-                        (section, key, oldvalue, new_value)
-                    print
-            except NoOptionError:
-                # the new configuration file does not have this option set so
-                # just continue
-                pass
-
-            # Only copy the old value to the new conf file if the entry doesn't
-            # exist or if it contains '%SERVICE'
-            if not new.has_option(section, key) or \
-               '%SERVICE' in new.get(section, key):
-                new.set(section, key, value)
-            section = oldsection
-
-    # copy the old conf file to a backup
-    today = datetime.now().strftime("%Y%m%d%H%M%S")
-    shutil.copy2(old_file, old_file + '.' + today)
-
-    # copy the new conf file in place
-    with open(old_file, 'wb+') as fh:
-        new.write(fh)
+HEAT_MOVE_CONFIG = {
+    ('filter:authtoken', 'auth_uri'): ('keystone_authtoken', 'auth_uri'),
+    ('filter:authtoken', 'identity_uri'):
+        ('keystone_authtoken', 'identity_uri'),
+    ('filter:authtoken', 'admin_tenant_name'):
+        ('keystone_authtoken', 'admin_tenant_name'),
+    ('filter:authtoken', 'admin_user'): ('keystone_authtoken', 'admin_user'),
+    ('filter:authtoken', 'admin_password'):
+        ('keystone_authtoken', 'admin_password'),
+}
 
 
 def start():
@@ -225,8 +109,19 @@
     if glob.glob('/etc/heat/*.new'):
         # the versions are different, so perform an upgrade
         # modify the configuration files
+
+        # backup all the old configuration files
+        create_backups('/etc/heat')
+
         modify_conf('/etc/heat/api-paste.ini')
-        modify_conf('/etc/heat/heat.conf', HEAT_CONF_MAPPINGS)
+
+        # before modifying heat.conf, move the [filter:authtoken] entries from
+        # the updated api-paste.ini to the old heat.conf
+        move_conf('/etc/heat/api-paste.ini', '/etc/heat/heat.conf',
+                  HEAT_MOVE_CONFIG)
+
+        modify_conf('/etc/heat/heat.conf', HEAT_CONF_MAPPINGS,
+                    HEAT_CONF_EXCEPTIONS)
 
     config = iniparse.RawConfigParser()
     config.read('/etc/heat/heat.conf')
@@ -253,6 +148,8 @@
     os.putenv('LC_ALL', 'C')
     try:
         smf_include.smf_main()
+    except RuntimeError:
+        sys.exit(smf_include.SMF_EXIT_ERR_FATAL)
     except Exception as err:
         print 'Unknown error:  %s' % err
         print
--- a/components/openstack/heat/files/heat-upgrade.xml	Wed May 27 05:22:49 2015 -0700
+++ b/components/openstack/heat/files/heat-upgrade.xml	Wed May 27 15:21:04 2015 -0600
@@ -33,7 +33,7 @@
     <logfile_attributes permissions='600'/>
 
     <exec_method timeout_seconds="300" type="method" name="start"
-      exec=":true">
+      exec="/lib/svc/method/heat-upgrade %m">
       <method_context>
         <method_credential user='heat' group='heat' />
       </method_context>
--- a/components/openstack/heat/heat.p5m	Wed May 27 05:22:49 2015 -0700
+++ b/components/openstack/heat/heat.p5m	Wed May 27 15:21:04 2015 -0600
@@ -72,7 +72,8 @@
 file path=lib/svc/manifest/application/openstack/heat-engine.xml
 file path=lib/svc/manifest/application/openstack/heat-upgrade.xml
 file files/heat-smf-method path=lib/svc/method/heat-smf-method
-file files/heat-upgrade path=lib/svc/method/heat-upgrade
+file files/heat-upgrade path=lib/svc/method/heat-upgrade \
+    pkg.depend.bypass-generate=.*/openstack_common.*
 file path=usr/bin/heat-manage
 file usr/bin/heat-keystone-setup \
     path=usr/demo/openstack/keystone/heat-keystone-setup mode=0555
@@ -368,12 +369,44 @@
 # to flush this out.
 depend type=group fmri=library/python-2/simplejson-$(PYV)
 
+# force a dependency on cloud/openstack/openstack-common until it is
+# available in the WOS
+depend type=require fmri=cloud/openstack/openstack-common
+
 # force a dependency on argparse; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python-2/argparse-$(PYV)
 
 # force a dependency on babel; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python-2/babel-$(PYV)
 
+# force a dependency on greenlet; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/greenlet-$(PYV)
+
+# force a dependency on lxml; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/lxml-$(PYV)
+
+# force a dependency on m2crypto; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/m2crypto-$(PYV)
+
+# force a dependency on paste.deploy; pkgdepend work is needed to flush this
+# out.
+depend type=require fmri=library/python-2/paste.deploy-$(PYV)
+
+# force a dependency on pyyaml; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/pyyaml-$(PYV)
+
+# force a dependency on requests; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/requests-$(PYV)
+
+# force a dependency on routes; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/routes-$(PYV)
+
+# force a dependency on stevedore; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/stevedore-$(PYV)
+
+# force a dependency on webob; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/webob-$(PYV)
+
 # force a dependency on ceilometerclient; pkgdepend work is needed to flush this
 # out.
 depend type=require fmri=library/python/ceilometerclient-$(PYV)
@@ -386,9 +419,6 @@
 # out.
 depend type=require fmri=library/python/glanceclient-$(PYV)
 
-# force a dependency on greenlet; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/greenlet-$(PYV)
-
 # force a dependency on heatclient; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python/heatclient-$(PYV)
 
@@ -402,12 +432,6 @@
 # force a dependency on keystonemiddleware; used via a paste.deploy filter
 depend type=require fmri=library/python/keystonemiddleware-$(PYV)
 
-# force a dependency on lxml; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/lxml-$(PYV)
-
-# force a dependency on m2crypto; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/m2crypto-$(PYV)
-
 # force a dependency on neutronclient; pkgdepend work is needed to flush this
 # out.
 depend type=require fmri=library/python/neutronclient-$(PYV)
@@ -432,37 +456,18 @@
 # force a dependency on oslo.utils; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python/oslo.utils-$(PYV)
 
-# force a dependency on paste.deploy; pkgdepend work is needed to flush this
-# out.
-depend type=require fmri=library/python-2/paste.deploy-$(PYV)
-
 # force a dependency on pbr; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python/pbr-$(PYV)
 
 # force a dependency on posix_ipc; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python/posix_ipc-$(PYV)
 
-# force a dependency on pyyaml; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/pyyaml-$(PYV)
-
-# force a dependency on requests; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/requests-$(PYV)
-
-# force a dependency on routes; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/routes-$(PYV)
-
 # force a dependency on saharaclient; pkgdepend work is needed to flush this
 # out.
 depend type=require fmri=library/python/saharaclient-$(PYV)
 
-# force a dependency on stevedore; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/stevedore-$(PYV)
-
 # force a dependency on swiftclient; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python/swiftclient-$(PYV)
 
 # force a dependency on troveclient; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python/troveclient-$(PYV)
-
-# force a dependency on webob; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/webob-$(PYV)
--- a/components/openstack/horizon/horizon.p5m	Wed May 27 05:22:49 2015 -0700
+++ b/components/openstack/horizon/horizon.p5m	Wed May 27 15:21:04 2015 -0600
@@ -2078,6 +2078,29 @@
 # force a dependency on babel; pkgdepend work is needed to flush this out
 depend type=require fmri=library/python-2/babel-$(PYV)
 
+# force a dependency on django_compressor; one of the applications defined in
+# settings.py
+depend type=require fmri=library/python-2/django_compressor-$(PYV)
+
+# force a dependency on django_openstack_auth; pkgdepend work is needed to flush
+# this out
+depend type=require fmri=library/python-2/django_openstack_auth-$(PYV)
+
+# force a dependency on httplib2; pkgdepend work is needed to flush this out
+depend type=require fmri=library/python-2/httplib2-$(PYV)
+
+# force a dependency on lockfile; pkgdepend work is needed to flush this out
+depend type=require fmri=library/python-2/lockfile-$(PYV)
+
+# force a dependency on netaddr; pkgdepend work is needed to flush this out
+depend type=require fmri=library/python-2/netaddr-$(PYV)
+
+# force a dependency on pytz; pkgdepend work is needed to flush this out
+depend type=require fmri=library/python-2/pytz-$(PYV)
+
+# force a dependency on requests; pkgdepend work is needed to flush this out
+depend type=require fmri=library/python-2/requests-$(PYV)
+
 # force a dependency on ceilometerclient; pkgdepend work is needed to flush this
 # out
 depend type=require fmri=library/python/ceilometerclient-$(PYV)
@@ -2092,23 +2115,12 @@
 # settings.py
 depend type=require fmri=library/python/django-pyscss-$(PYV)
 
-# force a dependency on django_compressor; one of the applications defined in
-# settings.py
-depend type=require fmri=library/python-2/django_compressor-$(PYV)
-
-# force a dependency on django_openstack_auth; pkgdepend work is needed to flush
-# this out
-depend type=require fmri=library/python-2/django_openstack_auth-$(PYV)
-
 # force a dependency on glanceclient; pkgdepend work is needed to flush this out
 depend type=require fmri=library/python/glanceclient-$(PYV)
 
 # force a dependency on heatclient; pkgdepend work is needed to flush this out
 depend type=require fmri=library/python/heatclient-$(PYV)
 
-# force a dependency on httplib2; pkgdepend work is needed to flush this out
-depend type=require fmri=library/python-2/httplib2-$(PYV)
-
 # force a dependency on iso8601; pkgdepend work is needed to flush this out
 depend type=require fmri=library/python/iso8601-$(PYV)
 
@@ -2116,12 +2128,6 @@
 # out
 depend type=require fmri=library/python/keystoneclient-$(PYV)
 
-# force a dependency on lockfile; pkgdepend work is needed to flush this out
-depend type=require fmri=library/python-2/lockfile-$(PYV)
-
-# force a dependency on netaddr; pkgdepend work is needed to flush this out
-depend type=require fmri=library/python-2/netaddr-$(PYV)
-
 # force a dependency on neutronclient; pkgdepend work is needed to flush this
 # out
 depend type=require fmri=library/python/neutronclient-$(PYV)
@@ -2135,12 +2141,6 @@
 # force a dependency on pbr; pkgdepend work is needed to flush this out
 depend type=require fmri=library/python/pbr-$(PYV)
 
-# force a dependency on pytz; pkgdepend work is needed to flush this out
-depend type=require fmri=library/python-2/pytz-$(PYV)
-
-# force a dependency on requests; pkgdepend work is needed to flush this out
-depend type=require fmri=library/python-2/requests-$(PYV)
-
 # force a dependency on saharaclient; pkgdepend work is needed to flush this out
 depend type=require fmri=library/python/saharaclient-$(PYV)
 
--- a/components/openstack/keystone/files/keystone-upgrade	Wed May 27 05:22:49 2015 -0700
+++ b/components/openstack/keystone/files/keystone-upgrade	Wed May 27 15:21:04 2015 -0600
@@ -14,21 +14,18 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-from ConfigParser import NoOptionError
-from datetime import datetime
-import errno
 import glob
 import os
-import shutil
 from subprocess import check_call, Popen, PIPE
 import sys
-import time
 import traceback
 
 import iniparse
 import smf_include
 import sqlalchemy
 
+from openstack_common import alter_mysql_tables, create_backups, modify_conf
+
 
 KEYSTONE_CONF_MAPPINGS = {
     # Deprecated group/name
@@ -81,140 +78,11 @@
     ('DEFAULT', 'matchmaker_ringfile'): ('matchmaker_ring', 'ringfile'),
 }
 
-
-def update_mapping(section, key, mapping):
-    """ look for deprecated variables and, if found, convert it to the new
-    section/key.
-    """
-
-    if (section, key) in mapping:
-        print "Deprecated value found: [%s] %s" % (section, key)
-        section, key = mapping[(section, key)]
-        if section is None and key is None:
-            print "Removing from configuration"
-        else:
-            print "Updating to: [%s] %s" % (section, key)
-    return section, key
-
-
-def alter_mysql_tables(engine):
-    """ Convert MySQL tables to use utf8
-    """
-
-    import MySQLdb
-
-    for _none in range(5):
-        try:
-            db = MySQLdb.connect(host=engine.url.host,
-                                 user=engine.url.username,
-                                 passwd=engine.url.password,
-                                 db=engine.url.database)
-            break
-        except MySQLdb.OperationalError as err:
-            # mysql is not ready. sleep for 2 more seconds
-            time.sleep(2)
-    else:
-        print "Unable to connect to MySQL:  %s" % err
-        print ("Please verify MySQL is properly configured and online "
-               "before using svcadm(1M) to clear this service.")
-        sys.exit(smf_include.SMF_EXIT_ERR_FATAL)
-
-    cursor = db.cursor()
-    cursor.execute("ALTER DATABASE %s CHARACTER SET = 'utf8'" %
-                   engine.url.database)
-    cursor.execute("ALTER DATABASE %s COLLATE = 'utf8_general_ci'" %
-                   engine.url.database)
-    cursor.execute("SHOW tables")
-    res = cursor.fetchall()
-    if res:
-        cursor.execute("SET foreign_key_checks = 0")
-        for item in res:
-            cursor.execute("ALTER TABLE %s.%s CONVERT TO "
-                           "CHARACTER SET 'utf8', COLLATE 'utf8_general_ci'"
-                           % (engine.url.database, item[0]))
-        cursor.execute("SET foreign_key_checks = 1")
-        db.commit()
-        db.close()
-
-
-def modify_conf(old_file, mapping=None):
-    """ Copy over all uncommented options from the old configuration file.  In
-    addition, look for deprecated section/keys and convert them to the new
-    section/key.
-    """
-
-    new_file = old_file + '.new'
-
-    # open the previous version
-    old = iniparse.ConfigParser()
-    old.readfp(open(old_file))
-
-    # open the new version
-    new = iniparse.ConfigParser()
-    try:
-        new.readfp(open(new_file))
-    except IOError as err:
-        if err.errno == errno.ENOENT:
-            # The upgrade did not deliver a .new file so, return
-            print "%s not found - continuing with %s" % (new_file, old_file)
-            return
-        else:
-            raise
-    print "\nupdating %s" % old_file
-
-    # walk every single section for uncommented options
-    default_items = set(old.items('DEFAULT'))
-    for section in old.sections() + ['DEFAULT']:
-
-        # DEFAULT items show up in every section so remove them
-        if section != 'DEFAULT':
-            section_items = set(old.items(section)) - default_items
-        else:
-            section_items = default_items
-
-        for key, value in section_items:
-            # keep a copy of the old value
-            oldvalue = value
-            oldsection = section
-
-            if mapping is not None:
-                section, key = update_mapping(section, key, mapping)
-
-                if section is None and key is None:
-                    # option is deprecated so continue
-                    continue
-
-            if not new.has_section(section):
-                if section != 'DEFAULT':
-                    new.add_section(section)
-
-            # print to the log when a value for the same section.key is
-            # changing to a new value
-            try:
-                new_value = new.get(section, key)
-                if new_value != value and '%SERVICE' not in new_value:
-                    print "Changing [%s] %s:\n- %s\n+ %s" % \
-                        (section, key, oldvalue, new_value)
-                    print
-            except NoOptionError:
-                # the new configuration file does not have this option set so
-                # just continue
-                pass
-
-            # Only copy the old value to the new conf file if the entry doesn't
-            # exist or if it contains '%SERVICE'
-            if not new.has_option(section, key) or \
-               '%SERVICE' in new.get(section, key):
-                new.set(section, key, value)
-            section = oldsection
-
-    # copy the old conf file to a backup
-    today = datetime.now().strftime("%Y%m%d%H%M%S")
-    shutil.copy2(old_file, old_file + '.' + today)
-
-    # copy the new conf file in place
-    with open(old_file, 'wb+') as fh:
-        new.write(fh)
+KEYSTONE_CONF_EXCEPTIONS = [
+    ('DEFAULT', 'public_workers'),
+    ('DEFAULT', 'admin_workers'),
+    ('database', 'connection'),
+]
 
 
 def start():
@@ -239,7 +107,12 @@
     if glob.glob('/etc/keystone/*.new'):
         # the versions are different, so perform an upgrade
         # modify the configuration files
-        modify_conf('/etc/keystone/keystone.conf', KEYSTONE_CONF_MAPPINGS)
+
+        # backup all the old configuration files
+        create_backups('/etc/keystone')
+
+        modify_conf('/etc/keystone/keystone.conf', KEYSTONE_CONF_MAPPINGS,
+                    KEYSTONE_CONF_EXCEPTIONS)
         modify_conf('/etc/keystone/keystone-paste.ini')
         modify_conf('/etc/keystone/logging.conf')
 
@@ -268,6 +141,8 @@
     os.putenv('LC_ALL', 'C')
     try:
         smf_include.smf_main()
+    except RuntimeError:
+        sys.exit(smf_include.SMF_EXIT_ERR_FATAL)
     except Exception as err:
         print 'Unknown error:  %s' % err
         print
--- a/components/openstack/keystone/files/keystone-upgrade.xml	Wed May 27 05:22:49 2015 -0700
+++ b/components/openstack/keystone/files/keystone-upgrade.xml	Wed May 27 15:21:04 2015 -0600
@@ -33,7 +33,7 @@
     <logfile_attributes permissions='600'/>
 
     <exec_method timeout_seconds="300" type="method" name="start"
-      exec=":true">
+      exec="/lib/svc/method/keystone-upgrade %m">
       <method_context>
         <method_credential user='keystone' group='keystone' />
       </method_context>
--- a/components/openstack/keystone/keystone.p5m	Wed May 27 05:22:49 2015 -0700
+++ b/components/openstack/keystone/keystone.p5m	Wed May 27 15:21:04 2015 -0600
@@ -69,7 +69,8 @@
 file path=lib/svc/manifest/application/openstack/keystone-upgrade.xml
 file path=lib/svc/manifest/application/openstack/keystone.xml
 file files/keystone path=lib/svc/method/keystone
-file files/keystone-upgrade path=lib/svc/method/keystone-upgrade
+file files/keystone-upgrade path=lib/svc/method/keystone-upgrade \
+    pkg.depend.bypass-generate=.*/openstack_common.*
 file path=usr/bin/keystone-manage
 file tools/sample_data.sh path=usr/demo/openstack/keystone/sample_data.sh \
     mode=0555
@@ -395,12 +396,50 @@
 # force a dependency on package delivering openssl(1OPENSSL)
 depend type=require fmri=__TBD pkg.debug.depend.file=usr/bin/openssl
 
+# force a dependency on cloud/openstack/openstack-common until it is
+# available in the WOS
+depend type=require fmri=cloud/openstack/openstack-common
+
 # force a dependency on argparse; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python-2/argparse-$(PYV)
 
 # force a dependency on babel; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python-2/babel-$(PYV)
 
+# force a dependency on eventlet; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/eventlet-$(PYV)
+
+# force a dependency on greenlet; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/greenlet-$(PYV)
+
+# force a dependency on jsonschema; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/jsonschema-$(PYV)
+
+# force a dependency on lxml; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/lxml-$(PYV)
+
+# force a dependency on passlib; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/passlib-$(PYV)
+
+# force a dependency on paste.deploy; pkgdepend work is needed to flush this
+# out.
+depend type=require fmri=library/python-2/paste.deploy-$(PYV)
+
+# force a dependency on python-ldap; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/python-ldap-$(PYV)
+
+# force a dependency on routes; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/routes-$(PYV)
+
+# force a dependency on setuptools; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/setuptools-$(PYV)
+
+# force a dependency on stevedore; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/stevedore-$(PYV)
+
+# force a dependency on webob; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/webob-$(PYV)
+
 # force a dependency on dogpile.cache; pkgdepend work is needed to flush this
 # out.
 depend type=require fmri=library/python/dogpile.cache-$(PYV)
@@ -409,18 +448,9 @@
 # out.
 depend type=require fmri=library/python/dogpile.core-$(PYV)
 
-# force a dependency on eventlet; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/eventlet-$(PYV)
-
-# force a dependency on greenlet; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/greenlet-$(PYV)
-
 # force a dependency on iso8601; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python/iso8601-$(PYV)
 
-# force a dependency on jsonschema; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/jsonschema-$(PYV)
-
 # force a dependency on keystoneclient; pkgdepend work is needed to flush this
 # out.
 depend type=require fmri=library/python/keystoneclient-$(PYV)
@@ -432,9 +462,6 @@
 # force a dependency on ldappool; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python/ldappool-$(PYV)
 
-# force a dependency on lxml; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/lxml-$(PYV)
-
 # force a dependency on oauthlib; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python/oauthlib-$(PYV)
 
@@ -451,34 +478,12 @@
 # force a dependency on oslo.utils; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python/oslo.utils-$(PYV)
 
-# force a dependency on passlib; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/passlib-$(PYV)
-
-# force a dependency on paste.deploy; pkgdepend work is needed to flush this
-# out.
-depend type=require fmri=library/python-2/paste.deploy-$(PYV)
-
 # force a dependency on pycadf; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python/pycadf-$(PYV)
 
-# force a dependency on python-ldap; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/python-ldap-$(PYV)
-
 # force a dependency on python-memcached; pkgdepend work is needed to flush this
 # out.
 depend type=require fmri=library/python/python-memcached-$(PYV)
 
-# force a dependency on routes; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/routes-$(PYV)
-
-# force a dependency on setuptools; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/setuptools-$(PYV)
-
 # force a dependency on six; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python/six-$(PYV)
-
-# force a dependency on stevedore; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/stevedore-$(PYV)
-
-# force a dependency on webob; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/webob-$(PYV)
--- a/components/openstack/neutron/files/evs/migrate/evs-neutron-migration.py	Wed May 27 05:22:49 2015 -0700
+++ b/components/openstack/neutron/files/evs/migrate/evs-neutron-migration.py	Wed May 27 15:21:04 2015 -0600
@@ -41,6 +41,8 @@
 from oslo.db import options as db_options
 from oslo.db import exception as excp
 
+import time
+
 
 def create_db_network(nw, engine, ext_ro):
     ''' Method for creating networks table in the neutron-server DB
@@ -54,7 +56,18 @@
     from neutron.db import db_base_plugin_v2
     from neutron.db import external_net_db as ext_net
     model_base.BASEV2.metadata.bind = engine
-    model_base.BASEV2.metadata.create_all(engine)
+    for _none in range(60):
+        try:
+            model_base.BASEV2.metadata.create_all(engine)
+            break
+        except sa.exc.OperationalError as err:
+            # mysql is not ready. sleep for 2 more seconds
+            time.sleep(2)
+    else:
+        print "Unable to connect to MySQL:  %s" % err
+        print ("Please verify MySQL is properly configured and online "
+               "before using svcadm(1M) to clear this service.")
+        raise RuntimeError
     ctxt = ctx.get_admin_context()
     inst = db_base_plugin_v2.NeutronDbPluginV2()
     dup = False
--- a/components/openstack/neutron/files/neutron-upgrade	Wed May 27 05:22:49 2015 -0700
+++ b/components/openstack/neutron/files/neutron-upgrade	Wed May 27 15:21:04 2015 -0600
@@ -14,21 +14,18 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-from ConfigParser import NoOptionError
-from datetime import datetime
-import errno
 import glob
 import os
-import shutil
 from subprocess import check_call, Popen, PIPE
 import sys
-import time
 import traceback
 
 import iniparse
 import smf_include
 import sqlalchemy
 
+from openstack_common import alter_mysql_tables, create_backups, modify_conf
+
 
 NEUTRON_CONF_MAPPINGS = {
     # Deprecated group/name
@@ -36,9 +33,21 @@
     ('rpc_notifier2', 'topics'): ('DEFAULT', 'notification_topics'),
     ('DEFAULT', 'matchmaker_ringfile'): ('matchmaker_ring', 'ringfile'),
     # As of Juno, EVS now uses the standard quota driver
-    ('quotas', 'quota_driver'): (None, None)
+    ('quotas', 'quota_driver'): (None, None),
 }
 
+NEUTRON_CONF_EXCEPTIONS = [
+    ('DEFAULT', 'lockpath'),
+    ('keystone_authtoken', 'auth_uri'),
+    ('keystone_authtoken', 'identity_uri'),
+    ('keystone_authtoken', 'admin_tenant_name'),
+    ('keystone_authtoken', 'admin_user'),
+    ('keystone_authtoken', 'admin_password'),
+    ('keystone_authtoken', 'signing_dir'),
+    ('database', 'connection'),
+]
+
+
 DHCP_AGENT_MAPPINGS = {
     # Deprecated group/name
     ('DEFAULT', 'dnsmasq_dns_server'): ('DEFAULT', 'dnsmasq_dns_servers'),
@@ -49,140 +58,18 @@
     ('DATABASE', 'sql_connection'): (None, None),
 }
 
-
-def update_mapping(section, key, mapping):
-    """ look for deprecated variables and, if found, convert it to the new
-    section/key.
-    """
-
-    if (section, key) in mapping:
-        print "Deprecated value found: [%s] %s" % (section, key)
-        section, key = mapping[(section, key)]
-        if section is None and key is None:
-            print "Removing from configuration"
-        else:
-            print "Updating to: [%s] %s" % (section, key)
-    return section, key
-
-
-def alter_mysql_tables(engine):
-    """ Convert MySQL tables to use utf8
-    """
-
-    import MySQLdb
-
-    for _none in range(5):
-        try:
-            db = MySQLdb.connect(host=engine.url.host,
-                                 user=engine.url.username,
-                                 passwd=engine.url.password,
-                                 db=engine.url.database)
-            break
-        except MySQLdb.OperationalError as err:
-            # mysql is not ready. sleep for 2 more seconds
-            time.sleep(2)
-    else:
-        print "Unable to connect to MySQL:  %s" % err
-        print ("Please verify MySQL is properly configured and online "
-               "before using svcadm(1M) to clear this service.")
-        sys.exit(smf_include.SMF_EXIT_ERR_FATAL)
-
-    cursor = db.cursor()
-    cursor.execute("ALTER DATABASE %s CHARACTER SET = 'utf8'" %
-                   engine.url.database)
-    cursor.execute("ALTER DATABASE %s COLLATE = 'utf8_general_ci'" %
-                   engine.url.database)
-    cursor.execute("SHOW tables")
-    res = cursor.fetchall()
-    if res:
-        cursor.execute("SET foreign_key_checks = 0")
-        for item in res:
-            cursor.execute("ALTER TABLE %s.%s CONVERT TO "
-                           "CHARACTER SET 'utf8', COLLATE 'utf8_general_ci'"
-                           % (engine.url.database, item[0]))
-        cursor.execute("SET foreign_key_checks = 1")
-        db.commit()
-        db.close()
-
-
-def modify_conf(old_file, mapping=None):
-    """ Copy over all uncommented options from the old configuration file.  In
-    addition, look for deprecated section/keys and convert them to the new
-    section/key.
-    """
-
-    new_file = old_file + '.new'
+L3_AGENT_EXCEPTIONS = [
+    ('DEFAULT', 'enable_metadata_proxy'),
+]
 
-    # open the previous version
-    old = iniparse.ConfigParser()
-    old.readfp(open(old_file))
-
-    # open the new version
-    new = iniparse.ConfigParser()
-    try:
-        new.readfp(open(new_file))
-    except IOError as err:
-        if err.errno == errno.ENOENT:
-            # The upgrade did not deliver a .new file so, return
-            print "%s not found - continuing with %s" % (new_file, old_file)
-            return
-        else:
-            raise
-    print "\nupdating %s" % old_file
-
-    # walk every single section for uncommented options
-    default_items = set(old.items('DEFAULT'))
-    for section in old.sections() + ['DEFAULT']:
-
-        # DEFAULT items show up in every section so remove them
-        if section != 'DEFAULT':
-            section_items = set(old.items(section)) - default_items
-        else:
-            section_items = default_items
-
-        for key, value in section_items:
-            # keep a copy of the old value
-            oldvalue = value
-            oldsection = section
-
-            if mapping is not None:
-                section, key = update_mapping(section, key, mapping)
-
-                if section is None and key is None:
-                    # option is deprecated so continue
-                    continue
-
-            if not new.has_section(section):
-                if section != 'DEFAULT':
-                    new.add_section(section)
-
-            # print to the log when a value for the same section.key is
-            # changing to a new value
-            try:
-                new_value = new.get(section, key)
-                if new_value != value and '%SERVICE' not in new_value:
-                    print "Changing [%s] %s:\n- %s\n+ %s" % \
-                        (section, key, oldvalue, new_value)
-                    print
-            except NoOptionError:
-                # the new configuration file does not have this option set so
-                # just continue
-                pass
-
-            # Only copy the old value to the new conf file if the entry doesn't
-            # exist or if it contains '%SERVICE'
-            if not new.has_option(section, key) or \
-               '%SERVICE' in new.get(section, key):
-                new.set(section, key, value)
-            section = oldsection
-
-    # copy the old conf file to a backup
-    today = datetime.now().strftime("%Y%m%d%H%M%S")
-    shutil.copy2(old_file, old_file + '.' + today)
-
-    # copy the new conf file in place
-    with open(old_file, 'wb+') as fh:
-        new.write(fh)
+METADATA_AGENT_EXCEPTIONS = [
+    ('DEFAULT', 'auth_url'),
+    ('DEFAULT', 'auth_region'),
+    ('DEFAULT', 'admin_tenant_name'),
+    ('DEFAULT', 'admin_user'),
+    ('DEFAULT', 'admin_password'),
+    ('DEFAULT', 'metadata_workers'),
+]
 
 
 def start():
@@ -207,12 +94,19 @@
     if glob.glob('/etc/neutron/*.new'):
         # the versions are different, so perform an upgrade
         # modify the configuration files
+
+        # backup all the old configuration files
+        create_backups('/etc/neutron')
+
         modify_conf('/etc/neutron/api-paste.ini')
         modify_conf('/etc/neutron/dhcp_agent.ini', DHCP_AGENT_MAPPINGS)
-        modify_conf('/etc/neutron/l3_agent.ini')
-        modify_conf('/etc/neutron/neutron.conf', NEUTRON_CONF_MAPPINGS)
+        modify_conf('/etc/neutron/l3_agent.ini', None, L3_AGENT_EXCEPTIONS)
+        modify_conf('/etc/neutron/neutron.conf', NEUTRON_CONF_MAPPINGS,
+                    NEUTRON_CONF_EXCEPTIONS)
         modify_conf('/etc/neutron/plugins/evs/evs_plugin.ini',
                     EVS_PLUGIN_MAPPINGS)
+        modify_conf('/etc/neutron/metadata_agent.ini', None,
+                    METADATA_AGENT_EXCEPTIONS)
 
     config = iniparse.RawConfigParser()
     config.read('/etc/neutron/neutron.conf')
@@ -248,6 +142,8 @@
     os.putenv('LC_ALL', 'C')
     try:
         smf_include.smf_main()
+    except RuntimeError:
+        sys.exit(smf_include.SMF_EXIT_ERR_FATAL)
     except Exception as err:
         print 'Unknown error:  %s' % err
         print
--- a/components/openstack/neutron/files/neutron-upgrade.xml	Wed May 27 05:22:49 2015 -0700
+++ b/components/openstack/neutron/files/neutron-upgrade.xml	Wed May 27 15:21:04 2015 -0600
@@ -33,7 +33,7 @@
     <logfile_attributes permissions='600'/>
 
     <exec_method timeout_seconds="300" type="method" name="start"
-      exec=":true">
+      exec="/lib/svc/method/neutron-upgrade %m">
       <method_context>
         <method_credential user='neutron' group='neutron' />
       </method_context>
--- a/components/openstack/neutron/neutron.p5m	Wed May 27 05:22:49 2015 -0700
+++ b/components/openstack/neutron/neutron.p5m	Wed May 27 15:21:04 2015 -0600
@@ -106,7 +106,8 @@
 file files/neutron-l3-agent path=lib/svc/method/neutron-l3-agent
 file files/neutron-metadata-agent path=lib/svc/method/neutron-metadata-agent
 file files/neutron-server path=lib/svc/method/neutron-server
-file files/neutron-upgrade path=lib/svc/method/neutron-upgrade
+file files/neutron-upgrade path=lib/svc/method/neutron-upgrade \
+    pkg.depend.bypass-generate=.*/openstack_common.*
 file path=usr/bin/neutron-db-manage
 file path=usr/lib/neutron/evs-neutron-migration mode=0555
 file usr/bin/neutron-dhcp-agent path=usr/lib/neutron/neutron-dhcp-agent \
@@ -1006,6 +1007,10 @@
 # force a dependency on package delivering ippool(1M)
 depend type=require fmri=__TBD pkg.debug.depend.file=usr/sbin/ippool
 
+# force a dependency on cloud/openstack/openstack-common until it is
+# available in the WOS
+depend type=require fmri=cloud/openstack/openstack-common
+
 # force a dependency on alembic; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python-2/alembic-$(PYV)
 
@@ -1024,15 +1029,34 @@
 # force a dependency on httplib2; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python-2/httplib2-$(PYV)
 
+# force a dependency on jsonrpclib; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/jsonrpclib-$(PYV)
+
+# force a dependency on paste.deploy; pkgdepend work is needed to flush this
+# out.
+depend type=require fmri=library/python-2/paste.deploy-$(PYV)
+
+# force a dependency on requests; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/requests-$(PYV)
+
+# force a dependency on routes; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/routes-$(PYV)
+
+# force a dependency on setuptools; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/setuptools-$(PYV)
+
+# force a dependency on stevedore; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/stevedore-$(PYV)
+
+# force a dependency on webob; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/webob-$(PYV)
+
 # force a dependency on iso8601; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python/iso8601-$(PYV)
 
 # force a dependency on jinja2; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python/jinja2-$(PYV)
 
-# force a dependency on jsonrpclib; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/jsonrpclib-$(PYV)
-
 # force a dependency on keystoneclient; pkgdepend work is needed to flush this
 # out.
 depend type=require fmri=library/python/keystoneclient-$(PYV)
@@ -1051,24 +1075,5 @@
 # out.
 depend type=require fmri=library/python/oslo.messaging-$(PYV)
 
-# force a dependency on paste.deploy; pkgdepend work is needed to flush this
-# out.
-depend type=require fmri=library/python-2/paste.deploy-$(PYV)
-
 # force a dependency on pbr; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python/pbr-$(PYV)
-
-# force a dependency on requests; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/requests-$(PYV)
-
-# force a dependency on routes; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/routes-$(PYV)
-
-# force a dependency on setuptools; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/setuptools-$(PYV)
-
-# force a dependency on stevedore; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/stevedore-$(PYV)
-
-# force a dependency on webob; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/webob-$(PYV)
--- a/components/openstack/nova/files/nova-upgrade	Wed May 27 05:22:49 2015 -0700
+++ b/components/openstack/nova/files/nova-upgrade	Wed May 27 15:21:04 2015 -0600
@@ -14,21 +14,19 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-from ConfigParser import NoOptionError
-from datetime import datetime
-import errno
 import glob
 import os
-import shutil
 from subprocess import check_call, Popen, PIPE
 import sys
-import time
 import traceback
 
 import iniparse
 import smf_include
 import sqlalchemy
 
+from openstack_common import alter_mysql_tables, create_backups, modify_conf, \
+    move_conf
+
 
 NOVA_CONF_MAPPINGS = {
     # Deprecated group/name
@@ -50,7 +48,6 @@
     ('DEFAULT', 'cinder_cross_az_attach'): ('cinder', 'cross_az_attach'),
     ('DEFAULT', 'db_backend'): ('database', 'backend'),
     ('DEFAULT', 'sql_connection'): ('database', 'connection'),
-    ('DEFAULT', 'sql_connection'): ('database', 'connection'),
     ('sql', 'connection'): ('database', 'connection'),
     ('DEFAULT', 'sql_idle_timeout'): ('database', 'idle_timeout'),
     ('DATABASE', 'sql_idle_timeout'): ('database', 'idle_timeout'),
@@ -98,169 +95,38 @@
         ('neutron', 'ca_certificates_file'),
     ('DEFAULT', 'spicehtml5proxy_host'): ('spice', 'html5proxy_host'),
     ('DEFAULT', 'spicehtml5proxy_port'): ('spice', 'html5proxy_port'),
-    # No longer referenced by the service
-    ('DEFAULT', 'sql_connection'): (None, None),
 }
 
-
-def update_mapping(section, key, mapping):
-    """ look for deprecated variables and, if found, convert it to the new
-    section/key.
-    """
-
-    if (section, key) in mapping:
-        print "Deprecated value found: [%s] %s" % (section, key)
-        section, key = mapping[(section, key)]
-        if section is None and key is None:
-            print "Removing from configuration"
-        else:
-            print "Updating to: [%s] %s" % (section, key)
-    return section, key
-
-
-def alter_mysql_tables(engine):
-    """ Convert MySQL tables to use utf8
-    """
-
-    import MySQLdb
-
-    for _none in range(5):
-        try:
-            db = MySQLdb.connect(host=engine.url.host,
-                                 user=engine.url.username,
-                                 passwd=engine.url.password,
-                                 db=engine.url.database)
-            break
-        except MySQLdb.OperationalError as err:
-            # mysql is not ready. sleep for 2 more seconds
-            time.sleep(2)
-    else:
-        print "Unable to connect to MySQL:  %s" % err
-        print ("Please verify MySQL is properly configured and online "
-               "before using svcadm(1M) to clear this service.")
-        sys.exit(smf_include.SMF_EXIT_ERR_FATAL)
-
-    cursor = db.cursor()
-    cursor.execute("ALTER DATABASE %s CHARACTER SET = 'utf8'" %
-                   engine.url.database)
-    cursor.execute("ALTER DATABASE %s COLLATE = 'utf8_general_ci'" %
-                   engine.url.database)
-    cursor.execute("SHOW tables")
-    res = cursor.fetchall()
-    if res:
-        cursor.execute("SET foreign_key_checks = 0")
-        for item in res:
-            cursor.execute("ALTER TABLE %s.%s CONVERT TO "
-                           "CHARACTER SET 'utf8', COLLATE 'utf8_general_ci'"
-                           % (engine.url.database, item[0]))
-        cursor.execute("SET foreign_key_checks = 1")
-        db.commit()
-        db.close()
-
-
-def modify_conf(old_file, mapping=None):
-    """ Copy over all uncommented options from the old configuration file.  In
-    addition, look for deprecated section/keys and convert them to the new
-    section/key.
-    """
-
-    new_file = old_file + '.new'
-
-    # open the previous version
-    old = iniparse.ConfigParser()
-    old.readfp(open(old_file))
+NOVA_CONF_EXCEPTIONS = [
+    ('DEFAULT', 'ec2_workers'),
+    ('DEFAULT', 'osapi_compute_workers'),
+    ('DEFAULT', 'metadata_workers'),
+    ('DEFAULT', 'lock_path'),
+    ('DEFAULT', 'novncproxy_base_url'),
+    ('conductor', 'workers'),
+    ('database', 'connection'),
+    ('keystone_authtoken', 'auth_uri'),
+    ('keystone_authtoken', 'signing_dir'),
+    ('keystone_authtoken', 'identity_uri'),
+    ('keystone_authtoken', 'admin_user'),
+    ('keystone_authtoken', 'admin_password'),
+    ('keystone_authtoken', 'admin_tenant_name'),
+    ('neutron', 'service_metadata_proxy'),
+]
 
-    # open the new version
-    new = iniparse.ConfigParser()
-    try:
-        new.readfp(open(new_file))
-    except IOError as err:
-        if err.errno == errno.ENOENT:
-            # The upgrade did not deliver a .new file so, return
-            print "%s not found - continuing with %s" % (new_file, old_file)
-            return
-        else:
-            raise
-    print "\nupdating %s" % old_file
-
-    # It's possible that nova.conf has database.connection commented out (to
-    # use the default value).  If it is, and none of other deprecated values
-    # are set, manually set database.connection in the new conf file.
-    if 'nova.conf' in old_file:
-        options = [
-            ('database', 'sql_connection'),
-            ('sql', 'connection'),
-            ('database', 'connection'),
-            ('DEFAULT', 'sql_connection')
-        ]
-        test = lambda x: old.has_section(x[0]) and old.has_option(x[0], x[1])
-        if not any(map(test, options)):
-            if old.has_option('DEFAULT', 'state_path'):
-                state_path = old.get('DEFAULT', 'state_path')
-            else:
-                state_path = '/var/lib/nova'
-
-            if old.has_option('DEFAULT', 'sqlite_db'):
-                sqlite_db = old.get('DEFAULT', 'sqlite_db')
-            else:
-                sqlite_db = 'nova.sqlite'
-
-            new.set('database', 'connection',
-                    'sqlite:///%s/%s' % (state_path, sqlite_db))
-
-    # walk every single section for uncommented options
-    default_items = set(old.items('DEFAULT'))
-    for section in old.sections() + ['DEFAULT']:
-
-        # DEFAULT items show up in every section so remove them
-        if section != 'DEFAULT':
-            section_items = set(old.items(section)) - default_items
-        else:
-            section_items = default_items
-
-        for key, value in section_items:
-            # keep a copy of the old value
-            oldvalue = value
-            oldsection = section
-
-            if mapping is not None:
-                section, key = update_mapping(section, key, mapping)
-
-                if section is None and key is None:
-                    # option is deprecated so continue
-                    continue
-
-            if not new.has_section(section):
-                if section != 'DEFAULT':
-                    new.add_section(section)
-
-            # print to the log when a value for the same section.key is
-            # changing to a new value
-            try:
-                new_value = new.get(section, key)
-                if new_value != value and '%SERVICE' not in new_value:
-                    print "Changing [%s] %s:\n- %s\n+ %s" % \
-                        (section, key, oldvalue, new_value)
-                    print
-            except NoOptionError:
-                # the new configuration file does not have this option set so
-                # just continue
-                pass
-
-            # Only copy the old value to the new conf file if the entry doesn't
-            # exist or if it contains '%SERVICE'
-            if not new.has_option(section, key) or \
-               '%SERVICE' in new.get(section, key):
-                new.set(section, key, value)
-            section = oldsection
-
-    # copy the old conf file to a backup
-    today = datetime.now().strftime("%Y%m%d%H%M%S")
-    shutil.copy2(old_file, old_file + '.' + today)
-
-    # copy the new conf file in place
-    with open(old_file, 'wb+') as fh:
-        new.write(fh)
+NOVA_MOVE_CONFIG = {
+    ('filter:authtoken', 'auth_uri'): ('keystone_authtoken', 'auth_uri'),
+    ('filter:authtoken', 'identity_uri'):
+        ('keystone_authtoken', 'identity_uri'),
+    ('filter:authtoken', 'admin_tenant_name'):
+        ('keystone_authtoken', 'admin_tenant_name'),
+    ('filter:authtoken', 'admin_user'): ('keystone_authtoken', 'admin_user'),
+    ('filter:authtoken', 'admin_password'):
+        ('keystone_authtoken', 'admin_password'),
+    ('filter:authtoken', 'signing_dir'): ('keystone_authtoken', 'signing_dir'),
+    ('filter:authtoken', 'auth_version'):
+        ('keystone_authtoken', 'auth_version'),
+}
 
 
 def start():
@@ -285,9 +151,60 @@
     if glob.glob('/etc/nova/*.new'):
         # the versions are different, so perform an upgrade
         # modify the configuration files
+
+        # backup all the old configuration files
+        create_backups('/etc/nova')
+
         modify_conf('/etc/nova/api-paste.ini')
         modify_conf('/etc/nova/logging.conf')
-        modify_conf('/etc/nova/nova.conf', NOVA_CONF_MAPPINGS)
+
+        # It's possible that nova.conf has database.connection commented out
+        # (to use the default value).  If it is, and none of other deprecated
+        # values are set, manually set database.connection in the new conf
+        # file.
+        if os.path.exists('/etc/nova/nova.conf.new'):
+
+            # open the previous version
+            old = iniparse.ConfigParser()
+            old.readfp(open('/etc/nova/nova.conf'))
+
+            # open the new version
+            new = iniparse.ConfigParser()
+            new.readfp(open('/etc/nova/nova.conf.new'))
+
+            options = [
+                ('database', 'sql_connection'),
+                ('sql', 'connection'),
+                ('database', 'connection'),
+                ('DEFAULT', 'sql_connection')
+            ]
+            test = lambda x: old.has_section(x[0]) and \
+                    old.has_option(x[0], x[1])
+
+            if not any(map(test, options)):
+                if old.has_option('DEFAULT', 'state_path'):
+                    state_path = old.get('DEFAULT', 'state_path')
+                else:
+                    state_path = '/var/lib/nova'
+
+                if old.has_option('DEFAULT', 'sqlite_db'):
+                    sqlite_db = old.get('DEFAULT', 'sqlite_db')
+                else:
+                    sqlite_db = 'nova.sqlite'
+
+                new.set('database', 'connection',
+                        'sqlite:///%s/%s' % (state_path, sqlite_db))
+
+                with open('/etc/nova/nova.conf.new', 'w+') as fh:
+                    new.write(fh)
+
+        # before modifying nova.conf, move the [filter:authtoken] entries from
+        # the updated api-paste.ini to the old nova.conf
+        move_conf('/etc/nova/api-paste.ini', '/etc/nova/nova.conf',
+                  NOVA_MOVE_CONFIG)
+
+        modify_conf('/etc/nova/nova.conf', NOVA_CONF_MAPPINGS,
+                    NOVA_CONF_EXCEPTIONS)
 
     config = iniparse.RawConfigParser()
     config.read('/etc/nova/nova.conf')
@@ -314,6 +231,8 @@
     os.putenv('LC_ALL', 'C')
     try:
         smf_include.smf_main()
+    except RuntimeError:
+        sys.exit(smf_include.SMF_EXIT_ERR_FATAL)
     except Exception as err:
         print 'Unknown error:  %s' % err
         print
--- a/components/openstack/nova/files/nova-upgrade.xml	Wed May 27 05:22:49 2015 -0700
+++ b/components/openstack/nova/files/nova-upgrade.xml	Wed May 27 15:21:04 2015 -0600
@@ -33,7 +33,7 @@
     <logfile_attributes permissions='600'/>
 
     <exec_method timeout_seconds="300" type="method" name="start"
-      exec=":true">
+      exec="/lib/svc/method/nova-upgrade %m">
       <method_context>
         <method_credential user='nova' group='nova' />
       </method_context>
--- a/components/openstack/nova/nova.p5m	Wed May 27 05:22:49 2015 -0700
+++ b/components/openstack/nova/nova.p5m	Wed May 27 15:21:04 2015 -0600
@@ -83,7 +83,8 @@
 file files/nova-novncproxy path=lib/svc/method/nova-novncproxy
 file files/nova-objectstore path=lib/svc/method/nova-objectstore
 file files/nova-scheduler path=lib/svc/method/nova-scheduler
-file files/nova-upgrade path=lib/svc/method/nova-upgrade
+file files/nova-upgrade path=lib/svc/method/nova-upgrade \
+    pkg.depend.bypass-generate=.*/openstack_common.*
 file files/zone-vnc-console path=lib/svc/method/zone-vnc-console
 file path=usr/bin/nova-manage
 file usr/bin/nova-api-ec2 path=usr/lib/nova/nova-api-ec2 mode=0555
@@ -881,14 +882,14 @@
 # to flush this out.
 depend type=group fmri=library/python-2/python-ldap-$(PYV)
 
+# force a group dependency on the optional simplejson; pkgdepend work is needed
+# to flush this out.
+depend type=group fmri=library/python-2/simplejson-$(PYV)
+
 # force a group dependency on the optional python-memcached; pkgdepend work is
 # needed to flush this out.
 depend type=group fmri=library/python/python-memcached-$(PYV)
 
-# force a group dependency on the optional simplejson; pkgdepend work is needed
-# to flush this out.
-depend type=group fmri=library/python-2/simplejson-$(PYV)
-
 # force a group dependency on package delivering the optional solaris(5) brand
 depend type=group fmri=system/zones/brand/brand-solaris
 
@@ -918,6 +919,10 @@
 depend type=require fmri=__TBD \
     pkg.debug.depend.file=usr/share/novnc/vnc_auto.html
 
+# force a dependency on cloud/openstack/openstack-common until it is
+# available in the WOS
+depend type=require fmri=cloud/openstack/openstack-common
+
 # force a dependency on argparse; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python-2/argparse-$(PYV)
 
@@ -927,38 +932,60 @@
 # force a dependency on boto; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python-2/boto-$(PYV)
 
+# force a dependency on decorator; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/decorator-$(PYV)
+
+# force a dependency on greenlet; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/greenlet-$(PYV)
+
+# force a dependency on jsonschema; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/jsonschema-$(PYV)
+
+# force a dependency on lxml; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/lxml-$(PYV)
+
+# force a dependency on netaddr; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/netaddr-$(PYV)
+
+# force a dependency on paste; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/paste-$(PYV)
+
+# force a dependency on paste.deploy; pkgdepend work is needed to flush this
+# out.
+depend type=require fmri=library/python-2/paste.deploy-$(PYV)
+
+# force a dependency on pyasn1; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/pyasn1-$(PYV)
+
+# force a dependency on requests; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/requests-$(PYV)
+
+# force a dependency on routes; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/routes-$(PYV)
+
+# force a dependency on setuptools; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/setuptools-$(PYV)
+
+# force a dependency on stevedore; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python-2/stevedore-$(PYV)
+
 # force a dependency on cinderclient; pkgdepend work is needed to flush this
 # out.
 depend type=require fmri=library/python/cinderclient-$(PYV)
 
-# force a dependency on decorator; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/decorator-$(PYV)
-
 # force a dependency on glanceclient; pkgdepend work is needed to flush this
 # out.
 depend type=require fmri=library/python/glanceclient-$(PYV)
 
-# force a dependency on greenlet; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/greenlet-$(PYV)
-
 # force a dependency on iso8601; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python/iso8601-$(PYV)
 
 # force a dependency on jinja2; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python/jinja2-$(PYV)
 
-# force a dependency on jsonschema; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/jsonschema-$(PYV)
-
 # force a dependency on keystonemiddleware; used via a paste.deploy filter
 depend type=require fmri=library/python/keystonemiddleware-$(PYV)
 
-# force a dependency on lxml; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/lxml-$(PYV)
-
-# force a dependency on netaddr; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/netaddr-$(PYV)
-
 # force a dependency on neutronclient; pkgdepend work is needed to flush this
 # out.
 depend type=require fmri=library/python/neutronclient-$(PYV)
@@ -976,37 +1003,15 @@
 # force a dependency on oslo.utils; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python/oslo.utils-$(PYV)
 
-# force a dependency on paste; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/paste-$(PYV)
-
-# force a dependency on paste.deploy; pkgdepend work is needed to flush this
-# out.
-depend type=require fmri=library/python-2/paste.deploy-$(PYV)
-
 # force a dependency on pbr; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python/pbr-$(PYV)
 
-# force a dependency on pyasn1; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/pyasn1-$(PYV)
-
-# force a dependency on requests; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/requests-$(PYV)
-
 # force a dependency on rfc3986; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python/rfc3986-$(PYV)
 
-# force a dependency on routes; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/routes-$(PYV)
-
-# force a dependency on setuptools; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/setuptools-$(PYV)
-
 # force a dependency on six; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python/six-$(PYV)
 
-# force a dependency on stevedore; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python-2/stevedore-$(PYV)
-
 # force a dependency on websockify; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python/websockify-$(PYV)
 
--- a/components/openstack/swift/files/swift-upgrade	Wed May 27 05:22:49 2015 -0700
+++ b/components/openstack/swift/files/swift-upgrade	Wed May 27 15:21:04 2015 -0600
@@ -14,89 +14,57 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-from ConfigParser import NoOptionError
-from datetime import datetime
-import errno
 import glob
 import os
-import shutil
 from subprocess import check_call, Popen, PIPE
 import sys
 import traceback
 
-import iniparse
 import smf_include
 
+from openstack_common import create_backups, modify_conf
+
 
-def modify_conf(old_file):
-    """ Copy over all uncommented options from the old configuration file.
-    """
-
-    new_file = old_file + '.new'
-
-    # open the previous version
-    old = iniparse.ConfigParser()
-    old.readfp(open(old_file))
+ACCOUNT_SERVER_EXCEPTIONS = [
+    ('DEFAULT', 'bind_port'),
+    ('DEFAULT', 'workers'),
+]
 
-    # open the new version
-    new = iniparse.ConfigParser()
-    try:
-        new.readfp(open(new_file))
-    except IOError as err:
-        if err.errno == errno.ENOENT:
-            # The upgrade did not deliver a .new file so, return
-            print "%s not found - continuing with %s" % (new_file, old_file)
-            return
-        else:
-            raise
-    print "\nupdating %s" % old_file
+CONTAINER_SERVER_EXCEPTIONS = [
+    ('DEFAULT', 'bind_port'),
+    ('DEFAULT', 'workers'),
+]
 
-    # walk every single section for uncommented options
-    default_items = set(old.items('DEFAULT'))
-    for section in old.sections() + ['DEFAULT']:
-
-        # DEFAULT items show up in every section so remove them
-        if section != 'DEFAULT':
-            section_items = set(old.items(section)) - default_items
-        else:
-            section_items = default_items
+DISPERSION_CONF_EXCEPTIONS = [
+    ('dispersion', 'auth_url'),
+    ('dispersion', 'auth_user'),
+    ('dispersion', 'auth_key'),
+]
 
-        for key, value in section_items:
-            # keep a copy of the old value
-            oldvalue = value
-            oldsection = section
-
-            if not new.has_section(section):
-                if section != 'DEFAULT':
-                    new.add_section(section)
+OBJECT_SERVER_EXCEPTIONS = [
+    ('DEFAULT', 'bind_port'),
+    ('DEFAULT', 'workers'),
+]
 
-            # print to the log when a value for the same section.key is
-            # changing to a new value
-            try:
-                new_value = new.get(section, key)
-                if new_value != value and '%SERVICE' not in new_value:
-                    print "Changing [%s] %s:\n- %s\n+ %s" % \
-                        (section, key, oldvalue, new_value)
-                    print
-            except NoOptionError:
-                # the new configuration file does not have this option set so
-                # just continue
-                pass
+PROXY_SERVER_EXCEPTIONS = [
+    ('DEFAULT', 'bind_port'),
+    ('filter:authtoken', 'auth_uri'),
+    ('filter:authtoken', 'identity_uri'),
+    ('filter:authtoken', 'admin_tenant_name'),
+    ('filter:authtoken', 'admin_user'),
+    ('filter:authtoken', 'admin_password'),
+    ('filter:authtoken', 'delay_auth_decision'),
+    ('filter:authtoken', 'cache'),
+    ('filter:authtoken', 'include_service_catalog'),
+    ('filter:authtoken', 'signing_dir'),
+]
 
-            # Only copy the old value to the new conf file if the entry doesn't
-            # exist or if it contains '%SERVICE'
-            if not new.has_option(section, key) or \
-               '%SERVICE' in new.get(section, key):
-                new.set(section, key, value)
-            section = oldsection
-
-    # copy the old conf file to a backup
-    today = datetime.now().strftime("%Y%m%d%H%M%S")
-    shutil.copy2(old_file, old_file + '.' + today)
-
-    # copy the new conf file in place
-    with open(old_file, 'wb+') as fh:
-        new.write(fh)
+SWIFT_CONF_EXCEPTIONS = [
+    ('swift-hash', 'swift_hash_path_suffix'),
+    ('swift-hash', 'swift_hash_path_prefix'),
+    ('storage-policy:0', 'name'),
+    ('storage-policy:0', 'default'),
+]
 
 
 def start():
@@ -121,16 +89,25 @@
     if glob.glob('/etc/swift/*.new'):
         # the versions are different, so perform an upgrade
         # modify the configuration files
-        modify_conf('/etc/swift/account-server.conf')
+
+        # backup all the old configuration files
+        create_backups('/etc/swift')
+
+        modify_conf('/etc/swift/account-server.conf', None,
+                    ACCOUNT_SERVER_EXCEPTIONS)
         modify_conf('/etc/swift/container-reconciler.conf')
-        modify_conf('/etc/swift/container-server.conf')
+        modify_conf('/etc/swift/container-server.conf', None,
+                    CONTAINER_SERVER_EXCEPTIONS)
         modify_conf('/etc/swift/container-sync-realms.conf')
-        modify_conf('/etc/swift/dispersion.conf')
+        modify_conf('/etc/swift/dispersion.conf', None,
+                    DISPERSION_CONF_EXCEPTIONS)
         modify_conf('/etc/swift/memcache.conf')
         modify_conf('/etc/swift/object-expirer.conf')
-        modify_conf('/etc/swift/object-server.conf')
-        modify_conf('/etc/swift/proxy-server.conf')
-        modify_conf('/etc/swift/swift.conf')
+        modify_conf('/etc/swift/object-server.conf', None,
+                    OBJECT_SERVER_EXCEPTIONS)
+        modify_conf('/etc/swift/proxy-server.conf', None,
+                    PROXY_SERVER_EXCEPTIONS)
+        modify_conf('/etc/swift/swift.conf', None, SWIFT_CONF_EXCEPTIONS)
 
     # update the current version
     check_call(['/usr/sbin/svccfg', '-s', os.environ['SMF_FMRI'], 'setprop',
@@ -144,6 +121,8 @@
     os.putenv('LC_ALL', 'C')
     try:
         smf_include.smf_main()
+    except RuntimeError:
+        sys.exit(smf_include.SMF_EXIT_ERR_FATAL)
     except Exception as err:
         print 'Unknown error:  %s' % err
         print
--- a/components/openstack/swift/files/swift-upgrade.xml	Wed May 27 05:22:49 2015 -0700
+++ b/components/openstack/swift/files/swift-upgrade.xml	Wed May 27 15:21:04 2015 -0600
@@ -33,7 +33,7 @@
     <logfile_attributes permissions='600'/>
 
     <exec_method timeout_seconds="300" type="method" name="start"
-      exec=":true">
+      exec="/lib/svc/method/swift-upgrade %m">
       <method_context>
         <method_credential user='swift' group='swift' />
       </method_context>
--- a/components/openstack/swift/swift.p5m	Wed May 27 05:22:49 2015 -0700
+++ b/components/openstack/swift/swift.p5m	Wed May 27 15:21:04 2015 -0600
@@ -114,7 +114,8 @@
 hardlink path=lib/svc/method/swift-object-updater
 file path=lib/svc/method/swift-proxy-server
 file path=lib/svc/method/swift-replicator-rsync
-file path=lib/svc/method/swift-upgrade
+file path=lib/svc/method/swift-upgrade \
+    pkg.depend.bypass-generate=.*/openstack_common.*
 file path=usr/bin/swift-account-audit
 file path=usr/bin/swift-account-info
 file path=usr/bin/swift-config
@@ -288,11 +289,9 @@
 #
 license LICENSE license="Apache v2.0"
 
-# force a dependency on dnspython; pkgdepend work is needed to flush this out.
-depend type=require fmri=library/python/dnspython-$(PYV)
-
-# force a dependency on keystonemiddleware; used via a paste.deploy filter
-depend type=require fmri=library/python/keystonemiddleware-$(PYV)
+# force a dependency on cloud/openstack/openstack-common until it is
+# available in the WOS
+depend type=require fmri=cloud/openstack/openstack-common
 
 # force a dependency on netifaces; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python-2/netifaces-$(PYV)
@@ -304,5 +303,11 @@
 # force a dependency on setuptools; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python-2/setuptools-$(PYV)
 
+# force a dependency on dnspython; pkgdepend work is needed to flush this out.
+depend type=require fmri=library/python/dnspython-$(PYV)
+
+# force a dependency on keystonemiddleware; used via a paste.deploy filter
+depend type=require fmri=library/python/keystonemiddleware-$(PYV)
+
 # force a dependency on xattr; pkgdepend work is needed to flush this out.
 depend type=require fmri=library/python/xattr-$(PYV)